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

Remove build artifacts and update build process #1734

Merged
merged 17 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 4 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:
python -m venv venv && . venv/bin/activate
set -eo pipefail
pip install -e .[testing,dev] --progress-bar off && pip list | grep dash
cd dash/dash-renderer && renderer build && cd ../../
dash-update-components "all"
npm i
npm run build
python setup.py sdist
mkdir dash-package && cp dist/*.tar.gz dash-package/dash-package.tar.gz
ls -la dash-package
no_output_timeout: 20m
no_output_timeout: 30m
- persist_to_workspace:
root: ~/dash
paths:
Expand Down Expand Up @@ -86,10 +86,9 @@ jobs:
command: |
. venv/bin/activate
set -eo pipefail
cd dash/dash-renderer && renderer build && cd ../../
dash-update-components "all"
pip install -e . --progress-bar off && pip list | grep dash
npm install --production && npm run initialize
npm run build
npm run lint
- run:
name: 🐍 Python Unit Tests & ☕ JS Unit Tests
Expand Down
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ coverage.xml
.Python
build/
dash/deps/
dash/html/
dash/dcc/
dash/dash_table/
dash/html/*
!dash/html/.gitkeep
dash/dcc/*
!dash/dcc/.gitkeep
dash/dash_table/*
!dash/dash_table/.gitkeep
develop-eggs/
dist/
downloads/
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
### Changed
- [#1679](https://github.com/plotly/dash/pull/1679) Restructure `dash`, `dash-core-components`, `dash-html-components`, and `dash-table` into a singular monorepo and move component packages into `dash`. This change makes the component modules available for import within the `dash` namespace, and simplifies the import pattern for a Dash app. From a development standpoint, all future changes to component modules will be made within the `components` directory, and relevant packages updated with the `dash-update-components` CLI command.
- [#1707](https://github.com/plotly/dash/pull/1707) Change the default value of the `compress` argument to the `dash.Dash` constructor to `False`. This change reduces CPU usage, and was made in recognition of the fact that many deployment platforms (e.g. Dash Enterprise) already apply their own compression. If deploying to an environment that does not already provide compression, the Dash 1 behavior may be restored by adding `compress=True` to the `dash.Dash` constructor.
- [#1734](https://github.com/plotly/dash/pull/1734) Added `npm run build` script to simplify build process involving `dash-renderer` and subcomponent libraries within `dash`.


## Dash Core Components
### Added
Expand All @@ -24,6 +26,11 @@ This project adheres to [Semantic Versioning](https://semver.org/).

- [#1729](https://github.com/plotly/dash/pull/1729) Include F#, C#, and MATLAB in markdown code highlighting, for the upcoming .NET and MATLAB flavors of dash.

## Dash HTML Components
### Removed

- [#1734](https://github.com/plotly/dash/pull/1734) Removed the following obsolete `html` elements - `<command>`, `<element>`, `<isindex>`, `<listing>`, `<multicol>`, `<nextid>`. These are obsolete and had been previously removed from the reference table.

## [1.21.0] - 2021-07-09

## Dash and Dash Renderer
Expand Down
21 changes: 9 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ $ python3 -m venv .venv/dev
$ source .venv/dev/bin/activate
# install dash and dependencies
$ pip install -e .[testing,dev] # in some shells you need \ to escape []
$ 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 install
$ npm run build # or `renderer build`
# install dash-renderer for development
$ pip install -e .
# this script will build the dash-core-components, dash-html-components, dash-table,
# and renderer bundles; this will build all bundles from source code in their
# respective directories. The only true source of npm version is defined
# in package.json for each package.
$ npm run build # runs `renderer build` and `npm build` in dcc, html, table
# build and install components used in tests
$ cd .. # should be back in dash/ root directory
$ npm install
$ npm run setup-tests.py # or npm run setup-tests.R
# you should see both dash and dash-renderer are pointed to local source repos
# you should see dash points to a local source repo
$ pip list | grep dash
```

Expand All @@ -38,20 +35,20 @@ If you want to contribute or simply dig deeper into Dash, we encourage you to pl

For contributors with a primarily **Python** or **R** background, this section might help you understand more details about developing and debugging in JavaScript world.

As of Dash 1.2, the renderer bundle and its peer dependencies can be packed and generated from the source code. The `dash-renderer\package.json` file is the one version of the truth for dash renderer version and npm dependencies. A build tool `renderer`, which is a tiny Python script installed by Dash as a command-line tool, has a few commands:
As of Dash 1.2, the renderer bundle and its peer dependencies can be packed and generated from the source code. The `dash-renderer\package.json` file is the one version of the truth for dash renderer version and npm dependencies. A build tool `renderer`, which is a tiny Python script installed by Dash as a command-line tool, has a few commands which can be run from within the `dash/dash-renderer` directory:

1. `renderer clean` deletes all the previously generated assets by this same tool.
2. `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.
3. `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. There are also a list of helpful `scripts` property defined in `package.json` you might need to do some handy tasks like linting, syntax format with prettier, etc.
4. `renderer digest` 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`. Use this when you have a doubt about the current assets in `dash_renderer`, and compare it with previous result in one shot by this command.
5. `renderer build` runs 1, 2, 3, 4 in sequence as a complete build process from scratch.
6. `renderer build local` runs the same order as in 5 and also generates source maps for debugging purposes. You also need to install dash-renderer with editable mode: `pip install -e .`.
6. `renderer build local` runs the same order as in 5 and also generates source maps for debugging purposes.

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.

### Development of `dash-core-components`, `dash-html-components`, and `dash_table`

Specific details on making updates and contributions to `dcc`, `html`, and `dash_table` can be found within their respective sub-directories in the `components` directory. Once changes have been made in the specific directories, the `dash-update-components` command line tool can be used to update the build artifacts and dependencies of the respective packages within Dash. For example, if a change has been made to `dash-core-components`, use `dash-update-components "dash-core-components"` to move the build artifacts to Dash. By default, this is set to update `all` packages.
Specific details on making changes and contributing to `dcc`, `html`, and `dash_table` can be found within their respective sub-directories in the `components` directory. Once changes have been made in the specific directories, the `dash-update-components` command line tool can be used to update the build artifacts and dependencies of the respective packages within Dash. For example, if a change has been made to `dash-core-components`, use `dash-update-components "dash-core-components"` to move the build artifacts to Dash. By default, this is set to update `all` packages.

## Python 2 And 3 Compatibility

Expand Down
6 changes: 0 additions & 6 deletions components/dash-html-components/scripts/data/elements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ cite
code
col
colgroup
command
content
data
datalist
Expand All @@ -35,7 +34,6 @@ dialog
div
dl
dt
element
em
embed
fieldset
Expand All @@ -59,23 +57,19 @@ i
iframe
img
ins
isindex
kbd
keygen
label
legend
li
link
listing
main
map
mark
marquee
meta
meter
multicol
nav
nextid
nobr
noscript
object
Expand Down
11 changes: 1 addition & 10 deletions components/dash-html-components/scripts/extract-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const request = require('request');

const refUrl = 'https://developer.mozilla.org/en-US/docs/Web/HTML/Element';
const dataPath = './data/elements.txt';
const expectedElCount = 131;
const expectedElCount = 125;

/**
* From the MDN HTML elements reference, extract a list of elements.
Expand All @@ -25,13 +25,8 @@ function extractElements($) {
'portal'
];
// `<section>` is for some reason missing from the reference tables.
// `<command>`, `<element>`, `<isindex>`, `<listing>`, `<multicol>`, `<nextid>`
// are obsolete and have been removed from the reference table, but we had
// them in the past so we should wait for a major to remove
const addElements = [
'base',
'command',
'element',
'section',
'h1',
'h2',
Expand All @@ -40,10 +35,6 @@ function extractElements($) {
'h5',
'h6',
'iframe',
'isindex',
'listing',
'multicol',
'nextid'
];

return $('td:first-child')
Expand Down
2 changes: 2 additions & 0 deletions components/dash-table/dash_table_base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

from ._imports_ import * # noqa: E402, F401, F403
from ._imports_ import __all__ # noqa: E402
from . import Format # noqa: F401, E402
from . import FormatTemplate # noqa: F401, E402

_basepath = _os.path.dirname(__file__)
_filepath = _os.path.abspath(_os.path.join(_basepath, "package-info.json"))
Expand Down
Empty file added dash/dash_table/.gitkeep
Empty file.
Loading