Skip to content

Commit c69402f

Browse files
author
Marc-André Rivet
committed
Merge remote-tracking branch 'origin/dev'
2 parents 404791b + 447a1d5 commit c69402f

File tree

147 files changed

+9809
-4870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+9809
-4870
lines changed

.circleci/config.yml

+124-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
artifacts:
1212
docker:
13-
- image: circleci/python:3.7-stretch-node-browsers
13+
- image: circleci/python:3.7.6-stretch-node-browsers
1414
environment:
1515
PYVERSION: python37
1616
steps:
@@ -27,8 +27,9 @@ jobs:
2727
lint-unit-37: &lint-unit
2828
working_directory: ~/dash
2929
docker:
30-
- image: circleci/python:3.7-stretch-node-browsers
30+
- image: circleci/python:3.7.6-stretch-node-browsers
3131
environment:
32+
PYLINTRC: .pylintrc37
3233
PYVERSION: python37
3334

3435
steps:
@@ -58,30 +59,29 @@ jobs:
5859
name: 🐍 Python Unit Tests & ☕ JS Unit Tests
5960
command: |
6061
. venv/bin/activate
61-
npm run test.unit
62+
npm run citest.unit
6263
6364
lint-unit-36:
6465
<<: *lint-unit
6566
docker:
66-
- image: circleci/python:3.6-stretch-node-browsers
67+
- image: circleci/python:3.6.9-stretch-node-browsers
6768
environment:
6869
PYLINTRC: .pylintrc
6970
PYVERSION: python36
7071

7172
lint-unit-27:
7273
<<: *lint-unit
7374
docker:
74-
- image: circleci/python:2.7-stretch-node-browsers
75+
- image: circleci/python:2.7.18-stretch-node-browsers
7576
environment:
7677
PYLINTRC: .pylintrc
7778
PYVERSION: python27
7879

7980
build-core-37: &build-core
8081
working_directory: ~/dash
8182
docker:
82-
- image: circleci/python:3.7-stretch-node-browsers
83+
- image: circleci/python:3.7.6-stretch-node-browsers
8384
environment:
84-
PYLINTRC: .pylintrc37
8585
PYVERSION: python37
8686
steps:
8787
- checkout
@@ -115,21 +115,21 @@ jobs:
115115
build-core-36:
116116
<<: *build-core
117117
docker:
118-
- image: circleci/python:3.6-stretch-node-browsers
118+
- image: circleci/python:3.6.9-stretch-node-browsers
119119
environment:
120120
PYVERSION: python36
121121

122122
build-core-27:
123123
<<: *build-core
124124
docker:
125-
- image: circleci/python:2.7-stretch-node-browsers
125+
- image: circleci/python:2.7.18-stretch-node-browsers
126126
environment:
127127
PYVERSION: python27
128128

129129
build-misc-37: &build-misc
130130
working_directory: ~/dash
131131
docker:
132-
- image: circleci/python:3.7-stretch-node-browsers
132+
- image: circleci/python:3.7.6-stretch-node-browsers
133133
environment:
134134
PYVERSION: python37
135135

@@ -165,14 +165,14 @@ jobs:
165165
build-misc-36:
166166
<<: *build-misc
167167
docker:
168-
- image: circleci/python:3.6-stretch-node-browsers
168+
- image: circleci/python:3.6.9-stretch-node-browsers
169169
environment:
170170
PYVERSION: python36
171171

172172
build-misc-27:
173173
<<: *build-misc
174174
docker:
175-
- image: circleci/python:2.7-stretch-node-browsers
175+
- image: circleci/python:2.7.18-stretch-node-browsers
176176
environment:
177177
PYVERSION: python27
178178

