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

Commit a727cde

Browse files
committed
Update circle.
1 parent 895d3e3 commit a727cde

12 files changed

+230
-69
lines changed

.circleci/config.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
version: 2
2+
3+
jobs:
4+
"python-2.7": &test-template
5+
docker:
6+
- image: circleci/python:2.7-stretch-node-browsers
7+
environment:
8+
PYTHON_VERSION: py27
9+
10+
steps:
11+
- checkout
12+
13+
- run:
14+
name: Create virtual env
15+
command: python -m venv || virtualenv venv
16+
17+
- run:
18+
name: Write job name
19+
command: echo $CIRCLE_JOB > circlejob.txt
20+
21+
- restore_cache:
22+
key: deps1-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "circlejob.txt" }}
23+
24+
- run:
25+
name: Install dependencies
26+
command: |
27+
sudo pip install virtualenv --upgrade
28+
. venv/bin/activate
29+
pip install -r requirements-dev.txt
30+
npm install --ignore-scripts
31+
32+
- save_cache:
33+
key: deps1-{{ .Branch }}-{{ checksum "requirements-dev.txt" }}-{{ checksum "package.json" }}-{{ checksum ".circleci/config.yml" }}-{{ checksum "circlejob.txt" }}
34+
paths:
35+
- "venv"
36+
- "node_modules"
37+
- run:
38+
name: Build
39+
command: |
40+
. venv/bin/activate
41+
npm run build:js
42+
npm run build:py
43+
44+
- run:
45+
name: Run tests
46+
command: |
47+
npm run test
48+
. venv/bin/activate
49+
python --version
50+
python -m unittest test.test_integration
51+
python -m unittest test.test_dash_import
52+
53+
"python-3.6":
54+
<<: *test-template
55+
docker:
56+
- image: circleci/python:3.6-stretch-node-browsers
57+
environment:
58+
PYTHON_VERSION: py36
59+
60+
"python-3.7":
61+
<<: *test-template
62+
docker:
63+
- image: circleci/python:3.7-stretch-node-browsers
64+
environment:
65+
PYTHON_VERSION: py37
66+
67+
68+
workflows:
69+
version: 2
70+
build:
71+
jobs:
72+
- "python-2.7"
73+
- "python-3.6"
74+
- "python-3.7"

circle.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

extract-meta

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
const reactDocs = require('react-docgen');
6+
7+
const componentPaths = process.argv.slice(2);
8+
if (!componentPaths.length) {
9+
help();
10+
process.exit(1);
11+
}
12+
13+
const metadata = Object.create(null);
14+
componentPaths.forEach(componentPath =>
15+
collectMetadataRecursively(componentPath)
16+
);
17+
writeOut(metadata);
18+
19+
function help() {
20+
console.error('usage: ');
21+
console.error(
22+
'extract-meta path/to/component(s) ' +
23+
' [path/to/more/component(s), ...] > metadata.json'
24+
);
25+
}
26+
27+
function writeError(msg, filePath) {
28+
if (filePath) {
29+
process.stderr.write(`Error with path ${filePath}`);
30+
}
31+
32+
process.stderr.write(msg + '\n');
33+
if (msg instanceof Error) {
34+
process.stderr.write(msg.stack + '\n');
35+
}
36+
}
37+
38+
function parseFile(filepath) {
39+
const urlpath = filepath.split(path.sep).join('/');
40+
let src;
41+
42+
if (!['.jsx', '.js'].includes(path.extname(filepath))) {
43+
return;
44+
}
45+
46+
try {
47+
src = fs.readFileSync(filepath);
48+
metadata[urlpath] = reactDocs.parse(src);
49+
} catch (error) {
50+
writeError(error, filepath);
51+
}
52+
}
53+
54+
function collectMetadataRecursively(componentPath) {
55+
if (fs.lstatSync(componentPath).isDirectory()) {
56+
let dirs;
57+
try {
58+
dirs = fs.readdirSync(componentPath);
59+
} catch (error) {
60+
writeError(error, componentPath);
61+
}
62+
dirs.forEach(filename => {
63+
const filepath = path.join(componentPath, filename);
64+
if (fs.lstatSync(filepath).isDirectory()) {
65+
collectMetadataRecursively(filepath);
66+
} else {
67+
parseFile(filepath);
68+
}
69+
});
70+
} else {
71+
parseFile(componentPath);
72+
}
73+
}
74+
75+
function writeOut(result) {
76+
console.log(JSON.stringify(result, '\t', 2));
77+
}

