Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc1.0.0 #74

Merged
merged 77 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
cad5e10
Write stubs for app and user tests
pausz May 11, 2022
2dcb6f9
Save users to datastore
pausz May 11, 2022
35cc043
Generate a user, save it to app datastore and load it
pausz May 11, 2022
f79d3a3
Use app context to save and load user to ds
pausz May 11, 2022
c93c282
Test default users
pausz May 11, 2022
6658b12
Test users jsonify()
pausz May 11, 2022
c7aafd8
Test admin user
pausz May 11, 2022
c33b978
Test admin user
pausz May 11, 2022
066e0d6
Test user registration
pausz May 11, 2022
53d2ba0
Test user registration
pausz May 11, 2022
cf8c5a8
Test admin actions
pausz May 11, 2022
163d248
Test admin actions
pausz May 11, 2022
cd6f8bd
Cover admin actions when matching users is None
pausz May 11, 2022
7ce758c
Add case for sw.serve()
pausz May 11, 2022
70a5216
Remove unfinished line
pausz May 11, 2022
7c7c8c4
Make some default app configs
pausz May 11, 2022
b637ca9
Use Testing config from sw_appconfig
pausz May 11, 2022
7741d09
Import sw_appconfig
pausz May 11, 2022
43e144e
Rework basic tests
pausz May 11, 2022
b4dd4a6
Test basic app creation functinalit
pausz May 12, 2022
b972977
Test route
pausz May 12, 2022
04c2e65
Test make datastore default params
pausz May 16, 2022
08ead52
Clean up assertions
pausz May 16, 2022
da16218
Test copy datastore
pausz May 16, 2022
9c1f9f7
Test misc functionality, fix assertion
pausz May 16, 2022
8ef35e9
Test failing: Need to flush default redis db manually
pausz May 16, 2022
5cbd924
Flush default redis ds at the end of tests
pausz May 16, 2022
f81def2
Test exception blocks
pausz May 16, 2022
d2a6551
Test save and load tasks
pausz May 16, 2022
c8bbaa4
Pretty print flask config
pausz May 16, 2022
b0975e9
Define config for testing tasks
pausz May 16, 2022
8850898
Define config for testing tasks
pausz May 16, 2022
2585f39
Return destination ds
pausz May 16, 2022
a32824e
Get started with testing tasks
pausz May 16, 2022
be642d6
update version
cliffckerr Dec 13, 2023
f1c898d
update requirements and setup
cliffckerr Dec 13, 2023
5e744f1
working with flask updates
cliffckerr Dec 13, 2023
0bece29
remove return none
cliffckerr Dec 13, 2023
4ce5e62
update docstrings
cliffckerr Dec 13, 2023
2b10139
Merge branch 'main' into rc1.0.0
cliffckerr Dec 13, 2023
819dd31
Merge branch 'user-created-modified' into rc1.0.0
cliffckerr Dec 13, 2023
56ea844
add app test
cliffckerr Dec 13, 2023
a46a0f9
updating tests
cliffckerr Dec 13, 2023
0b7e0e1
merged, tests do not pass yet
cliffckerr Dec 13, 2023
7ff9b4f
datastore tests pass now, partly
cliffckerr Dec 13, 2023
970d01d
tests pass
cliffckerr Dec 13, 2023
a527938
update github tests
cliffckerr Dec 13, 2023
22ba527
disable browser tests
cliffckerr Dec 13, 2023
5682f30
Merge pull request #75 from sciris/rc1.0.0-coverage
cliffckerr Dec 13, 2023
bed57a4
update exception types
cliffckerr Dec 13, 2023
557f4b7
Merge branch 'rc1.0.0' of https://github.com/sciris/scirisweb into rc…
cliffckerr Dec 13, 2023
a5ad14c
making some progress
cliffckerr Dec 13, 2023
1bd08bd
working
cliffckerr Dec 13, 2023
cb8674b
working now
cliffckerr Dec 13, 2023
04996d8
add assets
cliffckerr Dec 13, 2023
47963eb
not working yet
cliffckerr Dec 13, 2023
ae7966e
getting closer
cliffckerr Dec 13, 2023
533c29e
add trend data
cliffckerr Dec 13, 2023
3045f33
working
cliffckerr Dec 14, 2023
76178ee
remove background
cliffckerr Dec 14, 2023
2384ee9
remove bootstrap
cliffckerr Dec 14, 2023
3d313ef
now working for example 2
cliffckerr Dec 14, 2023
7307494
start adding readmes
cliffckerr Dec 14, 2023
fe764a8
move gunicorn
cliffckerr Dec 14, 2023
0eb26d9
remove parallel example
cliffckerr Dec 14, 2023
091b6d6
rename shiny apps
cliffckerr Dec 14, 2023
772e341
add readmes
cliffckerr Dec 14, 2023
23f7cc0
rename everything
cliffckerr Dec 14, 2023
0fd876f
working on react example
cliffckerr Dec 14, 2023
bbffee5
working to render
cliffckerr Dec 14, 2023
0d2e627
updates
cliffckerr Dec 14, 2023
e46c9df
working with call
cliffckerr Dec 14, 2023
e7c005f
working
cliffckerr Dec 14, 2023
69d9437
adding cors
cliffckerr Dec 14, 2023
fbb9513
more updates
cliffckerr Dec 14, 2023
f9cf892
updated changelog
cliffckerr Dec 14, 2023
c6d48f4
update changelog
cliffckerr Dec 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
fail-fast: false
max-parallel: 8
matrix:
python-version: ['3.9']
python-version: ['3.11']
name: Run tests
steps:
- name: Checkout sources
Expand All @@ -25,4 +25,4 @@ jobs:
run: pip install -r requirements_test.txt
- name: Run integration tests
working-directory: ./tests
run: pytest -v test_*.py --workers auto --durations=0
run: pytest -v test_*.py -n auto --durations=0
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented. If you have any updates

