Skip to content

Merge dash renderer with DashPy #1611

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

Merged
merged 31 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a37b7d2
Added dash-renderer artifacts
HammadTheOne Apr 29, 2021
e7af1f5
Import renderer resources from Dash
HammadTheOne Apr 29, 2021
448b678
Added gulpfile to update renderer
HammadTheOne Apr 30, 2021
e447cbf
Updated gulpfile
HammadTheOne Apr 30, 2021
3b51822
Added newlines
HammadTheOne Apr 30, 2021
907c9e3
Another newline fix
HammadTheOne Apr 30, 2021
7f742ea
Updating gulpfile for version updates
HammadTheOne Apr 30, 2021
5c01200
Merge branch 'dev' into merge-dash-renderer
HammadTheOne Apr 30, 2021
c1296d7
Update CHANGELOG
HammadTheOne Apr 30, 2021
ea20450
Merge branch 'merge-dash-renderer' of https://github.com/plotly/dash …
HammadTheOne Apr 30, 2021
1872382
Merge branch 'dev' into merge-dash-renderer
HammadTheOne Apr 30, 2021
9f8e0aa
Flattening package structure and sourcing deps within Dash
HammadTheOne May 8, 2021
b59c3ee
Update package.json scripts
HammadTheOne May 8, 2021
2537d33
Fix conflicts
HammadTheOne May 8, 2021
ce82111
Merge branch 'dev' into merge-dash-renderer
HammadTheOne May 8, 2021
9900303
Updated manifest glob
HammadTheOne May 10, 2021
6dc2803
Fixed typo
HammadTheOne May 10, 2021
317d7e8
Added clean job
HammadTheOne May 10, 2021
6032a08
Updated build folder and deps
HammadTheOne May 10, 2021
afaf8d4
Added build artifacts to gitignore
HammadTheOne May 11, 2021
240e8f6
Updating build process and pylintrc
HammadTheOne May 12, 2021
3c15edf
Running tests with deps
HammadTheOne May 12, 2021
b578983
Update CircleCI config install of renderer
HammadTheOne May 12, 2021
d20dbf1
Updating config.yml
HammadTheOne May 12, 2021
a06e9cc
Update lint-unit tests
HammadTheOne May 12, 2021
6bb9b47
Merge branch 'dev' into merge-dash-renderer
HammadTheOne May 19, 2021
8a7363c
Remove dashr metadata update job from circleci
HammadTheOne May 25, 2021
afc363c
Updated manifest
HammadTheOne May 27, 2021
2aefb7f
Remove unnecessary import
HammadTheOne May 27, 2021
12752bd
Build cleanup
HammadTheOne May 27, 2021
44449a0
Linting exceptions
HammadTheOne May 28, 2021
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
12 changes: 4 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
command: |
. venv/bin/activate
set -eo pipefail
cd dash/dash-renderer && renderer build && cd ../../
pip install -e . --progress-bar off && pip list | grep dash
npm install --production && npm run initialize
npm run lint
Expand Down Expand Up @@ -121,7 +122,7 @@ jobs:
name: ️️🏗️ build core
command: |
. venv/bin/activate && pip install --no-cache-dir --upgrade -e . --progress-bar off && mkdir packages
cd dash-renderer && renderer build && python setup.py sdist && mv dist/* ../packages/ && cd ..
cd dash/dash-renderer && renderer build && cd ../../ && python setup.py sdist && mv dist/* packages/
git clone --depth 1 https://github.com/plotly/dash-core-components.git
cd dash-core-components && npm ci && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
ls -la packages
Expand Down Expand Up @@ -223,7 +224,7 @@ jobs:
name: ️️🏗️ build core
command: |
pip install --no-cache-dir --upgrade -e .[dev,testing] --progress-bar off
cd dash-renderer && renderer build && python setup.py sdist && mv dist/* ../packages/ && cd ..
cd dash/dash-renderer && renderer build && cd ../../ && python setup.py sdist && mv dist/* packages/
git clone --depth 1 https://github.com/plotly/dash-core-components.git
cd dash-core-components && npm ci && npm run build && python setup.py sdist && cd ..

Expand Down Expand Up @@ -256,12 +257,7 @@ jobs:
cd dash-html-components; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build)
cd ../dash-core-components; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build)
cd ../dash-table; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build); cd ..

- run:
name: 🔧 fix up dash metadata
command: |
sudo Rscript dashR/tests/circleci/fixup_metadata.R


- run:
name: 🎛 set environment variables
command: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ coverage.xml
# Distribution / packaging
.Python
build/
dash/deps/
develop-eggs/
dist/
downloads/
Expand All @@ -63,7 +64,6 @@ node_modules/
.npm
npm-debug*

dash_renderer/
dash_generator_test_component_standard/
dash_generator_test_component_nested/
dash_test_components/
Expand Down
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ disable=fixme,
superfluous-parens,
bad-continuation,
line-too-long,
bad-option-value
bad-option-value,
assigning-non-slot


# Enable the message, report, category or checker with the given id(s). You can
Expand Down
3 changes: 2 additions & 1 deletion .pylintrc39
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ disable=invalid-name,
line-too-long,
super-with-arguments,
raise-missing-from,
bad-option-value
bad-option-value,
assigning-non-slot

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to `dash` will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).

## [UNRELEASED]

## Dash and Dash Renderer
### Changed
- [#1611](https://github.com/plotly/dash/pull/1611) Package dash-renderer artifacts and dependencies with Dash, and source renderer resources from within Dash.

### Fixed
- [#1640](https://github.com/plotly/dash/pull/1640) Fix [#1475](https://github.com/plotly/dash/issues/1475), missing `timing_information` after certain modifications to Flask behavior

Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ include LICENSE
include requires-*.txt
include dash/favicon.ico
include dash/extract-meta.js
include dash/deps/*.js
recursive-include dash/dash-renderer *
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will include all the source files, won't it? I don't think we want to do that. The old dash-renderer MANIFEST.in is just:

include package.json
include digest.json
include dash_renderer/*.js
include dash_renderer/*.map

In the new structure, dash_renderer/*.js is replaced by dash/deps/*.js which you have above. I'm not aware of any value that package.json or digest.json have to end users so we should be able to ignore those...

Then there's the question of the *.map files: you're not currently including them, and in fact in the past in response to a user request to reduce the package size #810 we at one point removed them #910 but then for some reason that I can't find any record of we immediately reverted that 369ace9 before making a release. @Marc-Andre-Rivet do you have any memory of that? I don't see a PR or any discussion, just a revert commit

Anyway, is there anything else we really do want from the dash-renderer directory, or can we drop this line (as well as the line below that only exists in reference to this one)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in afc363c. We can safely drop the other lines

I'm noticing that .map files aren't being generated by the webpack for souce-mapping. Is this because we have inline-source-map?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah hmm, actually this changed in #1576 in a way that I hadn't recognized - @Marc-Andre-Rivet please confirm I'm understanding this correctly: the ONLY case we're generating a sourcemap now is when you run webpack-serve (which is what you get with npm start). The other build commands now seem to be all the same (as far as the bundle itself is concerned) and create no sourcemap. npm run build:js and build:dev are now literally the same command.

Unfortunately I can't actually run npm start ATM, and I don't think it does what we want anyway - really I'd like a command that outputs the same files we currently create, but stays open watching the source files for changes. @Marc-Andre-Rivet didn't we have that in the renderer at some point? Am I missing something about the updated tooling?

exclude dash/dash-renderer/node_modules/**
1 change: 1 addition & 0 deletions dash/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
from . import resources # noqa: F401,E402
from .version import __version__ # noqa: F401,E402
from ._callback_context import callback_context # noqa: F401,E402
from ._dash_renderer import _js_dist_dependencies, _js_dist # noqa: F401,E402
52 changes: 52 additions & 0 deletions dash/_dash_renderer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
__version__ = "1.9.1"

_js_dist_dependencies = [
{
"external_url": {
"prod": [
"https://unpkg.com/@babel/[email protected]/dist/polyfill.min.js",
"https://unpkg.com/[email protected]/umd/react.production.min.js",
"https://unpkg.com/[email protected]/umd/react-dom.production.min.js",
"https://unpkg.com/[email protected]/prop-types.min.js",
],
"dev": [
"https://unpkg.com/@babel/[email protected]/dist/polyfill.min.js",
"https://unpkg.com/[email protected]/umd/react.development.js",
"https://unpkg.com/[email protected]/umd/react-dom.development.js",
"https://unpkg.com/[email protected]/prop-types.js",
],
},
"relative_package_path": {
"prod": [
"deps/[email protected]",
"deps/[email protected]",
"deps/[email protected]",
"deps/[email protected]",
],
"dev": [
"deps/[email protected]",
"deps/[email protected]",
"deps/[email protected]",
"deps/[email protected]",
],
},
"namespace": "dash",
}
]


_js_dist = [
{
"relative_package_path": "deps/dash_renderer.min.js",
"dev_package_path": "deps/dash_renderer.dev.js",
"external_url": "https://unpkg.com/[email protected]"
"/dash_renderer/dash_renderer.min.js",
"namespace": "dash",
},
{
"relative_package_path": "deps/dash_renderer.min.js.map",
"dev_package_path": "deps/dash_renderer.dev.js.map",
"namespace": "dash",
"dynamic": True,
},
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 15 additions & 18 deletions dash-renderer/init.template → dash/dash-renderer/init.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import sys

__file__
__version__ = "$version"

_js_dist_dependencies = [
Expand All @@ -21,35 +18,35 @@ _js_dist_dependencies = [
},
"relative_package_path": {
"prod": [
"polyfill@$polyfill.min.js",
"react@$react.min.js",
"react-dom@$reactdom.min.js",
"prop-types@$proptypes.min.js",
"deps/polyfill@$polyfill.min.js",
"deps/react@$react.min.js",
"deps/react-dom@$reactdom.min.js",
"deps/prop-types@$proptypes.min.js",
],
"dev": [
"polyfill@$polyfill.min.js",
"react@$react.js",
"react-dom@$reactdom.js",
"prop-types@$proptypes.js",
"deps/polyfill@$polyfill.min.js",
"deps/react@$react.js",
"deps/react-dom@$reactdom.js",
"deps/prop-types@$proptypes.js",
],
},
"namespace": "dash_renderer",
"namespace": "dash",
}
]


_js_dist = [
{
"relative_package_path": "{}.min.js".format(__name__),
"dev_package_path": "{}.dev.js".format(__name__),
"relative_package_path": "deps/dash_renderer.min.js",
"dev_package_path": "deps/dash_renderer.dev.js",
"external_url": "https://unpkg.com/dash-renderer@$version"
"/dash_renderer/dash_renderer.min.js",
"namespace": "dash_renderer",
"namespace": "dash",
},
{
"relative_package_path": "{}.min.js.map".format(__name__),
"dev_package_path": "{}.dev.js.map".format(__name__),
"namespace": "dash_renderer",
"relative_package_path": "deps/dash_renderer.min.js.map",
"dev_package_path": "deps/dash_renderer.dev.js.map",
"namespace": "dash",
"dynamic": True,
},
]
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dash-renderer",
"version": "1.9.1",
"description": "render dash components in react",
"main": "dash_renderer/dash_renderer.min.js",
"main": "../deps/dash_renderer.min.js",
"scripts": {
"prepublishOnly": "rm -rf lib && babel src --extensions=\".ts,.tsx,.js,.jsx\" --out-dir lib --copy-files",
"private::format.eslint": "eslint --quiet --fix src tests",
Expand All @@ -13,7 +13,7 @@
"build:dev": "webpack",
"build:local": "renderer build local",
"build": "renderer build && npm run prepublishOnly",
"postbuild": "es-check es5 dash_renderer/*.js",
"postbuild": "es-check es5 ../deps/*.js",
"start": "webpack-serve ./webpack.serve.config.js",
"test": "karma start karma.conf.js --single-run",
"format": "run-s private::format.*",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const rendererOptions = {
main: ['whatwg-fetch', './src/index.js'],
},
output: {
path: path.resolve(__dirname, dashLibraryName),
path: path.resolve(__dirname, "..", "deps"),
filename: `${dashLibraryName}.dev.js`,
library: dashLibraryName,
libraryTarget: 'window',
Expand All @@ -64,7 +64,7 @@ module.exports = options => [
{
mode: 'production',
output: {
path: path.resolve(__dirname, dashLibraryName),
path: path.resolve(__dirname, "..", "deps"),
filename: `${dashLibraryName}.min.js`,
library: dashLibraryName,
libraryTarget: 'window',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ const config = require('./webpack.base.config');

module.exports = config({
target: ['web', 'es5']
});
});
8 changes: 4 additions & 4 deletions dash/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from pkg_resources import get_distribution, parse_version

import plotly
import dash_renderer

from .fingerprint import build_fingerprint, check_fingerprint
from .resources import Scripts, Css
Expand All @@ -47,6 +46,7 @@
stringify_id,
strip_relative_path,
)
from . import _dash_renderer
from . import _validate
from . import _watch

Expand Down Expand Up @@ -655,7 +655,7 @@ def _generate_scripts_html(self):
mode = "dev" if self._dev_tools["props_check"] is True else "prod"

deps = []
for js_dist_dependency in dash_renderer._js_dist_dependencies:
for js_dist_dependency in _dash_renderer._js_dist_dependencies:
dep = {}
for key, value in js_dist_dependency.items():
dep[key] = value[mode] if isinstance(value, dict) else value
Expand All @@ -671,7 +671,7 @@ def _generate_scripts_html(self):
+ self._collect_and_register_resources(
self.scripts.get_all_scripts(dev_bundles=dev)
+ self.scripts._resources._filter_resources(
dash_renderer._js_dist, dev_bundles=dev
_dash_renderer._js_dist, dev_bundles=dev
)
)
)
Expand Down Expand Up @@ -1423,7 +1423,7 @@ def enable_dev_tools(
# on some Python versions https://bugs.python.org/issue14710
packages = [
pkgutil.find_loader(x)
for x in list(ComponentRegistry.registry) + ["dash_renderer"]
for x in list(ComponentRegistry.registry)
if x != "__main__"
]

Expand Down
Loading