Skip to content

Commit

Permalink
Merge pull request #1679 from plotly/dash-monorepo
Browse files Browse the repository at this point in the history
Dash monorepo
  • Loading branch information
chriddyp authored Aug 20, 2021
2 parents 86c140a + 4b53e3e commit 5c2f05e
Show file tree
Hide file tree
Showing 766 changed files with 350,013 additions and 1,201 deletions.
548 changes: 482 additions & 66 deletions .circleci/config.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
ignore = C901, E203, E266, E501, E731, W503
select = B,C,E,F,W,T4
per-file-ignores =
tests/*: E722, F811
tests/*: E722, F811
dash/html/I.py: E742
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ coverage.xml
.Python
build/
dash/deps/
dash/html/
dash/dcc/
dash/dash_table/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -80,3 +83,8 @@ VERSION.txt

# vim
*.swp

# Exceptions
!components/dash-core-components/tests/integration/upload/upload-assets/upft001.csv
!components/dash-table/tests/assets/*.csv
!components/dash-table/tests/selenium/assets/*.csv
6 changes: 6 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ ignore=CVS
# regex matches against base names, not paths.
ignore-patterns=

# Add files or directories matching the regex patterns to the ignore-list.
# The regex matches against paths.
ignore-paths=^dash/dcc/.*$,
^dash/html/.*$,
^dash/dash_table/.*$

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
Expand Down
6 changes: 6 additions & 0 deletions .pylintrc39
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ ignore=CVS
# regex matches against base names, not paths.
ignore-patterns=

# Add files or directories matching the regex patterns to the ignore-list.
# The regex matches against paths.
ignore-paths=^dash/dcc/.*$,
^dash/html/.*$,
^dash/dash_table/.*$

# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- [#1514](https://github.com/plotly/dash/pull/1514) Perform json encoding using the active plotly JSON engine. This will default to the faster orjson encoder if the `orjson` package is installed.

### Changed
- [#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.
- [#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.

## [1.21.0] - 2021-07-09

Expand Down
6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ As of Dash 1.2, the renderer bundle and its peer dependencies can be packed and

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.

## Python 2 And 3 Compatibility

Writing Python 2/3 compatible code might be a challenging task for contributors used to working on one particular version, especially new learners who start directly with Python 3.
Expand Down Expand Up @@ -77,7 +81,7 @@ Git command veterans might argue that a simple terminal and a cherry switch keyb

### Emoji

Plotlyers love to use emoji as an effective communication medium for
Plotlyers love to use emoji as an effective communication medium for:

**Commit Messages**

Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ include dash/favicon.ico
include dash/extract-meta.js
include dash/deps/*.js
include dash/deps/*.map
include dash/dcc/*
include dash/html/*
include dash/dash_table/*
include dash/dash-renderer/build/*.js
include dash/dash-renderer/build/*.map
188 changes: 188 additions & 0 deletions components/dash-core-components/.circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
version: 2.1

orbs:
win: circleci/windows@2.4.0

jobs:
dcc-percy-finalize:
working_directory: ~/dash/components/dash-core-components
docker:
- image: percyio/agent
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
steps:
- checkout:
path: ~/dash
- run: percy finalize --all

dcc-lint-unit-39: &lint-unit
working_directory: ~/dash/components/dash-core-components
docker:
- image: circleci/python:3.9.2-buster-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
environment:
PYTHON_VERSION: py39
steps:
- checkout:
path: ~/dash
- run: echo $PYTHON_VERSION > ver.txt
- restore_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
- run:
name: 🐍 pip dev requirements
command: |
sudo pip install virtualenv --upgrade
python -m venv venv || virtualenv venv && . venv/bin/activate
pip install --progress-bar off -e git+https://github.com/plotly/dash.git@dev#egg=dash[dev,testing]
pip install --progress-bar off --no-cache-dir -r dev-requirements.txt
- save_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
paths:
- venv
- run:
name: 🌸 Lint
command: |
. venv/bin/activate
set -eo pipefail
npm ci
npm run lint
dcc-lint-unit-36:
<<: *lint-unit
docker:
- image: circleci/python:3.6.13-stretch-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
environment:
PYTHON_VERSION: py36

dcc-build-dash-39: &build-dash
working_directory: ~/dash/components/dash-core-components
docker:
- image: circleci/python:3.9.2-buster-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
environment:
PYTHON_VERSION: py39
steps:
- checkout:
path: ~/dash
- run: echo $PYTHON_VERSION > ver.txt
- restore_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
- run:
name: 🐍 pip dev requirements
command: |
sudo pip install virtualenv --upgrade
python -m venv venv || virtualenv venv && . venv/bin/activate
set -eo pipefail
pip install --progress-bar off --no-cache-dir -r dev-requirements.txt
- save_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
paths:
- venv
- run:
name: 🏗️ build dash
command: |
. venv/bin/activate && mkdir packages
set -eo pipefail
# build main dash & renderer
git clone --depth 1 -b dash-monorepo git@github.com:plotly/dash.git dash-main
cd dash-main && pip install -e .[dev] --progress-bar off && renderer build
python setup.py sdist && mv dist/* ../packages/ && cd ..
# build html
git clone --depth 1 https://github.com/plotly/dash-html-components.git
git clone --depth 1 git@github.com:plotly/dash-table.git
cd dash-html-components && npm ci && npm run build && python setup.py sdist && mv dist/* ../packages && cd ..
cd dash-table && npm ci && npm run build && python setup.py sdist && mv dist/* ../packages && cd ..
# build dcc
npm ci && npm run build && python setup.py sdist && mv dist/* ./packages && ls -la packages
- persist_to_workspace:
root: ~/dash/components/dash-core-components
paths:
- packages

dcc-build-dash-36:
<<: *build-dash
docker:
- image: circleci/python:3.6.13-stretch-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
environment:
PYTHON_VERSION: py36

dcc-test-39: &test
working_directory: ~/dash/components/dash-core-components
docker:
- image: circleci/python:3.9.2-buster-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
environment:
PYTHON_VERSION: py39
PERCY_PARALLEL_TOTAL: -1
PERCY_ENABLE: 1
parallelism: 3
steps:
- checkout:
path: ~/dash
- run: echo $PYTHON_VERSION > ver.txt
- restore_cache:
key: dep-{{ checksum ".circleci/config.yml" }}-{{ checksum "ver.txt" }}-{{ checksum "dev-requirements.txt" }}
- attach_workspace:
at: ~/dash/components/dash-core-components
- run:
name: 🧪 Run Integration Tests
command: |
. venv/bin/activate && rm -rf dash_core_components && ls -la
set -eo pipefail
cd packages && mv dash-*.tar.gz main.tar.gz && ls -la
find . -name "dash_*.gz" | xargs pip install -I --progress-bar off --no-cache-dir
pip install --no-cache-dir --progress-bar off main.tar.gz[dev,testing]
pip list | grep dash | xargs pip show && cd ..
echo $(python -V 2>&1) | grep 3.
TESTFILES=$(circleci tests glob "tests/integration/**/test_*.py" | circleci tests split --split-by=timings)
pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml ${TESTFILES}
- store_artifacts:
path: ~/dash/components/dash-core-components/test-reports
- store_test_results:
path: ~/dash/components/dash-core-components/test-reports
- store_artifacts:
path: /tmp/dash_artifacts

