Comments (29)
The issues seem to be fixed according to my testing, if you can confirm could you close this?
from panel.
I updated param and panel to master and now I can't get the panel to display. I'm getting a javascript error:
from panel.
Could you report the versions you've got for each? I can't reproduce that.
from panel.
JupyterLab and jupyterlab_pyviz versions may also be useful.
from panel.
param 1.8.0a8.post5+ga97c18b
panel 0.1.0a11.post3+ge8e0f6d.dirty
jupyter 1.0.0
jupyter_client 5.2.3
jupyter_console 5.2.0
jupyter_core 4.4.0
jupyterlab 0.34.6
jupyterlab_launcher 0.13.1
@pyviz/jupyterlab_pyviz v0.6.1
from panel.
Thank you!
from panel.
Okay updated JupyterLab and can now reproduce the issue. I'll try to get an updated jupyterlab_pyviz
release out with a fix.
from panel.
Okay nevermind, it's not an issue with the jlab extension, it's merely down to the fact that you haven't loaded the extension in the notebook. So try clearing the output, reloading the jlab and then loading the panel (or holoviews) extension:
panel.extension()
from panel.
Not sure how I was missing that before when this was working. At any rate, panel.extension()
doesn't seem to fix it for me.
I'm heading out for the day, I'll pick back up with this tomorrow.
from panel.
I had to clear the notebook and reload the page for some reason.
from panel.
Not sure how I was missing that before when this was working. At any rate, panel.extension() doesn't seem to fix it for me.
I suspect at that point you had another tab open which did load an extension, which is sufficient.
from panel.
Got it working. My guess is that the other tab was hanging on to a previous build.
Now, is this expected behavior given how I have this coded?:
from panel.
And can you confirm that this:
loc = foo.location(name='')
adv = foo.advanced(name='')
Tabs(('INPUT', loc), ('Advanced', adv))
foo.launch(loc.solve_on, adv.notebook)
Is the cleanest and most efficient way to apply my code?
from panel.
Now, is this expected behavior given how I have this coded?:
No, appears to be a bug, I can see an error on the console.
from panel.
Fixed in holoviz/param#289, I'll tag new param and panel dev releases once ready.
from panel.
Now merged, should be fixed if you pull param master.
from panel.
Is the cleanest and most efficient way to apply my code?
If you don't need separate instances then this is fine too:
Tabs(('INPUT', foo.location), ('Advanced', foo.advanced ))
foo.launch(foo.location.solve_on, foo.advanced.notebook)
from panel.
What I was hoping for (and what I think worked in a previous iteration of my code without panel and possibly with a different class setup) was this:
Tabs(('INPUT', foo.location), ('Advanced', foo.advanced ))
foo.launch(foo.location, foo.advanced)
And something like this:
def launch(location, advanced):
v = solve_on
g = notebook
Where basically because launch
was inheriting param.Parameterized
classes and I could just use the objects from those classes directly inside the method (e.g. solve_on above). It felt weird at first because its not clear what's going on, but I eventually liked it because it made my code so clean. Is this not possible now with the way I have it set up above?
If this isn't clear, I can demo what I have on a call next week.
from panel.
Orrrr.... could I write a subfunction in each param.Parameterized
class that simply returned all the objects. Then I could call launch like this:
foo.launch(foo.location.return_objs(), foo.advanced.return_objs())
And then I'd just have to unpack the input.
And for reference... this is what I currently have based on your last suggestion, which is a nightmare:
solve_obj = solve2.solve(loc_param.solve_on, loc_param.solve_from, loc_param.local_architecture,
login_param.hpc_login_node, submit_param.hpc_subproject, submit_param.workdir,
submit_param.nodes, submit_param.wall_time, submit_param.queue,
submit_param.submit_script_filename, adv_param.notebook, input_param.sim_files,
input_param.model, input_param.adh_rootname, input_param.adh_root_filename,
input_param.adh_directory)
from panel.
Could you describe what exactly about this isn't working? I can't reproduce any problem with what you're describing. I don't quite follow the difference between foo.launch
and the launch
function. The other thing I don't follow is this:
foo.launch(foo.location, foo.advanced)
There is no reason to pass those parameters to the launch
method since they are available on self. I think what you really want is a classmethod?!
class location(param.Parameterized):
solve_on = param.ObjectSelector(default='topaz', objects=['topaz', 'desktop'], precedence=1)
class advanced(param.Parameterized):
notebook = param.Boolean(default=True, precedence=9)
class solve(location, advanced):
@classmethod
def launch(cls):
if cls.solve_on == 'desktop':
print('bar')
if cls.notebook:
print('notebook')
Tabs(('INPUT', location), ('Advanced', advanced ))
solve.launch()
If this isn't what you want let's discuss next week.
from panel.
OoOoOo I didn't know that I was a thing (engineer != programmer). That seems like it might be what I'm looking for. Let me work on this a bit and get back with you.
from panel.
And to answer your question. Its all working, its just much less clean than it was before I implemented Panel so I want to make sure that I'm streamlining things as much as possible.
from panel.
So param actually also provides a bothmethod
decorator, which means you can use the method on the class or an instance of the class which may also be useful:
class solve(location, advanced):
@param.parameterized.bothmethod
def launch(self_or_cls):
if self_or_cls.solve_on == 'desktop':
print('bar')
if self_or_cls.notebook:
print('notebook')
from panel.
Nice! I'll look into that too. Thanks!
from panel.
And to answer your question. Its all working, its just much less clean than it was before I implemented Panel so I want to make sure that I'm streamlining things as much as possible.
It would be good to see the comparison, as that's exactly the opposite of what I expect.
from panel.
@philippjfr Have you had a chance to look at the solve code I sent yet? I have a soft deadline for a demo at the end of the week and I'd love to use the more streamlined version of that code.
from panel.
Looking at this now, hope to get back to you very soon.
from panel.
The best way to achieve what you want is to make an instance of your multiple inheritance class and then declare a number of Param
panes each with the subset of parameters you want:
solver = solve.solve(name='')
location = pn.Pane(solver, parameters=list(solve.location.params()), name='Location')
hpc_submit = pn.Pane(solver, parameters=list(solve.hpc_submit.params()), name='HPC Options')
advanced = pn.Pane(solver, parameters=list(solve.advanced.params()), name='Advanced')
Tabs(location, hpc_submit, advanced, height=500)
from panel.
works great! thanks!!
from panel.
Related Issues (20)
- Param trigger not working as expected HOT 3
- pn.pane.HTML fails to display bokeh plot HOT 1
- CodeEditor widget is unusable when automatic theading is enabled
- Unable to panel serve from a notebook HOT 2
- Update Plotly js to latest version to support polar plots.
- Failed to convert app.py to pyodide-worker target: local variable 'loading_style' referenced before assignment
- Issue with updating AutoCompleteInput Options
- Cannot sync DataFrame parameter HOT 1
- Adding resizable parameter to Viewable HOT 2
- Tabulator `page_size` sometimes has no effect
- Pasting tabular data into the Tabulator widget HOT 4
- Issue with loading indicator appearance in Fast template
- The `justify` parameter of `pn.pane.DataFrame` has no effect HOT 2
- Overflowing pane container HOT 2
- Plotly pane not working with (async) generator HOT 2
- HTML generated from save method of panel cannot be viewed in a no-network environment even though the resources is set to INLINE HOT 1
- Plotly reference guide 1.4.2rc1 issues HOT 3
- Exception raised when reloading quickly multiple times - error handling missing HOT 5
- Feature request: LaTeX column names for DataFrames HOT 1
- Toggle Icon
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 panel.