Skip to content

Commit f93f99b

Browse files
authored
Merge pull request #903 from plotly/persistence
Generalized persistence
2 parents e4ea7a4 + 130a857 commit f93f99b

15 files changed

+8309
-7677
lines changed

Diff for: .circleci/config.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ jobs:
5555
pylint tests/unit tests/integration/devtools tests/integration/renderer tests/integration/dash_assets -d all -e C0410,C0411,C0412,C0413,W0109
5656
cd dash-renderer && npm install --ignore-scripts && npm run lint:test && npm run format:test
5757
- run:
58-
name: 🔎 Unit Tests
58+
name: 🐍 Python Unit Tests
5959
command: |
6060
. venv/bin/activate
6161
PYTHONPATH=~/dash/tests/assets pytest tests/unit
62+
- run:
63+
name: ☕ JS Unit Tests
64+
command: |
65+
cd dash-renderer && npm run test:js
6266
6367
"lint-unit-36":
6468
<<: *lint-unit
@@ -92,6 +96,7 @@ jobs:
9296
command: |
9397
sudo pip install --upgrade virtualenv
9498
python -m venv venv || virtualenv venv && . venv/bin/activate
99+
sed -i '/dash/d' requires-install.txt
95100
pip install -e . -r requires-install.txt -r requires-dev.txt -r requires-testing.txt --quiet
96101
- save_cache:
97102
key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-dev.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
@@ -152,7 +157,7 @@ jobs:
152157
name: ️️🏗️ build misc
153158
command: |
154159
. venv/bin/activate && pip install --upgrade -e . --quiet && mkdir packages
155-
git clone --depth 1 https://github.com/plotly/dash-table.git
160+
git clone --depth 1 -b persistence https://github.com/plotly/dash-table.git
156161
cd dash-table && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
157162
git clone --depth 1 https://github.com/plotly/dash-html-components.git
158163
cd dash-html-components && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
@@ -262,4 +267,4 @@ workflows:
262267
- "test-27":
263268
requires:
264269
- build-core-27
265-
- build-misc-27
270+
- build-misc-27

Diff for: dash-renderer/.babelrc

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
{
2-
"presets": ["es2015", "react", "stage-2"],
3-
"env": {
4-
"development": {
5-
"presets": ["es2015", "react", "stage-2"],
6-
"plugins": [
7-
["transform-es2015-modules-commonjs-simple", {
8-
"noMangle": true
9-
}]
10-
]
11-
}
12-
}
2+
"presets": [["@babel/preset-env", {
3+
"useBuiltIns": "usage",
4+
"corejs": 3
5+
}], "@babel/preset-react"]
136
}

Diff for: dash-renderer/.eslintrc.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
"no-sequences": ["error"],
111111
"no-shadow": ["off"],
112112
"no-throw-literal": ["error"],
113-
"no-undefined": ["error"],
114113
"no-unused-expressions": ["error"],
115114
"no-use-before-define": ["error", "nofunc"],
116115
"no-useless-call": ["error"],
@@ -147,4 +146,4 @@
147146
"no-underscore-dangle": ["off"],
148147
"no-useless-escape": ["off"]
149148
}
150-
}
149+
}

Diff for: dash-renderer/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## Unreleased
66

