-
Notifications
You must be signed in to change notification settings - Fork 225
Update build chain for dash 0.32.1 #94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
With dash 0.31.1, the components are generated at build time, not at run time. This integrates the new build step in the tool chain.
Dash is now needed to run npm install.
55f03da
to
5ac9cfa
Compare
"build-dist": "npm run clean:py && npm run build:py && webpack --config=webpack.config.dist.js", | ||
"clean:py": "mkdirp dash_bootstrap_components/_components && rimraf dash_bootstrap_components/_components", | ||
"demo": "webpack-dev-server --hot --inline --port=8888 --config=webpack.config.demo.js", | ||
"build:py": "mkdirp dash_bootstrap_components/_components && dash-generate-components ./src/components dash_bootstrap_components/_components && move-cli dash_bootstrap_components/_components/_imports_.py dash_bootstrap_components/_components/__init__.py", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add something like black dash_bootstrap_components/_components
to this? Otherwise the generated Python files are going to fail the build once they get added to version control.
Actually ignore this, I think we're not keeping these under version control right? We're just generating them for inclusion in the distribution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we don't keep the generated sources under version control (unlike, for instance, dash-core-components).
While we could still reformat them with black, I'd vote against because:
- it makes building a little bit longer for no benefit
- it adds more point of failures in the build chain.
Looks great @pbugnion! Thanks for looking into this and setting everything up. I have testing building, running the demo, and installing I made a comment inline, but have since thought that actually it's not relevant, and this is all fine as is. |
As of release 0.32.1, dash prefers building the Python classes at build time rather than at run time. Dash comes with a new utility,
dash-generate-components
, that builds the Python classes. This PR refactors the tooling to use this.Now, running
npm install
populatesdash_bootstrap_components/_components
with the Python class files containing the components. These then get built into the source distribution.I have deliberately diverged from some of the recommendations outlined in issue #93 :
_components
subdirectory, rather than being in thedash_bootstrap_components
root. This makes it easier to clearly differentiate Python files that are written manually (e.g.dbc.themes
,__init__.py
, the upcoming helper to generate a table from a dataframe) from auto-generated source.At the moment, running
npm install
shows some tracebacks whenreact-docgen
tries to parse the test files. I think this is an issue that needs to be fixed in dash, not directly in here. I have raised an issue to that effect. This doesn't actually stop us from using the build artefacts, it just makes the build process confusing.I have released this as 0.2.4-alpha1 to test it and everything seems to be working. Nevertheless, since this is a fairly tricky change, it'd be great to:
npm i
(and then maybe run the documentation or some other app)0.2.4-alpha1
withpip install dash-bootstrap-components==0.2.4-alpha1
.Addresses issue #93.