@@ -213,10 +213,116 @@ jobs:
213213
paths:
214214
- packages/*.tar.gz
215215

216+
build-dashr:
217+
working_directory: ~/dashr
218+
docker:
219+
- image: plotly/dashr:ci
220+
environment:
221+
PERCY_PARALLEL_TOTAL: -1
222+
PYVERSION: python37
223+
_R_CHECK_FORCE_SUGGESTS_: FALSE
224+
225+
steps:
226+
- checkout
227+
228+
- run:
229+
name: ️️🏭 clone and npm build core for R
230+
command: |
231+
python -m venv venv
232+
. venv/bin/activate
233+
npm ci
234+
pip install --no-cache-dir --upgrade -e .[dev,testing] --progress-bar off
235+
git clone --depth 1 https://github.com/plotly/dashR.git -b dev dashR
236+
git clone --depth 1 https://github.com/plotly/dash-html-components.git
237+
git clone --depth 1 https://github.com/plotly/dash-core-components.git
238+
git clone --depth 1 https://github.com/plotly/dash-table.git
239+
shopt -s extglob
240+
cd dash-html-components; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build)
241+
cd ../dash-core-components; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build)
242+
cd ../dash-table; npm ci && npm run build; rm -rf !(.|..|DESCRIPTION|LICENSE.txt|LICENSE|NAMESPACE|.Rbuildignore|R|man|inst|vignettes|build); cd ..
243+
244+
- run:
245+
name: 🔧fix up dash metadata
246+
command: |
247+
sudo Rscript -e 'dash_desc <- read.dcf("dashR/DESCRIPTION"); dt_version <- read.dcf("dash-table/DESCRIPTION")[,"Version"]; dcc_version <- read.dcf("dash-core-components/DESCRIPTION")[,"Version"]; dhc_version <- read.dcf("dash-html-components/DESCRIPTION")[,"Version"]; imports <- dash_desc[,"Imports"][[1]]; imports <- gsub("((?<=dashHtmlComponents )(\\\\(.*?\\\\)))", paste0("(= ", dhc_version, ")"), imports, perl = TRUE); imports <- gsub("((?<=dashCoreComponents )(\\\\(.*?\\\\)))", paste0("(= ", dcc_version, ")"), imports, perl = TRUE); imports <- gsub("((?<=dashTable )(\\\\(.*?\\\\)))", paste0("(= ", dt_version, ")"), imports, perl = TRUE); dash_desc[,"Imports"][[1]] <- imports; dhc_hash <- system("cd dash-html-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE); dcc_hash <- system("cd dash-core-components; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE); dt_hash <- system("cd dash-table; git rev-parse HEAD | tr -d '\''\n'\''", intern=TRUE); remotes <- dash_desc[,"Remotes"][[1]]; remotes <- gsub("((?<=plotly\\\\/dash-html-components@)([a-zA-Z0-9]+))", dhc_hash, remotes, perl=TRUE); remotes <- gsub("((?<=plotly\\\\/dash-core-components@)([a-zA-Z0-9]+))", dcc_hash, remotes, perl=TRUE); remotes <- gsub("((?<=plotly\\\\/dash-table@)([a-zA-Z0-9]+))", dt_hash, remotes, perl=TRUE); dash_desc[,"Remotes"][[1]] <- remotes; write.dcf(dash_desc, "dashR/DESCRIPTION")'
248+
249+
- run:
250+
name: 🎛 set environment variables
251+
command: |
252+
Rscript --vanilla \
253+
-e 'dash_dsc <- read.dcf("dashR/DESCRIPTION")' \
254+
-e 'cat(sprintf("export DASH_TARBALL=%s_%s.tar.gz\n", dash_dsc[,"Package"], dash_dsc[,"Version"]))' \
255+
-e 'cat(sprintf("export DASH_CHECK_DIR=%s.Rcheck\n", dash_dsc[,"Package"]))' \
256+
-e 'dhc_dsc <- read.dcf("dash-html-components/DESCRIPTION")' \
257+
-e 'cat(sprintf("export DHC_TARBALL=%s_%s.tar.gz\n", dhc_dsc[,"Package"], dhc_dsc[,"Version"]))' \
258+
-e 'cat(sprintf("export DHC_CHECK_DIR=%s.Rcheck\n", dhc_dsc[,"Package"]))' \
259+
-e 'dcc_dsc <- read.dcf("dash-core-components/DESCRIPTION")' \
260+
-e 'cat(sprintf("export DCC_TARBALL=%s_%s.tar.gz\n", dcc_dsc[,"Package"], dcc_dsc[,"Version"]))' \
261+
-e 'cat(sprintf("export DCC_CHECK_DIR=%s.Rcheck\n", dcc_dsc[,"Package"]))' \
262+
-e 'dt_dsc <- read.dcf("dash-table/DESCRIPTION")' \
263+
-e 'cat(sprintf("export DT_TARBALL=%s_%s.tar.gz\n", dt_dsc[,"Package"], dt_dsc[,"Version"]))' \
264+
-e 'cat(sprintf("export DT_CHECK_DIR=%s.Rcheck\n", dt_dsc[,"Package"]))' \
265+
>> ${BASH_ENV}
266+
267+
- run:
268+
name: ️️📋 run CRAN package checks
269+
command: |
270+
R CMD build dash-core-components
271+
R CMD build dash-html-components
272+
R CMD build dash-table
273+
R CMD build dashR
274+
sudo R CMD INSTALL dash-core-components
275+
sudo R CMD INSTALL dash-html-components
276+
sudo R CMD INSTALL dash-table
277+
sudo R CMD INSTALL dashR
278+
R CMD check "${DHC_TARBALL}" --as-cran --no-manual
279+
R CMD check "${DCC_TARBALL}" --as-cran --no-manual
280+
R CMD check "${DT_TARBALL}" --as-cran --no-manual
281+
R CMD check "${DASH_TARBALL}" --as-cran --no-manual
282+
283+
- run:
284+
name: 🕵 detect failures
285+
command: |
286+
Rscript -e "message(devtools::check_failures(path = '${DHC_CHECK_DIR}'))"
287+
Rscript -e "message(devtools::check_failures(path = '${DCC_CHECK_DIR}'))"
288+
Rscript -e "message(devtools::check_failures(path = '${DT_CHECK_DIR}'))"
289+
Rscript -e "message(devtools::check_failures(path = '${DASH_CHECK_DIR}'))"
290+
# warnings are errors; enable for stricter checks once CRAN submission finished
291+
# if grep -q -R "WARNING" "${DHC_CHECK_DIR}/00check.log"; then exit 1; fi
292+
# if grep -q -R "WARNING" "${DCC_CHECK_DIR}/00check.log"; then exit 1; fi
293+
# if grep -q -R "WARNING" "${DT_CHECK_DIR}/00check.log"; then exit 1; fi
294+
# if grep -q -R "WARNING" "${DASH_CHECK_DIR}/00check.log"; then exit 1; fi
295+
296+
- run:
297+
name: 🔎 run unit tests
298+
command: |
299+
sudo Rscript -e 'res=devtools::test("dashR/tests/", reporter=default_reporter());df=as.data.frame(res);if(sum(df$failed) > 0 || any(df$error)) {q(status=1)}'
300+
301+
- run:
302+
name: ⚙️ Integration tests
303+
command: |
304+
python -m venv venv
305+
. venv/bin/activate
306+
npm run setup-tests.R
307+
export PATH=$PATH:/home/circleci/.local/bin/
308+
pytest --nopercyfinalize --junitxml=test-reports/dashr.xml dashR/tests/integration/dopsa/
309+
- store_artifacts:
310+
path: test-reports
311+
- store_test_results:
312+
path: test-reports
313+
- store_artifacts:
314+
path: /tmp/dash_artifacts
315+
316+
- run:
317+
name: 🦔 percy finalize
318+
command: npx percy finalize --all
319+
when: on_fail
320+
321+
216322
test-37: &test
217323
working_directory: ~/dash
218324
docker:
219-
- image: circleci/python:3.7-stretch-node-browsers
325+
- image: circleci/python:3.7.6-stretch-node-browsers
220326
environment:
221327
PERCY_PARALLEL_TOTAL: -1
222328
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: True
@@ -243,7 +349,7 @@ jobs:
243349
name: 🧪 Run Integration Tests
244350
command: |
245351
. venv/bin/activate
246-
npm run test.integration
352+
npm run citest.integration
247353
- store_artifacts:
248354
path: test-reports
249355
- store_test_results:
@@ -258,15 +364,15 @@ jobs:
258364
test-36:
259365
<<: *test
260366
docker:
261-
- image: circleci/python:3.6-stretch-node-browsers
367+
- image: circleci/python:3.6.9-stretch-node-browsers
262368
environment:
263369
PERCY_ENABLE: 0
264370
PYVERSION: python36
265371

266372
test-27:
267373
<<: *test
268374
docker:
269-
- image: circleci/python:2.7-stretch-node-browsers
375+
- image: circleci/python:2.7.18-stretch-node-browsers
270376
environment:
271377
PERCY_ENABLE: 0
272378
PYVERSION: python27
@@ -279,12 +385,14 @@ workflows:
279385
- build-core-37
280386
- build-windows-37
281387
- build-misc-37
388+
- build-dashr
282389
- test-37:
283390
requires:
284391
- build-core-37
285392
- build-misc-37
286393
- percy-finalize:
287394
requires:
395+
- build-dashr
288396
- test-37
289397
- artifacts:
290398
requires:

.pylintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ ignore-docstrings=yes
270270
ignore-imports=no
271271

272272
# Minimum lines number of a similarity.
273-
min-similarity-lines=10
273+
min-similarity-lines=20
274274

275275

276276
[SPELLING]
@@ -466,4 +466,4 @@ known-third-party=enchant
466466

467467
# Exceptions that will emit a warning when being caught. Defaults to
468468
# "Exception"
469-
overgeneral-exceptions=Exception
469+
overgeneral-exceptions=Exception

.pylintrc37

+2-3
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,7 @@ ignore-docstrings=yes
365365
ignore-imports=no
366366

367367
# Minimum lines number of a similarity.
368-
min-similarity-lines=10
369-
368+
min-similarity-lines=20
370369

371370
[SPELLING]
372371

@@ -565,4 +564,4 @@ known-third-party=enchant
565564

566565
# Exceptions that will emit a warning when being caught. Defaults to
567566
# "Exception".
568-
overgeneral-exceptions=Exception
567+
overgeneral-exceptions=Exception

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [1.13.0] - 2020-06-17
6+
### Added
7+
- [#1289](https://github.com/plotly/dash/pull/1289) Supports `DASH_PROXY` env var to tell `app.run_server` to report the correct URL to view your app, when it's being proxied. Throws an error if the proxy is incompatible with the host and port you've given the server.
8+
- [#1240](https://github.com/plotly/dash/pull/1240) Adds `callback_context` to clientside callbacks (e.g. `dash_clientside.callback_context.triggered`). Supports `triggered`, `inputs`, `inputs_list`, `states`, and `states_list`, all of which closely resemble their serverside cousins.
9+
10+
### Changed
11+
- [#1237](https://github.com/plotly/dash/pull/1237) Closes [#920](https://github.com/plotly/dash/issues/920): Converts hot reload fetch failures into a server status indicator showing whether the latest fetch succeeded or failed. Callback fetch failures still appear as errors but have a clearer message.
12+
- [#1254](https://github.com/plotly/dash/pull/1254) Modifies the callback chain implementation and improves performance for apps with a lot of components
13+
14+
### Fixed
15+
- [#1255](https://github.com/plotly/dash/pull/1255) Hard hot reload targets only the current window, not the top - so if your app is in an iframe you will only reload the app
16+
- [#1249](https://github.com/plotly/dash/pull/1249) Fixes [#919](https://github.com/plotly/dash/issues/919) so `dash.testing` is compatible with more `pytest` plugins, particularly `pytest-flake8` and `pytest-black`.
17+
- [#1248](https://github.com/plotly/dash/pull/1248) Fixes [#1245](https://github.com/plotly/dash/issues/1245), so you can use prop persistence with components that have dict IDs, ie for pattern-matching callbacks.
18+
- [#1185](https://github.com/plotly/dash/pull/1185) Sort asset directories, same as we sort files inside those directories. This way if you need your assets loaded in a certain order, you can add prefixes to subdirectory names and enforce that order.
19+
- [#1288](https://github.com/plotly/dash/pull/1288) Closes [#1285](https://github.com/plotly/dash/issues/1285): Debug=True should work in the __main__ module.
20+
521
## [1.12.0] - 2020-05-05
622
### Added
723
- [#1228](https://github.com/plotly/dash/pull/1228) Adds control over firing callbacks on page (or layout chunk) load. Individual callbacks can have their initial calls disabled in their definition `@app.callback(..., prevent_initial_call=True)` and similar for `app.clientside_callback`. The app-wide default can also be changed with `app=Dash(prevent_initial_callbacks=True)`, then individual callbacks may disable this behavior.

CONTRIBUTING.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ $ pip install -e .[testing,dev] # in some shells you need \ to escape []
1616
$ cd dash-renderer
1717
# build renderer bundles, this will build all bundles from source code
1818
# the only true source of npm version is defined in package.json
19+
$ npm install
1920
$ npm run build # or `renderer build`
2021
# install dash-renderer for development
2122
$ pip install -e .
2223
# build and install components used in tests
24+
$ cd .. # should be back in dash/ root directory
25+
$ npm install
2326
$ npm run setup-tests
2427
# you should see both dash and dash-renderer are pointed to local source repos
2528
$ pip list | grep dash
@@ -48,9 +51,7 @@ When a change in renderer code doesn't reflect in your browser as expected, this
4851

4952
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.
5053

51-
From the #892, we started to adopt `python-future` instead of `six` as our tool to better achieve the goal where we can mainly write Python 3 code and make it back-compatible in Python 2.7 (last Python 2 version Dash supports before it gets deprecated).
52-
53-
Please refer to [this list of idioms](https://python-future.org/compatible_idioms.html "https://python-future.org/compatible_idioms.html") for more details on working with `python-future`.
54+
We use `python-future` as our tool to mainly write Python 3 code and make it back-compatible to Python 2.7 (the only Python 2 version Dash supports). Please refer to [this list of idioms](https://python-future.org/compatible_idioms.html "https://python-future.org/compatible_idioms.html") for more details on working with `python-future`.
5455

5556
## Git
5657

@@ -98,13 +99,15 @@ Emojis make the commit messages :cherry_blossom:. If you have no idea about what
9899

99100
### Coding Style
100101

101-
We use both `flake8` and `pylint` for basic linting check, please refer to the relevant steps in `.circleci/config.yml`.
102-
103-
Note that we also start using [`black`](https://black.readthedocs.io/en/stable/) as formatter during the test code migration.
102+
We use `flake8`, `pylint`, and [`black`](https://black.readthedocs.io/en/stable/) for linting. please refer to the relevant steps in `.circleci/config.yml`.
104103

105104
## Tests
106105

107-
We started migrating to [pytest](https://docs.pytest.org/en/latest/) from `unittest` as our test automation framework. You will see more testing enhancements in the near future.
106+
Our tests use Google Chrome via Selenium. You will need to install [ChromeDriver](http://chromedriver.chromium.org/getting-started) matching the version of Chrome installed on your system. Here are some helpful tips for [Mac](https://www.kenst.com/2015/03/installing-chromedriver-on-mac-osx/) and [Windows](http://jonathansoma.com/lede/foundations-2018/classes/selenium/selenium-windows-install/).
107+
108+
We use [pytest](https://docs.pytest.org/en/latest/) as our test automation framework, plus [jest](https://jestjs.io/) for a few renderer unit tests. You can `npm run test` to run them all, but this command simply runs `pytest` with no arguments, then `cd dash-renderer && npm run test` for the renderer unit tests.
109+
110+
Most of the time, however, you will want to just run a few relevant tests and let CI run the whole suite. `pytest` lets you specify a directory or file to run tests from (eg `pytest tests/unit`) or a part of the test case name using `-k` - for example `pytest -k cbcx004` will run a single test, or `pytest -k cbcx` will run that whole file. See the [testing tutorial](https://dash.plotly.com/testing) to learn about the test case ID convention we use.
108111

109112
### Unit Tests
110113

dash-renderer/@Types/modules.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
declare module 'cookie' {
2+
const value: {
3+
parse: (cookie: string) => {
4+
_csrf_token: string
5+
}
6+
};
7+
8+
export default value;
9+
}

dash-renderer/babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
module.exports = {
22
presets: [
3+
'@babel/preset-typescript',
34
'@babel/preset-env',
45
'@babel/preset-react'
56
],
7+
plugins: [
8+
'@babel/plugin-proposal-class-properties',
9+
],
610
env: {
711
test: {
812
plugins: [
13+
'@babel/plugin-proposal-class-properties',
914
'@babel/plugin-transform-modules-commonjs'
1015
]
1116
}

0 commit comments

Comments
 (0)