Comments (6)
the constructors across Dash backends should be somewhat consistent
I agree with it. I think it's important that a person who has worked with Dash in Python can work with it in Julia or R with minimal cost.
But I also believe that if the features of Julia or R allow you to do something more convenient, or more familiar in the context of a specific language than in Python, then you should give the user this option in addition to the Base API
from dash.jl.
The following options are available in the master:
app.layout = html_div(...)
layout!(app, html_div(...))
layout!(app) do
...
end
div = getlayout(app)
div = app.layout
from dash.jl.
In python layout
is the property, not method! (the fact that it is implemented via setter method is not important from the point of view of the user interface). In R it is the method.
If we need a property I can convert DashApp struct to mutable struct, then app.layout = .... will work. But it will work with all another properties of DashApp too (I don't see that as a problem yet). I can also add function layout!(app, component)
to setup layout. I would also add the overload layout!(layout_maker, app)
to be able to use the do ... end syntax if the user doesn't like the hell of nested brackets as much as I do.
I also don't see the point in removing layout_maker from the constructor. I suggest just having two overloads of it - one as it is with layout_maker, the other without it.
If we can make the interface version as close as possible to Python and R, and also using the advantages of Julia to give additional features to the user, then why not do it?
from dash.jl.
In fact, maybe I can implement app. layout = ... without having to make the entire structure mutable, but this requires an experiment. So we need a choice - do we implement it as a property, or as a method,or both?
from dash.jl.
In python
layout
is the property, not method! (the fact that it is implemented via setter method is not important from the point of view of the user interface). In R it is the method.
If we need a property I can convert DashApp struct to mutable struct, then app.layout = .... will work. But it will work with all another properties of DashApp too (I don't see that as a problem yet). I can also add functionlayout!(app, component)
to setup layout. I would also add the overloadlayout!(layout_maker, app)
to be able to use the do ... end syntax if the user doesn't like the hell of nested brackets as much as I do.
I also don't see the point in removing layout_maker from the constructor. I suggest just having two overloads of it - one as it is with layout_maker, the other without it.If we can make the interface version as close as possible to Python and R, and also using the advantages of Julia to give additional features to the user, then why not do it?
It's true that layout
is a property in Dash for Python, and a R6 method in Dash for R. I think we should be pragmatic, and use whatever makes sense in Julia, while also trying to adhere to Dash idioms whenever possible. I agree that it makes sense to work within the idioms of a given language -- there are definitely idioms in Python that I wish existed in R, and vice-versa.
In this case, if a mutable struct will enable application developers to specify app.layout =
, then I think that's a reasonable alternative. I'm not as comfortable with Julia as R, so I'm curious if you feel that there are fundamental issues with this approach.
If it's possible to provide the layout!(layout_maker, app)
shorthand to abbreviate the layout declaration, while still supporting app.layout =
, I don't see any problem with that personally.
As for layout_maker
, I defer to @alexcjohnson -- my general perspective is that the constructors across Dash backends should be somewhat consistent, though there's no technical requirement preventing additions to the base API.
from dash.jl.
The following options are available in the master:
app.layout = html_div(...) layout!(app, html_div(...)) layout!(app) do ... end div = getlayout(app) div = app.layout
Great, I'm sure more experienced Julia users will appreciate the additional options you've provided, and app.layout =
provides good parity with the Python implementation as well.
Thanks for taking care of these elements, I'm going to close this issue now! 🚀
from dash.jl.
Related Issues (20)
- Update `plotly/julia:ci` docker container HOT 1
- Write a CONTRIBUTING.md HOT 1
- Can Plotly Dash animations display buttons and sliders? HOT 6
- ArgumentError: Distributed.var doesn't have a defined StructTypes.StructType HOT 2
- 3D plot combining line and surface HOT 2
- Feature: Type -> Component mapping with weakdeps
- Using python libs in Dash.jl
- Write (python) dash vs Dash.jl feature comparison table HOT 4
- markdown with latex support HOT 1
- Warning during precompilation HOT 1
- Advanced checklist HOT 1
- Support background callbacks HOT 1
- Support figures generated by Plots.jl with a PlotlyBackend HOT 1
- UndefVarError for html components HOT 3
- Try Dash.jl with React 18
- Move `DashBase.to_dash` type-piracy definitions to DashBase repo HOT 2
- Experiment with `PrecompileTools.jl` to speed up TTFX
- Test failing with Julia 1.10.0-beta3 HOT 2
- Circular callbacks with multiple callbacks seem to work HOT 2
- Accept app root path as kwarg to `dash` method? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dash.jl.