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

Assets #868 #874

Merged
merged 55 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e21cf1c
:hocho: favicon is provided by dash
Aug 15, 2019
ef66d8f
npm audit fix
Aug 15, 2019
2ed8493
:bug: keywords for 2 and 3 are different
Aug 15, 2019
9747e33
:lipstick: format with black
Aug 15, 2019
7dfaeff
:hocho: remove the whole asset repo
Aug 16, 2019
e1a5c0a
:camel: DRY
Aug 17, 2019
807d0a8
:wrench: ignore all bundles in git
Aug 17, 2019
e18b1a7
use specific version for required bundles, fix bug of check-prop-types
Aug 17, 2019
3519489
:bento: update lock
Aug 17, 2019
00808cf
:sparkles: renderer added to drive the process
Aug 17, 2019
a775771
update contribute guide
Aug 17, 2019
3cb4c6f
:bug: fix a logic issue
Aug 17, 2019
b0e95b3
:wrench: update ci
Aug 17, 2019
c226725
:lipstick: fix lint and black
Aug 17, 2019
43a45eb
update the MANIFEST for bundles
Aug 17, 2019
9e5d6fb
Revert "update the MANIFEST for bundles"
Aug 17, 2019
b2c003a
update MANIFEST
Aug 17, 2019
bbcd0e8
:lipstick: lint
Aug 17, 2019
3dc0c31
try solve the path issue in python2
Aug 17, 2019
92842de
fix format
Aug 17, 2019
223835a
fix lint in py27
Aug 17, 2019
e8c017e
:alembic: dbg with ci
Aug 17, 2019
17e6641
:alembic: tune
Aug 17, 2019
2ea7cd4
tune
Aug 17, 2019
ebf51c9
optimize bundles for CI, react dev version is slow
Aug 17, 2019
747c112
add manifest?
Aug 17, 2019
47ee2b0
:hocho: this case doesn't make sense anymore
Aug 17, 2019
6399c80
Update test_render.py
byronz Aug 17, 2019
d273bdb
:ok_hand: based on MAR comments
Aug 19, 2019
fc4ea3d
:packages:
Aug 19, 2019
97fd85b
Merge remote-tracking branch 'origin/assets-#868' into assets-#868
Aug 19, 2019
bce16dc
:ok_hand: leave these file for master
Aug 19, 2019
6388cb5
:bug: make the version read consistent
Aug 19, 2019
61f801d
Update dash/development/build_renderer.py
byronz Aug 20, 2019
638be3f
:ok_hand: comments
Aug 20, 2019
b373d0d
python2 and 3 with future
Aug 20, 2019
d983610
Merge remote-tracking branch 'origin/assets-#868' into assets-#868
Aug 20, 2019
8e8db02
more specific on manifest
Aug 20, 2019
0ddd5eb
more improvements
Aug 20, 2019
78aff76
encode
Aug 20, 2019
a63730c
pass pylint
Aug 20, 2019
c974139
:see_no_evils:
Aug 20, 2019
1a7b0c7
entry point change
Aug 20, 2019
f0e922d
:pencil: update guide and change renderer tool
Aug 20, 2019
76121c2
:memo: update changelog
Aug 20, 2019
309209e
:horse:
Aug 20, 2019
9508469
:unicorn:
Aug 20, 2019
b24f8cf
:pencil2: add watch
Aug 20, 2019
a9aa4d1
typo
Aug 20, 2019
cc2b638
Update CONTRIBUTING.md
byronz Aug 20, 2019
7658fa1
Update CONTRIBUTING.md
byronz Aug 20, 2019
7f59fe6
Update CONTRIBUTING.md
byronz Aug 20, 2019
1b05fe0
Update CONTRIBUTING.md
byronz Aug 20, 2019
0c5df92
Update CONTRIBUTING.md
byronz Aug 20, 2019
6bf596f
:ok_hand:
Aug 20, 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
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ jobs:
key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
paths:
- "venv"

