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

Use jupyter nbextension/serverextension for installation/activation #589

Merged
merged 8 commits into from
Dec 22, 2016

Conversation

ellisonbg
Copy link
Contributor

Fixes #576 and #499

@lgpage
Copy link
Member

lgpage commented Dec 22, 2016

@ellisonbg, @jhamrick I have post-link and pre-unlink scripts for the conda recipe if you want them.

This should allow the extensions to be installed when nbgrader is installed via conda, no extra commands needed unless the the install flag (--user, --system, --sys-prefix) needs to be different.

@ellisonbg
Copy link
Contributor Author

ellisonbg commented Dec 22, 2016 via email

@lgpage
Copy link
Member

lgpage commented Dec 22, 2016

#593 will also need to be merged first for test to work.

@ellisonbg
Copy link
Contributor Author

Tests passing, merging

@ellisonbg ellisonbg merged commit bbc5905 into jupyter:master Dec 22, 2016
@jhamrick
Copy link
Member

@ellisonbg I would prefer if you would have waited for a review from me before merging this. I was in the process of giving a review and I think there are some regressions with the way this is implemented.

self.toggle_nbextension("assignment_list/main")

self.log.info("Done. You may need to restart the Jupyter notebook server for changes to take effect.")
$ jupyter serverextension enable --sys-prefix --py nbgrader
Copy link
Member

Choose a reason for hiding this comment

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

Does this have to be activated separately from the nbextension? They go hand in hand and one won't work without the other. Can we make it so the assignment list extension can be fully activated with one command?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The direction we are moving is to keep nbextension/jupyterlab extensions well separated from the server extensions. A couple of reasons for this:

  • A single server could be serving notebooks to multiple frontends (notebook, nteract, jupyterlab)
  • We are in the process of separating the notebook server into its own project and repo that won't share any code with the frontends
  • We are also moving to a different approach for installing all of these things that will make it all easier for users. While we do this, we want to avoid making things more complicated with our existing stuff.

Obviously, in nbgrader, we could wrap all that and expose an endpoint that does it all automatically. For that I think the best approach is to create a conda-forge feedstock with post install scripts that do everything. This is what we are doing with the vega package and the install process is then trivial (no post install commands needed). Are you ok with that approach? Here is the vega-feedstock that has the needed scripts:

https://github.com/conda-forge/vega-feedstock

Copy link
Member

Choose a reason for hiding this comment

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

I see, that makes sense. Having it be done with conda automatically helps, though not everybody installs nbgrader with conda.

I think it's fine if it requires 3 commands to install and activate the assignment list extension as long as we're clear about it. The thing I'm more concerned about is how to install/activate the two extensions (assignment list and create assignment) separately.


To install for all users, replace `--sys-prefix` by `--system`.
Copy link
Member

Choose a reason for hiding this comment

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

What is the default if --sys-prefix is not included?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! Right now the defaults for serverextensions and nbextensions are different, which we consider to be a bug. However fixing that bug is an API change so it is getting into the code base slowly. Because of this I always give one of the following explicitely: --sys-prefix, --system or --user.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, makes sense.


flags = {}
aliases = {}
$ jupyter nbextension install --sys-prefix --py nbgrader
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to make it so the different extensions can be installed separately? It will be a regression if this is no longer possible, and I know there are people who want to install e.g. just the "assignment list" extension for their students on a server but not the "create assignment" extension (so students can't easily modify their assignments).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the commands are run using the --py approach, then it has to be done all together. However, you can do things separately like this:

jupyter nbextension install --sys-prefix --py nbgrader
jupyter nbextension enable --sys-prefix create_assignment/main

I can update the documentation in the PR for that usage case.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, so just to be clear, all the extensions will always be installed, but we can give people different instructions for how to selectively enable extensions?

It would be great if you can update the documentation to be really explicit about that -- i.e., have one example for how to install and activate all the extensions, and then another for how to activate just one of the extensions.

@@ -11,71 +11,6 @@ Running nbgrader with JupyterHub

Please see :doc:`/configuration/jupyterhub_config`.

.. _assignment-list-installation:
Copy link
Member

Choose a reason for hiding this comment

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

I don't want to remove this documentation, as I think it is still a valid question someone might search for. Rather than deleting it, we should update it with the new installation instructions (i.e. with --system?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is already covered in the main installation page. Is that sufficient or do you want to also keep it in this location? The benefit of the main location is that it covers global installation of both the server extension and nbextensions, rather than just the assignment-list stuff. More than willing to put a note back about this.

Copy link
Member

Choose a reason for hiding this comment

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

So the enabling of extensions also works systemwide for all users? If so, I think that should be made more explicit in the main install page (currently it just says you can install the extensions systemwide, but it doesn't make a mention of enabling systemwide). In that case, I think maybe we can move the stuff I flagged below into the main install instructions.

If not, then I think we should definitely keep this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, yes the way I wrote it wasn't clear. Yes, both installation and activation can be done for all users. I will clarify that.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!


.. warning::

The "Assignment List" extension is not currently compatible with multiple
Copy link
Member

Choose a reason for hiding this comment

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

This part of the documentation is in particular still relevant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I will create a new section for that and keep them.

At this point, you should be able to see the "Assignments" tab in the main
notebook file list.

If you know you have released an assignment but still don't see it in the list
Copy link
Member

Choose a reason for hiding this comment

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

From here on is also still relevant.

@ellisonbg
Copy link
Contributor Author

ellisonbg commented Dec 22, 2016 via email

@ellisonbg
Copy link
Contributor Author

reverted...

@jhamrick
Copy link
Member

Thanks! I definitely appreciate you implementing this, I would just like to make sure we maintain some of the features that I know people appreciate and have asked about.

@jhamrick
Copy link
Member

@lgpage I will open another issue for adding those scrips to the conda recipe, thanks!

nbgrader extension install --help-all
nbgrader extension activate --help-all
* To install for all users, replace `--sys-prefix` by `--system`.
* To install only for the current user replace `--sys-prefix` by `--user`.
Copy link
Member

Choose a reason for hiding this comment

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

(This is where I mean that it says you can install for all users, but it doesn't explicitly mention enabling for all users)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, will clarify and expand this section as I know lots of folks deploying nbgrader want to do this stuff.

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks!

@jhamrick
Copy link
Member

Thanks for updating this, Brian -- it sounds like most of my concerns can be addressed just by updating the docs. I have to go for now but I think with those changes I'll be happy and it'll be good to merge 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants