-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
frontend/extension-config: allow default json files in a .d directory #3116
Conversation
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.
Thanks for this!
notebook/manager.py
Outdated
@@ -0,0 +1,103 @@ | |||
"""Manager to read and modify config data in JSON files. |
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.
Maybe call this config_manager.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.
yeah, wasn't sure where to put it also, but wanted to start with a clean dup of the original PR. Shall I keep it in the root dir?
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.
I think so
notebook/manager.py
Outdated
read_directory = Bool(True) | ||
|
||
def ensure_config_dir_exists(self): | ||
try: |
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.
Mind adding short docstrings for these methods?
Looking awesome! It will be a fine day for packagers and users when it lands. Some remaining questions:
jupyter nbextension enable --sys-prefix --py ipyvolume --confd ipyvolume.json |
👍 on the logging (done). |
The above command would Just Work™️ when using a conda build though. |
As in, that file would be created and picked up as an artifact. |
Although, it wouldn't help with wheels... |
Seems like you could just include in |
Using data_files. |
Ah, right. |
Kicked the unrelated failing JS test |
notebook/config_manager.py
Outdated
@@ -0,0 +1,104 @@ | |||
"""Manager to read and modify config data in JSON files. | |||
""" | |||
# Copyright (c) IPython Development Team. |
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.
Since you are porting this from traitlets, it shows some oldies... let's use the updated header.
I see another PR failing on that part, so I guess that is not related. |
Unrelated errors fixed, this should be good to go. |
This looks great! Going forward, where extension authors want to enable extensions just by creating a new file (the goal of removing post-link scripts in conda packages), what would an entry point for that be? An extra arg to |
My feeling about this is that since it's for package creators and meant to put in place using setuptools' data_files, that it's fine that it is just documented somewhere how to do this (a TODO). Automating this doesn't add much value I think. |
Re: automation: perhaps it could be reasonable to create/update an existing cookiecutter to reflect how this can be used. I think the |
Indeed, good point.
(from mobile phone)
…On 21 Dec 2017 6:05 pm, "Nicholas Bollweg" ***@***.***> wrote:
Re: automation: perhaps it could be reasonable to create/update an
existing cookiecutter to reflect how this can be used. I think the
jupyterlab/*-cookiecutters have been useful in that regard!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3116 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABryPfID9qVX9xXqPMDn1AW_4Q5tBcZkks5tCo_ZgaJpZM4Q7FH_>
.
|
No, but when JupyterLab launches it checks for installed extensions that are not part of the JupyterLab bundle. |
ah, so if I want that to happen, I need to launch jupyterlab (in headless/useless mode) once ... or to keep these "labextension" install. is there a simple way to launch jupyterlab just for that ? a sort of "jupyterlab --check_your_extensions_and_stop" ? |
You can run |
This is really cool, thanks @maartenbreddels @blink1073 . |
Thanks for this! |
Thank you @maartenbreddels! I think this will solve a lot of the confusion around getting widgets working. |
Implements what jupyter/notebook#3116 makes possible
So I really like this idea. I wish I'd realised this was part of the release sooner, because I really don't think this should be in the notebook library. I actually am concerned that this is in notebook and not inside https://github.com/jupyter/jupyter_core/blob/master/jupyter_core/paths.py#L180 Frequently, users, both experienced and inexperienced, have ended up in weird states with their config files as it is. The worst part about it is that its really hard to debug because there are so many places config files could live; as expected, these kinds of bugs hit more novice users the worst. That's why I released I'm worried that this is going to make these kinds of configuration bugs even harder to debug.
|
@mpacer - to raise the visibility of your objections, can you:
I'm afraid having a comment here on a closed issue will be less visible. |
Will follow-up in the new issue when it’s open, but this is only applied to the very notebook-specific configuration of extensions, not the rest of “normal” traitlets-based configuration that’s shared across packages. You are right that adding .d-style config to that belongs in a higher-level for Jupyter-core or traitlets (see my attempt: ipython/traitlets#242). The fact that extensions use a totally different configuration system is an issue and source of confusion, but not a new one. Adding conf.d to traitlets/core also wouldn’t solve the issue for extensions, because it’s a different setup, so we would have to do it twice anyway. The core.paths are still relevant, this is an additional layer inside a given directory on those paths. |
@minrk thanks for the clarification. My concern was because I didn't understand how the class was being used. In particular, seeing the default value of The urgency stemmed from a fear of having to explain to people how to deal with a whole new set of locations that config files might exist in. That isn't the case here, so s'all good for now. I'll open an issue over the next few days in either |
Ah, good point. The default value is only because it's technically a generic object. I suspect the default is never used, and a note to that effect might be appropriate. This PR doesn't change where files are looked for (jupyter-paths is still respected), only that wherever we loaded |
Original was in ipython/traitlets#452
It was decided it should move out of traitlets.
This allows for instance a
jupyter_notebook_config.d/jupyterlab.json
to be placed at install time by pip to avoid users having to runjupyter-serverextension enable
. Similar for jupyter-widgets.Note from Steve:
The intent of this PR is to make it easier for notebook and server extensions to be distributed and consumed by users. By using data_files that populate the appropriate
config.d
directory, the extension is automatically enabled when installed unless overridden by higher level config. This approach works for both wheels and conda packages.