Skip to content

Commit 09c56ab

Browse files
delsimGibbsConsulting
authored andcommitted
Prerelease version 0.5.0 (#13)
* Refactor Pipe component so that the uid property is set per-js-instance and not per-py-instance. As a consequence it is no longer a first-class plotly dash property * Added plotly_dash settings, and use within routing and templates * Localised pipe websocket endpoint name determination * Remove unneeded global declaration * Suppress extra gc steps in favour of updating underlying packages * Relocate channels routing for all non-http dpd purposes * Added http endpoint to pass messages on to widgets * Added authorisation to routing: * Tidied up http consumer * Added django_redis - dev requirements requires a refresh: * Demo four now working with component uid generation and redis for caching inside django for demo. Out-of-band calls to update now handled cleanly with an empty response. * Removed older connected demo code and objects * Trimmed dev requirements list * Tidy up requirements * More tweaking of demo apps * Changed settings code to correctly locate plotly dash component modules * Added initial testing files * Separate demo and dpd linting and testing, and some linter-suggested changes * Added demo linting, and extended demo tests to pull in the main dpd test suite * Progress towards some testing of demo infrastructure * Add code coverage of demo and linter suggestions, leaving just the plotly_apps demo code to fix for both of these * Linter now at 9.92 out of 10, with a single fixme for the code coverage extension to the callbacks * Fix simpler dpd files for linter issues * Code improvements driven by pylint output * Moved to standard pylintrc config file * IMproved code based on linter output. Linter scores now above 9.8, and remaining issues are due to TODO in code * Relocate channels-dependent function to allow non-channels-use of django_plotly_dash * Import tweak * Minor readme tweaks * Test improvements * Fix up bad URL * Another small step towards adequate test coverage. Now at 50 pc of code * Updated documentation to cover configuration and installation of channels and redis * More developer-level documentation * More documentation, and reset python version to 3.5 * Added a faq and some related documentation points * More development documentation * More release instructions in development documentation * Remove redundant instructions * Rounded out first draft of development documentation * Add in live updating document chapter * More documentation * More documentation tweaks * Revise use of PLOTLY_DASH configuration settings, along with associated tests and documentation * Added configuration option to control insertion of demo data * Added test for migration flag * More testing of the demo app * App update through POST request Added test to check app updating through a post request to a demo model instance. Both stateless and stateful routes are used. * Fix up indentation to appease linter * Added use of click timestamp to demo, and expanded DjangoDash to add in bootstrap css * Clean up demo code for linter happiness * Improved demo somewhat, now outputs a plotly graph * More polishing of demo four * Extend to another colour * More finishing on demo four * Bump version to 0.5.0 Fix setup to include template and migration directories. Bump version number to 0.5.0 Remove outdated template.
1 parent 92a35de commit 09c56ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2031
-434
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,6 @@ ENV/
101101

102102
# mypy
103103
.mypy_cache/
104+
105+
# testing
106+
.pytest_cache/

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include django_plotly_dash/templates *.html

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# django-plotly-dash
22

3-
Expose [plotly dash](https://plot.ly/products/dash/) apps as [Django](https:://www.djangoproject.com/) tags. Multiple Dash apps can
3+
Expose [plotly dash](https://plot.ly/products/dash/) apps as [Django](https://www.djangoproject.com/) tags. Multiple Dash apps can
44
then be embedded into a single web page, persist and share internal state, and also have access to the
55
current user and session variables.
66

@@ -31,6 +31,10 @@ Then, just add `django_plotly_dash` to `INSTALLED_APPS` in your Django `settings
3131

3232
Note that this package requires version 2.0 or greater of Django, due to the use of the `path` function for registering routes.
3333

34+
Live updating of applications, to share application
35+
state, requires further
36+
configuration. See the [online documentation](https://django-plotly-dash.readthedocs.io/en/latest/) for more details.
37+
3438
## Demonstration
3539

3640
The source repository contains a demo application. To clone the repo and lauch the demo:
@@ -43,6 +47,10 @@ cd django-plotly-dash
4347
./make_env # sets up a virtual environment for development
4448
# with direct use of the source code for the package
4549

50+
./prepare_redis # downloads a redis docker container
51+
# and launches it with default settings
52+
# *THIS STEP IS OPTIONAL*
53+
4654
./prepare_demo # prepares and launches the demo
4755
# using the Django debug server at http://localhost:8000
4856
```
@@ -107,3 +115,12 @@ The registration code needs to be in a location
107115
that will be imported into the Django process before any model or template tag attempts to use it. The example Django application
108116
in the demo subdirectory achieves this through an import in the main `urls.py` file; any `views.py` would also be sufficient.
109117

118+
Whilst this example allows for the direct use of existing `Dash` applications, it does not provide for the sharing or updating of
119+
internal state. The [online documentation](https://django-plotly-dash.readthedocs.io/en/latest/) provides details on using these
120+
and other additional features.
121+
122+
## Development
123+
124+
The `make_env` script sets up the development environment, and pulls in the packages
125+
specified in the `dev_requirements.txt` file. The `check_code` script invokes the test suite (using `pytest`) as well
126+
as invoking `pylint` on both the package and the associated demo.

check_code

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
#
3+
./check_code_dpd
4+
./check_code_demo
5+
#
6+

check_code_demo

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
source env/bin/activate
4+
pushd demo
5+
pylint demo --rcfile=../pylintrc
6+
pytest demo --cov=demo --cov=django_plotly_dash --cov-report term-missing
7+
popd

check_code_dpd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
#
3+
source env/bin/activate
4+
#
5+
pylint django_plotly_dash

demo/demo/asgi.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
'Configure asgi server for serving asynchronous content such as websockets'
2+
13
import os
24
import django
35
from channels.routing import get_default_application
46

57
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings")
8+
69
django.setup()
7-
application = get_default_application()
810

11+
application = get_default_application()

demo/demo/consumers.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)