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

Switch to %reload_ext in the tutorials #258

Closed
jlstevens opened this issue Sep 2, 2015 · 15 comments
Closed

Switch to %reload_ext in the tutorials #258

jlstevens opened this issue Sep 2, 2015 · 15 comments
Assignees
Labels
type: docs Related to the documentation and examples
Milestone

Comments

@jlstevens
Copy link
Contributor

We should use %reload_ext holoviews.ipython instead of %load_ext holoviews.ipython as it behaves more predictably, reloading the extension without showing the message about the extension already being loaded.

This is particularly important for the next release as the HoloViews IPython extension now loads the necessary javascript and CSS into the cell - rerunning %load_ext removes this cell which then breaks the widgets in the notebook.

Of course %load_ext does still work but you need to be careful not to reload the extension! We could tell the user to use %reload_ext (our current welcome message is 'HoloViewsJS successfully loaded.') but that might be awkward. Finally, we might need to make sure notebook testing works with this approach and we will probably have to regenerate all our reference data.

@jlstevens jlstevens added the type: docs Related to the documentation and examples label Sep 2, 2015
@philippjfr
Copy link
Member

The notebook testing did not seem to mind the Logo + 'HoloViewsJS successfully loaded' + JS + CSS being added to the output so it might not cause any issues.

@jlstevens
Copy link
Contributor Author

The notebook testing did not seem to mind the Logo + 'HoloViewsJS successfully loaded' + JS + CSS being added to the output so it might not cause any issues.

I guess that is because it isn't a HoloViews object and isn't normal standard output either meaning this particular type of display output isn't captured and compared. Phew!

@jbednar
Copy link
Member

jbednar commented Sep 2, 2015

I'd personally avoid putting any message by default, just to be nicer to people who want things to display without extra busyness. Telling people to uniformly use reload_ext seems fine to me.

@philippjfr
Copy link
Member

Just so you know what we're talking about, %load_ext and %reload_ext now display the following output:

image

This message is important because it tells users that if they clear that cell the widgets will break.

@jbednar
Copy link
Member

jbednar commented Sep 2, 2015

It doesn't tell me that in any way!

On Wed, Sep 2, 2015 at 9:38 AM, Philipp Rudiger [email protected]
wrote:

Just so you know what we're talking about, %load_ext and %reload_ext now
display the following output:

[image: image]
https://cloud.githubusercontent.com/assets/1550771/9634238/9f59899e-5188-11e5-81bb-9eed049def6f.png

This message is important because it tells users that if they clear that
cell the widgets will break.


Reply to this email directly or view it on GitHub
#258 (comment).

@philippjfr
Copy link
Member

It simply mirrors what Bokeh have done, as you said I didn't want anything too "busy". Here's what it looks like in bokeh:

image

Happy to change it though.

@jbednar
Copy link
Member

jbednar commented Sep 2, 2015

I don't like it in Bokeh either; I find it intrusive if a package I've loaded interferes with the contents of my notebook without my permission. If I wanted to know if BokehJS was loaded, I'd issue some command at the prompt explicitly. Explicit is better than implicit, right? :-)

@philippjfr philippjfr added this to the v1.4.0 milestone Sep 11, 2015
@philippjfr philippjfr mentioned this issue Nov 10, 2015
42 tasks
@philippjfr
Copy link
Member

How about allowing our own parameterized version of %load_ext while still supporting the old syntax?

@philippjfr philippjfr self-assigned this Nov 23, 2015
@jlstevens
Copy link
Contributor Author

How about allowing our own parameterized version of %load_ext while still supporting the old syntax?

That seems fine to me although this isn't a concrete example. Perhaps you are thinking of something like this?

hv.load_extension() # Basically same as %load_ext *without* injecting javascript
hv.load_extension(javascript=True) # Explicitly used to just inject javascript

@jlstevens
Copy link
Contributor Author

Implementing this could also help address other issues such as #283

@jbednar
Copy link
Member

jbednar commented Dec 1, 2015

I agree-- can we just have a normal function that loads the extension, with arguments, and then we can handle both re-execution (which should simply be a no-op the second time, not a warning or an error) and changing defaults (e.g. width to 100%)?

@philippjfr
Copy link
Member

If we make it a ParameterizedFunction, we can have a css parameter, then if you want to always change the width, you can just set this in your notebook config:

hv.ipython.load_notebook.css = """
div.container {
    width: 100%;
}"""

@jbednar
Copy link
Member

jbednar commented Dec 1, 2015

That sounds good for the general case, but I'd want something very simple in addition so that a one-liner could be used in all our examples and tutorials, e.g.:

hv.load_extension(width=100)

instead of %load_ext holoviews, which would then inject the appropriate CSS for this one very commonly desired case (and others if we find extremely common idioms that we find ourselves putting into the css parameter).

@philippjfr
Copy link
Member

The new hv.notebook_extension function has now been merged. Closing this issue.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: docs Related to the documentation and examples
Projects
None yet
Development

No branches or pull requests

3 participants