Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit c0dd6b0

Browse files
Circleci update (#617)
🔧 adapt to new renderer change Co-Authored-By: Marc-André Rivet <[email protected]>
1 parent 9c7b25b commit c0dd6b0

File tree

11 files changed

+69
-92
lines changed

11 files changed

+69
-92
lines changed

.circleci/config.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
name: 🌸 Lint
3232
command: |
3333
. venv/bin/activate
34-
npm i --ignore-scripts && npm i --ignore-scripts --only=dev
34+
npm i --ignore-scripts
3535
npm run format:test && npm run lint
3636
flake8 --ignore=E501,F401,F841,F811,W503 tests
3737
- run:
@@ -80,8 +80,8 @@ jobs:
8080
. venv/bin/activate && pip install --upgrade -e . --quiet && mkdir packages
8181
# build main dash
8282
git clone --depth 1 https://github.com/plotly/dash.git dash-main
83-
cd dash-main && pip install -e .[ci,testing] && python setup.py sdist && mv dist/* ../packages/
84-
cd dash-renderer && npm i --ignore-scripts && npm run build
83+
cd dash-main && pip install -e .[dev,testing] && python setup.py sdist && mv dist/* ../packages/
84+
cd dash-renderer && npm run build
8585
python setup.py sdist && mv dist/* ../../packages/ && cd ../..
8686
# build dcc
8787
npm i --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ./packages
@@ -175,6 +175,7 @@ jobs:
175175
. venv/bin/activate && cd packages && ls -la && mv dash-*.tar.gz main.tar.gz
176176
pip install main.tar.gz[testing] --quiet && pip list | grep dash | xargs pip uninstall -y
177177
find . -name "dash*.gz" | xargs pip install && pip install main.tar.gz && pip list | grep dash && cd ..
178+
npm run test:pyimport
178179
TESTFILES=$(circleci tests glob "tests/test_integration_*.py" | circleci tests split --split-by=timings)
179180
pytest --durations=10 --junitxml=test-reports/junit_legacy.xml ${TESTFILES}
180181
- store_artifacts:

.editorconfig

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
root = true
1+
# EditorConfig is awesome: https://EditorConfig.org
22

3+
# Unix-style newlines with a newline ending every file
34
[*]
5+
end_of_line = lf
46
insert_final_newline = true
7+
8+
# Matches multiple files with brace expansion notation
9+
# Set default charset
10+
[*.{js,py}]
11+
charset = utf-8
12+
indent_style = space
13+
indent_size = 4
14+
15+
# Matches the exact files either package.json or .travis.yml
16+
[{package.json,.circleci/config.yml}]
17+
indent_style = space
18+
indent_size = 2

CONTRIBUTING.md

-25
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,6 @@ you've pulled from upstream otherwise you may be running with an out of date
2424
`bundle.js`. See the instructions for building `bundle.js` in the [Testing
2525
Locally](README.md#testing-locally) section of README.md.
2626

27-
You also need to set the environment variable `TOX_PYTHON_27` and with the
28-
location of the Python 2 installations you want tox to use for creating the
29-
virtualenv that will be used to run the tests. Note that this means you do not
30-
need to install any dependencies into the installation yourself.
31-
32-
If you're using pyenv to manage Python installations, you would do something
33-
like this:
34-
35-
```
36-
export TOX_PYTHON_27=~/.pyenv/versions/2.7.14/bin/python
37-
```
38-
39-
## Local configuration
40-
You can configure the test server with the following variables:
41-
### DASH_TEST_CHROMEPATH
42-
If you run a special chrome set the path to your chrome binary with this environment variable.
43-
44-
### DASH_TEST_PROCESSES
45-
If you encounter errors about Multi-server + Multi-processing when running under Python 3 try running the tests with the number of server processes set to 1.
46-
47-
### Example: single test run with configuration
48-
```
49-
DASH_TEST_CHROMEPATH=/bin/google-chrome-beta DASH_TEST_PROCESSES=1 python -m unittest -v test.test_integration.Tests.test_inputs
50-
```
51-
5227
## Publishing New Components/Features
5328

5429
For now, multiple steps are necessary for publishing to NPM and PyPi,

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 MIT
3+
Copyright (c) 2019 MIT
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+15-34
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,27 @@ This package provides the core React component suite for [Dash][].
66

77
## Development
88

9-
### Testing Locally
9+
The `dash` package contains some tools to build components and drive the bundles build process.
10+
To avoid the circular dependency situation, we don't add `dash` as a required install in the `dash-core-components` setup.
11+
But, in order to do development locally, you need to install `dash` before everything.
1012

1113
1. Install the dependencies with:
1214

13-
```
14-
$ npm i
15-
```
16-
17-
2. Build the code:
18-
19-
```
20-
$ npm run build
21-
```
22-
23-
3. Install the library
24-
25-
```
26-
$ python setup.py install
27-
```
15+
```bash
16+
# it's recommended to install your python packages in a virtualenv
17+
# python 2
18+
$ pip install virtualenv --user && virtualenv venv && . venv/bin/activate
19+
# python 3
20+
$ python -m venv && . venv/bin/activate
2821

29-
I recommend installing the library and running the examples in a fresh virtualenv in a separate folder:
30-
31-
```
32-
$ mkdir dash_examples # create a new folder to test examples
33-
$ cd dash_examples
34-
$ virtualenv venv # create a virtual env
35-
$ source venv/bin/activate # use the virtual env
36-
```
22+
# make sure dash is installed with dev and testing dependencies
23+
$ pip install dash[dev,testing] # in some shells you need \ to escape []
3724

38-
(and then repeat step 3).
25+
# run the build process
26+
$ npm i --ignore-scripts && npm run build
3927

40-
4. Add the following line to your Dash app
41-
```
42-
app.scripts.config.serve_locally = True
28+
# install dcc in editable mode
29+
$ pip install -e .
4330
```
4431

4532
### Demo server
@@ -74,12 +61,6 @@ npm run test-unit
7461
# Import dash_core_components to your layout, then run it:
7562
$ python my_dash_layout.py
7663

77-
## Installing python package locally
78-
79-
You can run
80-
$ python setup.py install
81-
to install the package locally, so you can test it out in your current environment.
82-
8364
## Uninstalling python package locally
8465

8566
```sh

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"start": "webpack-serve ./webpack.serve.config.js --open",
1818
"lint": "eslint src tests",
1919
"lint:py": "flake8 --ignore=E501,F401,F841,F811,W503 tests",
20-
"test": "run-s -c lint lint:py format:test test-unit test:py test:intg",
21-
"test:py": "pytest tests/test_integration.py",
20+
"test": "run-s -c lint lint:py format:test test-unit test:legacy test:intg test:pyimport",
21+
"test:legacy": "pytest tests/test_integration*.py",
2222
"test:intg": "pytest --nopercyfinalize --headless tests/integration",
23-
"test:pyimport": "pytest tests/test_dash_import.py",
23+
"test:pyimport": "python -m unittest tests.test_dash_import",
2424
"test-unit": "jest",
2525
"format": "prettier --config .prettierrc --write src/**/*.js tests/unit/*.js",
2626
"format:test": "prettier --config .prettierrc src/**/*.js tests/unit/*.js --list-different",

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
packages=[package_name],
1515
include_package_data=True,
1616
license=package['license'],
17-
description=package['description'] if 'description' in package else package_name,
17+
description=package.get("description", package_name),
1818
install_requires=[]
1919
)

src/components/Graph.react.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class PlotlyGraph extends Component {
105105
}
106106

107107
// in case we've made a new DOM element, transfer events
108-
if(this._hasPlotted && gd !== this._prevGd) {
109-
if(this._prevGd && this._prevGd.removeAllListeners) {
108+
if (this._hasPlotted && gd !== this._prevGd) {
109+
if (this._prevGd && this._prevGd.removeAllListeners) {
110110
this._prevGd.removeAllListeners();
111111
Plotly.purge(this._prevGd);
112112
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import dash
2+
import dash_html_components as html
3+
import dash_core_components as dcc
4+
5+
6+
def test_grbs001_graph_without_ids(dash_duo):
7+
app = dash.Dash(__name__)
8+
app.layout = html.Div(
9+
[
10+
dcc.Graph(className="graph-no-id-1"),
11+
dcc.Graph(className="graph-no-id-2"),
12+
]
13+
)
14+
15+
dash_duo.start_server(app)
16+
17+
assert not dash_duo.wait_for_element(".graph-no-id-1").get_attribute(
18+
"id"
19+
), "the graph should contain no more auto-generated id"
20+
assert not dash_duo.wait_for_element(".graph-no-id-2").get_attribute(
21+
"id"
22+
), "the graph should contain no more auto-generated id"

tests/test_dash_import.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import os
2+
import sys
23
import unittest
34

45

56
class TestDashImport(unittest.TestCase):
67
def setUp(self):
7-
with open('dash.py', 'w') as f:
8+
with open("dash.py", "w") as _:
89
pass
910

1011
def tearDown(self):
1112
try:
12-
os.remove('dash.py')
13-
os.remove('dash.pyc')
13+
os.remove("dash.py")
14+
os.remove("dash.pyc")
1415
except OSError:
1516
pass
1617

18+
@unittest.skipIf(sys.version_info[0] == 2, "only run in python3")
1719
def test_dash_import(self):
1820
"""Test that program exits if the wrong dash module was imported"""
1921

2022
with self.assertRaises(SystemExit) as cm:
21-
import dash_core_components
23+
import dash_core_components # noqa
2224

2325
self.assertEqual(cm.exception.code, 1)

tests/test_integration_2.py

-18
Original file line numberDiff line numberDiff line change
@@ -230,24 +230,6 @@ def show_relayout_data(data):
230230
"#relayout-data", '{"xaxis.autorange": true}'
231231
)
232232

233-
def test_graphs_without_ids(self):
234-
app = dash.Dash(__name__)
235-
app.layout = html.Div(
236-
[
237-
dcc.Graph(className="graph-no-id-1"),
238-
dcc.Graph(className="graph-no-id-2"),
239-
]
240-
)
241-
242-
self.startServer(app=app)
243-
244-
graph_1 = self.wait_for_element_by_css_selector(".graph-no-id-1")
245-
graph_2 = self.wait_for_element_by_css_selector(".graph-no-id-2")
246-
247-
self.assertNotEqual(
248-
graph_1.get_attribute("id"), graph_2.get_attribute("id")
249-
)
250-
251233
def test_interval(self):
252234
app = dash.Dash(__name__)
253235
app.layout = html.Div(

0 commit comments

Comments
 (0)