Skip to content
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

Add core elements of Dash API, support generated components #18

Merged
merged 51 commits into from
May 18, 2020

Conversation

waralex
Copy link
Collaborator

@waralex waralex commented May 4, 2020

  • Switch to external generated components
  • Refactoring of DashApp, handlers and routing
  • Resource registry. Any package can register its resources in the dash via Dash.register_package(pkg::ResourcePkg)`
  • Working with resources. Automatically include from the asset folder, including component resources, working with server_locally = false, dynamic and async flags and etc.
  • Fingerprints for components resources, Cache-Control and ETag support
  • ability to set layout as a function
  • validation of layout and index_string
  • DevTools structure and enable_dev_tools(app;debug, ....) method for setting DevTools. Arguments are the same as in python version. Also that arguments added to run_server function
  • environment variables are now supported
  • overload of dash() with layout_maker is removed

Not all docstrings is currently valid. I suggest updating all the documentation when we are ready for release to the master

For testing: activate pkg mode in REPL (press ] in REPL mode)
Remove existing Dash package:

(v1.3) pkg> rm Dash

Install Dash from this branch:

(v1.3) pkg> add https://github.com/plotly/Dash.jl.git#generated_components

Install generated components packages from my forks:

(v1.3) pkg> add https://github.com/waralex/dash-html-components.git#jl_generator_test
(v1.3) pkg> add https://github.com/waralex/dash-core-components.git#jl_generator_test

Try to run simple server:

julia> using Dash
julia> using DashHtmlComponents
julia> app = dash("test")
julia> app.layout = html_div() do
            html_h1("test")
       end
julia> run_server(app)

@waralex waralex requested a review from rpkyle May 4, 2020 14:59
@github-actions github-actions bot added the enhancement New feature or request label May 4, 2020
Copy link
Contributor

@rpkyle rpkyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waralex This is great! A lot of good features in this PR. The support for generated components is really nice to see, it's going to make supporting Dash.jl possible once we've merged the generator PR. I can see support for

  • components generated prior to runtime
  • asset serving
  • asset fingerprinting
  • asynchronous loading of components
  • layout as component, tree of components, or functions returning components
  • validation for index page and layout
  • dev tools UI arguments
  • querying environment variables (important for deployed apps)

I've made comments in-line, but one thing I noticed is that there are very few comments in the code. I would suggest adding them for any methods/functions whose purpose is not immediately obvious, and which do not exist in R or Python. In addition, there is what appears to be a new feature user-facing element in callback! called pass_changed_props; we should probably discuss since it appears to be a deviation from the Dash API. I recognize that this is a legacy item from Dashboards.jl.

Now that we have integration test support for Dash.jl, we will want to add a few tests before merging this PR. I'll recommend some initial tests we can convert from Python/R, but feel free to add others if you think they are helpful. It's really great to see this moving ahead, thanks for taking this on, and investing the energy in refactoring to bring the interface and feature set closer to parity with the existing versions of Dash.

Let's try to condense the quantity of new features in subsequent PRs if we can, this one (understandably) contains quite a bit, but it will be a little easier to review/revise if we try not to do too much in a single shot. 😸

.circleci/config.yml Outdated Show resolved Hide resolved
component_sources.json Show resolved Hide resolved
component_sources.json Show resolved Hide resolved
deps/build.jl Show resolved Hide resolved
src/Components.jl Show resolved Hide resolved
src/resources/application.jl Show resolved Hide resolved
src/resources/registry.jl Show resolved Hide resolved
src/resources/registry.jl Show resolved Hide resolved
src/resources/registry.jl Show resolved Hide resolved
test/TestComponents.jl Show resolved Hide resolved
@rpkyle
Copy link
Contributor

rpkyle commented May 12, 2020

Related to integration tests: we would like to add tests for basic functionality, which probably eventually includes

  • clientside callbacks (future PR)
  • asset serving
  • dev tools UI (devtools UI, props check would be relevant to the code in this PR)
  • callback validation tests (e.g. simple no update, multiple outputs, and no update with multiple outputs)
  • show undo/redo render test (the simpler R example test is probably fine)

I can help with these, should help ensure stability of the code going forward, particularly as we near a release with all the new functionality you've worked hard to provide.

@rpkyle
Copy link
Contributor

rpkyle commented May 18, 2020

@waralex I went ahead and resolved nearly all of the outstanding items, and added a test for meta tags (since I had added one for R already). I think this PR is basically ready to go once we've figured out what to do about #18 (comment).

Nice work! 🙌

@rpkyle
Copy link
Contributor

rpkyle commented May 18, 2020

Looks OK; I think we're ready to merge this into dev now. 💃

@rpkyle rpkyle self-requested a review May 18, 2020 13:42
@waralex waralex merged commit 0fe297c into dev May 18, 2020
Dash for Julia automation moved this from In progress to Done May 18, 2020
@etpinard etpinard deleted the generated_components branch June 13, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
2 participants