Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Async support - Lazy dcc.Graph and lazy plotlyjs #616

Merged
merged 131 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
074b92f
- plotly.js-dist
Aug 26, 2019
a5f38d7
Merge remote-tracking branch 'origin/dev' into exp-dynamic-2
Aug 26, 2019
81e09ec
remove plotly resource
Aug 26, 2019
7305354
ci -> dev
Aug 26, 2019
55dada3
dynamic
Aug 26, 2019
8a94e68
merge with 'dev'
Aug 26, 2019
9d1bdef
Merge branch 'dev' into exp-dynamic-2
Marc-Andre-Rivet Aug 28, 2019
7601fd3
include async files
Aug 28, 2019
6a48e87
remove plotlyjs file check
Aug 28, 2019
c68ed52
multi extendData support in lazy graph component
Aug 28, 2019
6b7f743
duplicated componentDidMount
Aug 28, 2019
8584554
update wrapper
Aug 28, 2019
72bfdb4
merge 'dev' onto 'exp-dynamic-2'
Aug 29, 2019
521f0dd
clean up
Aug 30, 2019
68e87bb
update lazy factory ordering
Aug 30, 2019
0f0ddd2
- window.Plotly shim for eager loading
Sep 10, 2019
5246acd
default to window.Plotly if possible
Sep 16, 2019
00278cd
Merge branch 'dev' into exp-dynamic-2
Marc-Andre-Rivet Sep 16, 2019
3b18a7c
_js_dist
Sep 16, 2019
d54ae5d
Merge branch 'exp-dynamic-2' of github.com:plotly/dash-core-component…
Sep 16, 2019
4a6020b
core-js and dynamic import
Sep 16, 2019
8332725
jest core-js
Sep 16, 2019
b2f9b58
jest entry corejs
Sep 16, 2019
fa04e80
more corejs
Sep 16, 2019
8547864
update jest and usage
Sep 16, 2019
822af5f
lint
Sep 16, 2019
c26f13f
off
Sep 16, 2019
c928498
usage -> entry
Sep 16, 2019
1029922
...
Sep 16, 2019
7bfe0cc
update build (because..)
Sep 16, 2019
1ec813c
Sep 17, 2019
3ae5667
Merge remote-tracking branch 'origin/dev' into exp-dynamic-2
Sep 17, 2019
d56e89b
--ignore-installed
Sep 17, 2019
937f800
bust cache
Sep 17, 2019
b0aa387
clear extend data
Sep 18, 2019
e9fc33c
Undo tests
Marc-Andre-Rivet Sep 18, 2019
4662895
ci cache?
Sep 18, 2019
c8683a6
ci cache?
Sep 18, 2019
3ecf58e
dev,testing
Sep 18, 2019
bf4c122
xargs
Sep 18, 2019
92418ee
xargs 2
Sep 18, 2019
3a430ff
Merge branch 'dev' into exp-dynamic-2
Marc-Andre-Rivet Sep 18, 2019
1825e11
i am slowly going crazy
Sep 18, 2019
ee2280a
Merge branch 'exp-dynamic-2' of github.com:plotly/dash-core-component…
Sep 18, 2019
fa28aff
.
Sep 18, 2019
93e3fdd
..
Sep 18, 2019
e396489
...
Sep 18, 2019
bcc6c3f
....
Sep 18, 2019
fe1c5e3
async / sleep
Sep 23, 2019
689de7a
wait on async graph
Sep 23, 2019
ca8e38a
dash_duo
Sep 23, 2019
d2e9a7f
respect format
Sep 23, 2019
4e2fc30
typo
Sep 23, 2019
1265c0e
ordering
Sep 23, 2019
0f3938c
wait for gaph 1
Sep 23, 2019
4e28afc
Merge remote-tracking branch 'origin/dev' into exp-dynamic-2
Sep 23, 2019
1cb1ce9
update lazy loading wrapper
Sep 24, 2019
9c2918b
Sep 24, 2019
31a30fe
mute progress bar and change order
Sep 24, 2019
80a606f
Sep 24, 2019
7cc5a72
Sep 24, 2019
d5c04fe
:wrench: update ci
Sep 25, 2019
7b447e5
Sep 25, 2019
14aa662
Sep 25, 2019
81c43fd
Sep 25, 2019
6779435
Sep 25, 2019
55b11b9
Sep 25, 2019
551d78e
Sep 25, 2019
c6951d8
Sep 25, 2019
cefe498
Sep 25, 2019
59f60bc
Sep 25, 2019
678ab09
Sep 25, 2019
9a62872
rm the evil
Sep 25, 2019
bbca47f
wrong location
Sep 25, 2019
b657a1c
Merge remote-tracking branch 'origin/dev' into exp-dynamic-2
Sep 26, 2019
791d5b3
lint
Sep 26, 2019
8d43698
lint
Sep 26, 2019
c05ce6c
if py>=3
Sep 26, 2019
e2de81f
[wip] Use `async` for dash eager/lazy support
Sep 26, 2019
a5f47d3
missed by the delete merge?
Sep 26, 2019
6e995f9
Merge remote-tracking branch 'origin/dev' into exp-dynamic-2
Sep 27, 2019
a8c8cb2
test config
Sep 30, 2019
e210049
use alpha version of renderer/async and plugin
Oct 2, 2019
6834126
format
Oct 2, 2019
3d2846a
bump renderer
Oct 2, 2019
0009736
changelog
Oct 2, 2019
8283bb5
test?!
Oct 2, 2019
e201a93
undo
Oct 2, 2019
66324d0
lock?
Oct 2, 2019
0101cb7
npm ci
Oct 2, 2019
2a3dece
react
Oct 2, 2019
0d1ce86
update renderer to a3
Oct 2, 2019
046d6ac
new packages
Oct 3, 2019
f251ce0
lint
Oct 3, 2019
85d8446
rename
Oct 3, 2019
9f8698c
lint
Oct 3, 2019
7776f5c
- plotly.js-dist -> plotly.js (fixed version)
Oct 3, 2019
bc5e2e5
plotly.js
Oct 3, 2019
1044563
update usage
Oct 3, 2019
efe1e76
changelog
Oct 3, 2019
bc84f05
update @plotly/dash-component-plugins
Oct 4, 2019
dc2c14d
Merge branch 'dev' into exp-dynamic-2
Marc-Andre-Rivet Oct 9, 2019
beeae2f
- bump plotlyjs to 1.50.0
Oct 9, 2019
3b34d40
lint
Oct 9, 2019
17c6c60
lint
Oct 9, 2019
6dc2061
percy snapshot name
Oct 9, 2019
9488ac6
revert test changes
Oct 9, 2019
9a3f5ba
parametrize grbs001
Oct 10, 2019
b800485
cleanup
Oct 10, 2019
5d26e15
lint
Oct 10, 2019
d2a8f68
parametrize all dcc graph tests
Oct 10, 2019
4a6615d
lint
Oct 10, 2019
ddd91d5
update tab/graph test to new pattern
Oct 10, 2019
8f574d5
move more graph tests to dash_dcc
Oct 10, 2019
5acdfc1
rewrite additional tests the new way
Oct 10, 2019
5f71ea8
lint
Oct 10, 2019
3fc4584
lint / black
Oct 10, 2019
6519349
py27
Oct 10, 2019
10cf3ca
parametrized snapshot names
Oct 10, 2019
3989450
snapshot parametrized name
Oct 10, 2019
00b3f77
snapshot
Oct 10, 2019
ba4a451
lint
Oct 10, 2019
24ae964
lint
Oct 10, 2019
6c00ed2
plotlyjs update
Oct 10, 2019
eb00081
Merge branch 'dev' into exp-dynamic-2
Marc-Andre-Rivet Oct 10, 2019
194b4f6
external plotlyjs prevents async~plotlyjs request
Oct 11, 2019
644bb64
Merge branch 'exp-dynamic-2' of github.com:plotly/dash-core-component…
Oct 11, 2019
b9595a1
lint
Oct 11, 2019
c029a58
merge changes from 'dev'
Oct 17, 2019
078bc87
lint
Oct 17, 2019
f3e1119
fix mege
Oct 21, 2019
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
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
command: |
. venv/bin/activate && mkdir packages
# build main dash
git clone --depth 1 https://github.com/plotly/dash.git dash-main
git clone --depth 1 -b exp-dynamic https://github.com/plotly/dash.git dash-main
cd dash-main && pip install -e .[dev] --progress-bar off && python setup.py sdist && mv dist/* ../packages/
cd dash-renderer && npm run build
python setup.py sdist && mv dist/* ../../packages/ && cd ../..
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"no-extend-native": ["error"],
"no-extra-bind": ["error"],
"no-extra-boolean-cast": ["error"],
"no-inline-comments": ["error"],
"no-inline-comments": ["off"],
"no-implicit-coercion": ["error"],
"no-implied-eval": ["error"],
"no-inner-declarations": ["off"],
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- [#616](https://github.com/plotly/dash-core-components/pull/616) Async Graph and Plotly.js

## [1.3.1] - 2019-10-17
### Updated
- Upgraded plotly.js to 1.50.1 [#681](https://github.com/plotly/dash-core-components/issues/681)
Expand Down
10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ Locally](README.md#testing-locally) section of README.md.

## Updating Plotly.js

1. Download the latest plotly.js from the cdn: `$ wget https://github.com/plotly/plotly.js/releases/tag/v1.49.4`
2. Update `dash_core_components/__init__.py` plotly.js `external_url`
3. Update `CHANGELOG.md` with links to the releases and a description of the changes. The message should state (see the existing `CHANGELOG.md` for examples):
1. Update the version of `plotly.js` in package.json. Always use an exact version without "^" or "~"
2. Run `npm install` followed by `npm run build`, this will ensure the latest version of Plotly.js is in `node_modules` and copy
that version over with the other build artifacts
3. Update `dash_core_components_base/__init__.py` plotly.js `relative_package_path` and `external_url`
4. Update `CHANGELOG.md` with links to the releases and a description of the changes. The message should state (see the existing `CHANGELOG.md` for examples):
* If you're only bumping the patch level, the heading is "Fixed" and the text starts "Patched plotly.js". Otherwise the heading is "Updated" and the text starts "Upgraded plotly.js"
* The new plotly.js version number, and the PR in which this was done
* All major or minor versions included, with links to their release pages and a summary of the major new features in each. If there are multiple minor/major releases included, be sure to look at all of their release notes to construct the summary. Call minor versions "feature" versions for the benefit of users not steeped in semver terminology.
* All patch versions included, with links to their release pages and a note that these fix bugs
4. When bumping the dcc version, a plotly.js patch/minor/major constitutes a dcc patch/minor/major respectively as well.
5. When bumping the dcc version, a plotly.js patch/minor/major constitutes a dcc patch/minor/major respectively as well.

## Financial Contributions

Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include dash_core_components/dash_core_components.min.js
include dash_core_components/dash_core_components.min.js.map
include dash_core_components/async~*.js
include dash_core_components/async~*.js.map
include dash_core_components/highlight.pack.js
include dash_core_components/metadata.json
include dash_core_components/package-info.json
Expand Down
20 changes: 20 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const presets = [
['@babel/env', {
useBuiltIns: 'usage',
corejs: 3
}],
'@babel/preset-react'
];

const plugins = [
'@babel/plugin-syntax-dynamic-import'
];

// eslint-disable-next-line no-process-env
if (process.env.ENV === "test") {
plugins.push("styled-jsx/babel-test");
} else {
plugins.push("styled-jsx/babel");
}

module.exports = { presets, plugins };
55 changes: 47 additions & 8 deletions dash_core_components_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@

_this_module = _sys.modules[__name__]


_js_dist = [
{
'external_url': 'https://cdn.plot.ly/plotly-1.50.1.min.js',
'relative_package_path': 'plotly-1.50.1.min.js',
'namespace': 'dash_core_components'
},
{
'relative_package_path': 'highlight.pack.js',
'namespace': 'dash_core_components'
Expand All @@ -66,8 +60,53 @@
).format(__version__),
'namespace': 'dash_core_components',
'dynamic': True
}
},
{
'relative_package_path': 'async~graph.js',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~graph.js'
).format(__version__),
'namespace': 'dash_core_components',
'async': True
},
{
'relative_package_path': 'async~graph.js.map',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~graph.js.map'
).format(__version__),
'namespace': 'dash_core_components',
'dynamic': True
},
{
'relative_package_path': 'plotly-1.50.1.min.js',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/plotly-1.50.1.min.js'
).format(__version__),
'namespace': 'dash_core_components',
'async': 'eager'
},
{
'relative_package_path': 'async~plotlyjs.js',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~graph~plotlyjs.js'
).format(__version__),
'namespace': 'dash_core_components',
'async': 'lazy'
},
{
'relative_package_path': 'async~plotlyjs.js.map',
'external_url': (
'https://unpkg.com/dash-core-components@{}'
'/dash_core_components/async~graph~plotlyjs.js.map'
).format(__version__),
'namespace': 'dash_core_components',
'dynamic': True
},
]

for _component in __all__:
setattr(locals()[_component], '_js_dist', _js_dist)
setattr(locals()[_component], '_js_dist', _js_dist)
14 changes: 14 additions & 0 deletions generator/plotly.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const fs = require('fs');

const package = JSON.parse(fs.readFileSync('package.json'));

const plotlyJsVersion = (package.dependencies && package.dependencies['plotly.js']) ||
(package.devDependencies && package.devDependencies['plotly.js']);

fs.copyFile('node_modules/plotly.js/dist/plotly.min.js', `dash_core_components/plotly-${plotlyJsVersion}.min.js`, err => {
if (err) {
throw err;
}

console.log('copied plotly.js', plotlyJsVersion);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy plotly.min.js as part of the build's generator step.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to update https://github.com/plotly/dash-core-components/blob/dev/CONTRIBUTING.md#updating-plotlyjs - it's already out of date but will be waaaaay simpler after this change 😍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating. It's not really all that much simpler though, as it's only updating one step in the whole generation process. 6c00ed2

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah true... though partly that's because the previous version was missing a step - clearing out the old plotly.js version manually - that was a source of errors in the past. Further simplification will come when we auto-generate __init__.py in its entirety.

Loading