By import convention, components of the ScirisWeb library are listed beginning with `sw.`, e.g. `sw.ScirisApp()`.

## Version 1.0.0 (2023-12-13)
1. Updated to work with current versions of Python and JavaScript libraries.
2. Added CORS option (required for serving via React).
3. Improved exception handling.
4. Added more examples (including React).
5. Updated tests.

## Version 0.17.1 (2022-02-02)
1. Fixed regression issue with Sciris.
2. Tests switched from Travis CI to GitHub Actions.
Expand Down
3 changes: 3 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples

These examples illustrate simple ScirisWeb usage. In most cases, to use these examples, run `python app.py` in a terminal, and then go to `localhost:8080` in your browser.
3 changes: 3 additions & 0 deletions examples/archive/gunicorn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Gunicorn

This shows example scripts for how to start an app using Gunicorn, and an NGINX configuration. These are useful for production-scale apps.
3 changes: 3 additions & 0 deletions examples/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hello World

The simplest possible ScirisWeb app.
File renamed without changes.
84 changes: 0 additions & 84 deletions examples/parallel/index.html

This file was deleted.

18 changes: 0 additions & 18 deletions examples/parallel/untitled1.py

This file was deleted.

18 changes: 0 additions & 18 deletions examples/parallel/untitled2.py

This file was deleted.

44 changes: 0 additions & 44 deletions examples/parallel/untitled3.py

This file was deleted.

3 changes: 3 additions & 0 deletions examples/plotting-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Plotting with React

A simple app illustrating plotting with a backend call, implemented in React.
29 changes: 15 additions & 14 deletions examples/parallel/app.py → examples/plotting-react/app.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
'''
Usage:

python app.py

then go to localhost:8080 in your browser.
'''

# Imports
import pylab as pl
import sciris as sc
import scirisweb as sw
from dask.distributed import Client


client = Client()

runserver = False # Choose to run in the frontend or backend
runserver = True # Choose to run in the frontend or backend

# Create the app
app = sw.ScirisApp(__name__, name="ParallelComputation")

#def
app = sw.ScirisApp(__name__, name="ReactPlot", cors=True) # CORS required for React (but not Vue)

# Define the RPCs
@app.register_RPC()
def computation(seed=0, n=1000):
# Define the API
@app.route('/showgraph')
def showgraph(n=1000):

# Make graph
pl.seed(int(seed))
fig = pl.figure()
ax = fig.add_subplot(111)
xdata = pl.randn(n)
Expand All @@ -28,11 +29,11 @@ def computation(seed=0, n=1000):
ax.scatter(xdata, ydata, c=colors)

# Convert to FE
graphjson = sw.mpld3ify(fig, jsonify=False) # Convert to dict
graphjson = sw.mpld3ify(fig) # Convert to dict
return graphjson # Return the JSON representation of the Matplotlib figure

# Run the server
if __name__ == "__main__" and runserver:
app.run()
else:
computation()
showgraph()
46 changes: 46 additions & 0 deletions examples/plotting-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>

<!-- Load core scripts -->
<head>
<title>Hello (React) World</title>
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@7"></script>
<script src="https://mpld3.github.io/js/mpld3.v0.5.9.js"></script>
</head>

<body>
<div id="root"></div>
<script type="text/babel">

// Define the functionality
function getdots() {
axios.post('http://localhost:8080/api/showgraph') // Use a POST request to pass along the value.
.then(function (response) {
document.getElementById('randomgraph').innerHTML = ''; // Clear the DOM before redrawing
mpld3.draw_figure('randomgraph', response.data);
})
}

// Define the layout
function MyApp() {
return (
<>
<h1>Hello, React plot!</h1>
<div id="randomgraph"></div>
<button onClick={getdots}>Get new dots</button>
</>
);
}

const container = document.getElementById('root');
const root = ReactDOM.createRoot(container);
root.render(<MyApp />);

</script>
</body>

</html>
3 changes: 3 additions & 0 deletions examples/plotting-vue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Plotting with Vue

A simple app illustrating plotting with a backend call, implemented in Vue.
4 changes: 2 additions & 2 deletions examples/hellograph/app.py → examples/plotting-vue/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
runserver = True # Choose to run in the frontend or backend

# Create the app
app = sw.ScirisApp(__name__, name="HelloGraph")
app = sw.ScirisApp(__name__, name="VuePlot")

# Define the API
@app.route('/showgraph')
Expand All @@ -36,4 +36,4 @@ def showgraph(n=1000):
if __name__ == "__main__" and runserver:
app.run()
else:
showgraph()
showgraph()
3 changes: 3 additions & 0 deletions examples/plotting-vue/assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Assets

This folder is not used, but uses frozen versions of key libraries to help with debugging.
2 changes: 2 additions & 0 deletions examples/plotting-vue/assets/d3.v5.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions examples/plotting-vue/assets/mpld3.v0.4.1.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions examples/plotting-vue/assets/polyfill.min.js

Large diffs are not rendered by default.

Loading
Loading