package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,25 @@
1717
"publish-all": "npm publish && python setup.py sdist upload",
1818
"publish-pypi": "npm run prepublish && python setup.py sdist && twine upload --sign --skip-existing",
1919
"start": "./node_modules/.bin/builder run build-dev",
20-
"test": "./node_modules/.bin/eslint --fix .",
20+
"test": "./node_modules/.bin/eslint --fix src",
2121
"test-watch": "./node_modules/.bin/builder run test-frontend-watch",
2222
"test-debug": "./node_modules/.bin/builder run test-frontend-debug",
23-
"uninstall-local": "pip uninstall dash-core-components -y"
23+
"uninstall-local": "pip uninstall dash-core-components -y",
24+
"build:js": "webpack --mode production",
25+
"build:py": "node ./extract-meta src/components > dash_core_components/metadata.json && copyfiles package.json dash_core_components"
2426
},
2527
"author": "Chris Parmer <[email protected]>",
2628
"license": "MIT",
2729
"dependencies": {
30+
"babel-core": "^6.26.3",
31+
"babel-eslint": "^8.2.3",
32+
"babel-loader": "^7.1.4",
33+
"babel-preset-env": "^1.7.0",
34+
"babel-preset-react": "^6.24.1",
2835
"builder": "3.2.2",
2936
"copyfiles": "^2.0.0",
3037
"cross-env": "^5.2.0",
38+
"css-loader": "^0.28.11",
3139
"dash-components-archetype": "^0.3.0-rc1",
3240
"moment": "^2.20.1",
3341
"prop-types": "^15.6.0",
@@ -42,7 +50,12 @@
4250
"react-select-fast-filter-options": "^0.2.2",
4351
"react-syntax-highlighter": "^5.0.0",
4452
"react-virtualized-select": "^3.1.0",
45-
"styled-jsx": "^2.2.6"
53+
"react-docgen": "^2.20.1",
54+
"style-loader": "^0.21.0",
55+
"styled-jsx": "^2.2.6",
56+
"webpack": "^4.8.3",
57+
"webpack-cli": "^2.1.3",
58+
"webpack-serve": "^1.0.2"
4659
},
4760
"devDependencies": {
4861
"component-playground": "^2.0.0",

requirements-locked.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ cffi==1.10.0
66
chardet==3.0.4
77
click==6.7
88
cryptography==2.0.3
9-
dash==0.23.1
10-
dash-core-components==0.13.0rc8
11-
dash-html-components==0.7.0
9+
dash==0.25.1
10+
dash_core_components==0.27.1
11+
dash_html_components==0.12.0rc3
1212
dash-renderer==0.12.0rc1
1313
dash-table-experiments==0.5.0
1414
decorator==4.1.2
@@ -17,7 +17,6 @@ Flask==0.12.2
1717
Flask-Compress==1.4.0
1818
Flask-SeaSurf==0.2.2
1919
funcsigs==1.0.2
20-
functools32==3.2.3.post2
2120
idna==2.6
2221
ipaddress==1.0.18
2322
ipdb==0.10.3
@@ -31,7 +30,7 @@ loremipsum==1.0.5
3130
MarkupSafe==1.0
3231
mock==2.0.0
3332
nbformat==4.4.0
34-
numpy==1.13.1
33+
numpy
3534
pandas==0.20.3
3635
pathlib2==2.3.0
3736
pbr==3.1.1

src/components/__tests__/.eslintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/components/__tests__/DropDown.test.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

test/IntegrationTests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def tearDown(self):
4444
requests.get('http://localhost:8050/stop')
4545
else:
4646
self.server_process.terminate()
47+
self.driver.back()
4748
time.sleep(3)
4849

4950
def startServer(self, app):
@@ -64,7 +65,8 @@ def run():
6465
app.run_server(
6566
port=8050,
6667
debug=False,
67-
processes=processes
68+
processes=processes,
69+
threaded=False,
6870
)
6971

7072
def run_windows():
@@ -97,7 +99,7 @@ def _stop_server_windows():
9799

98100
# Visit the dash page
99101
self.driver.get('http://localhost:8050')
100-
time.sleep(0.5)
102+
self.driver.implicitly_wait(2)
101103

102104
# Inject an error and warning logger
103105
logger = '''

test/test_integration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_gallery(self):
254254
),
255255

256256
html.Label('Vertical Tabs'),
257-
dcc.Tabs(id="tabs", vertical=True, children=[
257+
dcc.Tabs(id="tabs1", vertical=True, children=[
258258
dcc.Tab(label='Tab one', children=[
259259
html.Div(['Test'])
260260
]),
@@ -607,6 +607,8 @@ def display_page(pathname):
607607

608608
self.startServer(app=app)
609609

610+
time.sleep(2)
611+
610612
#callback is called twice when defined
611613
self.assertEqual(
612614
call_count.value,
@@ -631,7 +633,7 @@ def display_page(pathname):
631633
#test if callback is only fired once (offset of 2)
632634
self.assertEqual(
633635
call_count.value,
634-
2 + 1
636+
3
635637
)
636638

637639
def test_candlestick(self):
@@ -742,7 +744,8 @@ def _on_confirmed(submit_n_clicks, cancel_n_clicks,
742744
if not submit_n_clicks and not cancel_n_clicks:
743745
return ''
744746
count.value += 1
745-
if submit_timestamp > cancel_timestamp:
747+
if (submit_timestamp and cancel_timestamp is None) or\
748+
(submit_timestamp > cancel_timestamp):
746749
return 'confirmed'
747750
else:
748751
return 'canceled'

tox.ini

Lines changed: 0 additions & 15 deletions
This file was deleted.

webpack.config.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const path = require('path');
2+
const packagejson = require('./package.json');
3+
4+
const dashLibraryName = packagejson.name.replace(/-/g, '_');
5+
6+
module.exports = {
7+
entry: {main: './src/index.js'},
8+
output: {
9+
path: path.resolve(__dirname, dashLibraryName),
10+
filename: 'bundle.js',
11+
library: dashLibraryName,
12+
libraryTarget: 'window'
13+
},
14+
externals: {
15+
react: 'React',
16+
'react-dom': 'ReactDOM',
17+
'plotly.js': 'Plotly'
18+
},
19+
module: {
20+
rules: [
21+
{
22+
test: /\.js$/,
23+
exclude: /node_modules/,
24+
use: {
25+
loader: 'babel-loader'
26+
}
27+
},
28+
{
29+
test: /\.css$/,
30+
use: [
31+
{
32+
loader: 'style-loader'
33+
},
34+
{
35+
loader: 'css-loader'
36+
}
37+
]
38+
}
39+
]
40+
}
41+
};

0 commit comments

Comments
 (0)