- run:
name: ️️🏗️ build core
command: |
. venv/bin/activate && pip install --upgrade -e . --quiet && mkdir packages
python setup.py sdist && mv dist/* packages/
cd dash-renderer && npm install --ignore-scripts && npm run build:dev && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
cd dash-renderer && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
git clone --depth 1 https://github.com/plotly/dash-core-components.git
cd dash-core-components && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
git clone --depth 1 https://github.com/plotly/dash-renderer-test-components
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ node_modules/
.npm
npm-debug*

dash_renderer/bundle.js
dash_renderer/bundle.js.map
dash_renderer.dev*
dash_renderer.min*
dash_renderer/
digest.json
VERSION.txt
36 changes: 30 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,37 @@ Glad that you decided to make your contribution in Dash, to set up your developm
# in your working directory
$ git clone https://github.com/plotly/dash
$ cd dash
# create a virtualenv
$ python3 -m venv venv
# activate the virtualenv (on windows venv\scripts\activate)
$ . venv/bin/activate
# Install the dev dependencies
$ pip install -r .circleci/requirements/dev-requirements.txt
$ python3 -m venv .venv/dev
# activate the virtualenv (on windows .venv\dev\scripts\activate)
$ . .venv/dev/bin/activate
# install dash and dependencies
$ pip install -e .[testing,ci] # might need \ to espcae []
$ cd dash-renderer
# build renderer bundles, this will build all bundles from source code
# the only true source of npm version is defined in package.json
$ npm run build
# install dash-renderer for development
$ pip install -e .
# you should see both dash and dash-renderer are pointed to local source repos
$ pip list | grep dash
```

### Dash-Renderer Beginner Guide

`Dash Renderer` was a separate Dash project. It was merged into main `Dash` repository as part of 1.0 release. The frontend Dash, at its core, is driven by the renderer to handle React Components layout and backend event handling.

If you want to contribute or simply dig deeper into Dash. We encourage you to play and taste it. This is the most efficient way to learn and understand everything under the hood.

For contributors who have purely **Python** or **R** background. This section might help you understand more details about developing and debugging in Javascript world.

After Dash 1.2, The renderer bundle and its peer dependencies can be packed and generated from the source code. The only version of the truth is defined in `dash-renderer\package.json` file. A build tool `renderer`, which is a tiny Python script defined as a Dash entry point, has few commands like:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
After Dash 1.2, The renderer bundle and its peer dependencies can be packed and generated from the source code. The only version of the truth is defined in `dash-renderer\package.json` file. A build tool `renderer`, which is a tiny Python script defined as a Dash entry point, has few commands like:
As of Dash 1.2, The renderer bundle and its peer dependencies can be packed and generated from the source code. Dependency files are no longer included in this repository, they are downloaded when needed based on the versions listed in `dash-renderer/package.json`. A build tool `renderer`, which is a tiny Python script installed by Dash as a command-line tool, has a few commands:

1. `renderer npm` installs all the npm modules using this `package.json` files. Note that the `package-lock.json` file is the computed reference product for the versions defined with tilde(~) or caret(^) syntax in **npm**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
1. `renderer npm` installs all the npm modules using this `package.json` files. Note that the `package-lock.json` file is the computed reference product for the versions defined with tilde(~) or caret(^) syntax in **npm**
1. `renderer npm` installs all the npm modules using this `package.json` files. Note that the `package-lock.json` file is the computed reference product for the versions defined with tilde(~) or caret(^) syntax in **npm**. This is called by `npm run build`, or you can also call it directly if you add or update a dependency module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's slightly safer for people not family with js to call with renderer as it will handle the location with os.chdir().

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point - I just wanted to give people some idea when to use each of these commands. So perhaps:

Call this if you add or update a dependency module. npm run build calls this and renderer bundle, but you can only call it from the dash-renderer directory.

?

2. `renderer bundles` parses the locked version JSON, copies all the peer dependencies into dash_renderer folder, bundles the renderer assets, and generates an `__init__.py` to map all the resources
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
2. `renderer bundles` parses the locked version JSON, copies all the peer dependencies into dash_renderer folder, bundles the renderer assets, and generates an `__init__.py` to map all the resources
2. `renderer bundles` parses the locked version JSON, copies all the peer dependencies into dash_renderer folder, bundles the renderer assets, and generates an `__init__.py` to map all the resources. This is called by `npm run build`, or you can call it directly if the renderer code has changed.

3. `renderer digest {renderer version}` computes the content hash of each asset in `dash_renderer` folder, prints out the result in logs, and dumps into a JSON file `digest.json`
Copy link
Collaborator

Choose a reason for hiding this comment

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

What should we say about when to use this? Just that we use it internally to test that the build has not changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, something the assets bundle check
I extracted this out as a single job, so we can reuse it when we want to do some simple compare from the hash

4. `renderer watch` runs the webpack in watch mode, so any source code change triggers a rebuild

When a change in renderer code doesn't reflect in your browser as expected, this could be: confused bundle generation, caching issue in a browser, python package not in `editable` mode, etc. The new tool reduces the risk of bundle assets by adding the digest to help compare asset changes.

## Git

Use the [GitHub flow][] when proposing contributions to this repository (i.e. create a feature branch and submit a PR against the default branch).
Expand Down
22 changes: 22 additions & 0 deletions dash-renderer/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
{
"extends": ["eslint:recommended", "prettier"],
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"version": "detect" // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
},
"propWrapperFunctions": [
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
"forbidExtraProps",
{"property": "freeze", "object": "Object"},
{"property": "myFavoriteWrapper"}
],
"linkComponents": [
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
"Hyperlink",
{"name": "Link", "linkAttribute": "to"}
]
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
Expand Down
6 changes: 6 additions & 0 deletions dash-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

- Clean all the binary assets in dash-renderer repo, add tool to build all the required bundles from fresh source code to avoid confusion of the assets and improve the release process. [#874](https://github.com/plotly/dash/pull/874)

fixes [#868](https://github.com/plotly/dash/pull/868) and [#734](https://github.com/plotly/dash/pull/734)

## [1.0.0] - 2019-06-20
### Changed
- Undo/redo toolbar is removed by default, unless `config.show_undo_redo=true` is provided. The CSS hack `._dash-undo-redo:{display:none;}` is no longer needed [#175](https://github.com/plotly/dash-renderer/pull/175)
Expand Down
11 changes: 4 additions & 7 deletions dash-renderer/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
include dash_renderer/dash_renderer.dev.js
include dash_renderer/dash_renderer.dev.js.map
include dash_renderer/dash_renderer.min.js
include dash_renderer/dash_renderer.min.js.map
include dash_renderer/react-dom@*.min.js
include dash_renderer/react@*.min.js
include dash_renderer/prop-types@*.js
include package.json
include digest.json
include dash_renderer/*.js
include dash_renderer/*.map
97 changes: 0 additions & 97 deletions dash-renderer/dash_renderer/__init__.py

This file was deleted.

Binary file removed dash-renderer/dash_renderer/favicon.ico
Binary file not shown.
Loading