dcc-test-36:
<<: *test
docker:
- image: circleci/python:3.6.13-stretch-node-browsers
auth:
username: dashautomation
password: $DASH_PAT_DOCKERHUB
environment:
PYTHON_VERSION: py36
PERCY_ENABLE: 0

workflows:
dcc-python3.9:
jobs:
- dcc-lint-unit-39
- dcc-build-dash-39
- dcc-test-39:
requires:
- dcc-build-dash-39
- dcc-percy-finalize:
requires:
- dcc-test-39

dcc-python3.6:
jobs:
- dcc-lint-unit-36
- dcc-build-dash-36
- dcc-test-36:
requires:
- dcc-build-dash-36
18 changes: 18 additions & 0 deletions components/dash-core-components/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# EditorConfig is awesome: https://EditorConfig.org

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,py}]
charset = utf-8
indent_style = space
indent_size = 4

# Matches the exact files either package.json or .travis.yml
[{package.json,.circleci/config.yml}]
indent_style = space
indent_size = 2
16 changes: 16 additions & 0 deletions components/dash-core-components/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
build/
dist/
lib/
lib/bundle.js*
coverage/
node_modules/
.npm
vv/
venv/
*.pyc
*.egg-info
*.log
.idea/
.DS_Store
dash_core_components/
config/
Loading

0 comments on commit 5c2f05e

Please sign in to comment.