7+
### Added
8+
- [#903](https://github.com/plotly/dash/pull/903) enables props edited by the user to persist across recreating the component or reloading the page. Components need to define three new props: `persistence`, `persisted_props`, and `persistence_type` as described in the lead comment of `src/persistence.js`. App developers then enable this behavior by, in the simplest case, setting `persistence: true` on the component. First use case is table, see [dash-table#566](https://github.com/plotly/dash-table/pull/566)
9+
710
### Fixed
811
- Reduced about 55% of the dash-renderer packages size on **PyPI** by removing the source maps. To do more advanced debugging, the source maps needs to be generated from source code with `npm run build:local` and pip install in editable mode, i.e. `pip install -e .` [#910](https://github.com/plotly/dash/pull/910)
912

Diff for: dash-renderer/jest.config.js

+181
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// All imported modules in your tests should be mocked automatically
6+
// automock: false,
7+
8+
// Stop running tests after the first failure
9+
// bail: false,
10+
11+
// Respect "browser" field in package.json when resolving modules
12+
// browser: false,
13+
14+
// The directory where Jest should store its cached dependency information
15+
// cacheDirectory: "/var/folders/8m/wrr89jfx5kg5xhp7q2127bcc0000gn/T/jest_dx",
16+
17+
// Automatically clear mock calls and instances between every test
18+
clearMocks: true,
19+
20+
// Indicates whether the coverage information should be collected while executing the test
21+
// collectCoverage: false,
22+
23+
// An array of glob patterns indicating a set of files for which coverage information should be collected
24+
// collectCoverageFrom: null,
25+
26+
// The directory where Jest should output its coverage files
27+
coverageDirectory: "coverage",
28+
29+
// An array of regexp pattern strings used to skip coverage collection
30+
// coveragePathIgnorePatterns: [
31+
// "/node_modules/"
32+
// ],
33+
34+
// A list of reporter names that Jest uses when writing coverage reports
35+
// coverageReporters: [
36+
// "json",
37+
// "text",
38+
// "lcov",
39+
// "clover"
40+
// ],
41+
42+
// An object that configures minimum threshold enforcement for coverage results
43+
// coverageThreshold: null,
44+
45+
// Make calling deprecated APIs throw helpful error messages
46+
// errorOnDeprecated: false,
47+
48+
// Force coverage collection from ignored files usin a array of glob patterns
49+
// forceCoverageMatch: [],
50+
51+
// A path to a module which exports an async function that is triggered once before all test suites
52+
// globalSetup: null,
53+
54+
// A path to a module which exports an async function that is triggered once after all test suites
55+
// globalTeardown: null,
56+
57+
// A set of global variables that need to be available in all test environments
58+
// globals: {},
59+
60+
// An array of directory names to be searched recursively up from the requiring module's location
61+
// moduleDirectories: [
62+
// "node_modules"
63+
// ],
64+
65+
// An array of file extensions your modules use
66+
// moduleFileExtensions: [
67+
// "js",
68+
// "json",
69+
// "jsx",
70+
// "node"
71+
// ],
72+
73+
// A map from regular expressions to module names that allow to stub out resources with a single module
74+
moduleNameMapper: {
75+
"\\.(css|less)$": "identity-obj-proxy"
76+
},
77+
78+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
79+
// modulePathIgnorePatterns: [],
80+
81+
// Activates notifications for test results
82+
// notify: false,
83+
84+
// An enum that specifies notification mode. Requires { notify: true }
85+
// notifyMode: "always",
86+
87+
// A preset that is used as a base for Jest's configuration
88+
// preset: null,
89+
90+
// Run tests from one or more projects
91+
// projects: null,
92+
93+
// Use this configuration option to add custom reporters to Jest
94+
// reporters: undefined,
95+
96+
// Automatically reset mock state between every test
97+
// resetMocks: false,
98+
99+
// Reset the module registry before running each individual test
100+
// resetModules: false,
101+
102+
// A path to a custom resolver
103+
// resolver: null,
104+
105+
// Automatically restore mock state between every test
106+
// restoreMocks: false,
107+
108+
// The root directory that Jest should scan for tests and modules within
109+
// rootDir: null,
110+
111+
// A list of paths to directories that Jest should use to search for files in
112+
roots: [
113+
"<rootDir>/tests"
114+
],
115+
116+
// Allows you to use a custom runner instead of Jest's default test runner
117+
// runner: "jest-runner",
118+
119+
// The paths to modules that run some code to configure or set up the testing environment before each test
120+
// setupFiles: ['<rootDir>/tests/setupTests.js'],
121+
122+
// The path to a module that runs some code to configure or set up the testing framework before each test
123+
// setupTestFrameworkScriptFile: null,
124+
125+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
126+
// snapshotSerializers: [],
127+
128+
// The test environment that will be used for testing
129+
testEnvironment: "jsdom",
130+
131+
// Options that will be passed to the testEnvironment
132+
// testEnvironmentOptions: {},
133+
134+
// Adds a location field to test results
135+
// testLocationInResults: false,
136+
137+
// The glob patterns Jest uses to detect test files
138+
testMatch: [
139+
"**/?(*.)+(spec|test).js?(x)"
140+
],
141+
142+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
143+
// testPathIgnorePatterns: [
144+
// "/node_modules/"
145+
// ],
146+
147+
// The regexp pattern Jest uses to detect test files
148+
// testRegex: "",
149+
150+
// This option allows the use of a custom results processor
151+
// testResultsProcessor: null,
152+
153+
// This option allows use of a custom test runner
154+
// testRunner: "jasmine2",
155+
156+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
157+
// testURL: "http://localhost",
158+
159+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
160+
// timers: "real",
161+
162+
// A map from regular expressions to paths to transformers
163+
// transform: null,
164+
165+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
166+
// transformIgnorePatterns: [
167+
// "/node_modules/"
168+
// ],
169+
170+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
171+
// unmockedModulePathPatterns: undefined,
172+
173+
// Indicates whether each individual test should be reported during the run
174+
// verbose: null,
175+
176+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
177+
// watchPathIgnorePatterns: [],
178+
179+
// Whether to use watchman for file crawling
180+
// watchman: true,
181+
};

0 commit comments

Comments
 (0)