-
Notifications
You must be signed in to change notification settings - Fork 317
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
Conversation
@ellisonbg, @jhamrick I have This should allow the extensions to be installed when |
Yes, one this is merged we should add those to make it easier to install
using conda. Let me get the tests passing first...
…On Thu, Dec 22, 2016 at 3:00 AM, Logan Page ***@***.***> wrote:
@ellisonbg <https://github.com/ellisonbg>, @jhamrick
<https://github.com/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.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#589 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABr0PchofLX1qhoeM0RsaqIvuS_Z3p0ks5rKkpbgaJpZM4LTnsL>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
#593 will also need to be merged first for test to work. |
Tests passing, merging |
@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 |
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.
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?
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.
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:
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 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`. |
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.
What is the default if --sys-prefix
is not included?
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.
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
.
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.
Ok, makes sense.
|
||
flags = {} | ||
aliases = {} | ||
$ jupyter nbextension install --sys-prefix --py nbgrader |
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.
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).
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.
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.
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.
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: |
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 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
?)
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.
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.
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.
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.
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.
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.
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!
|
||
.. warning:: | ||
|
||
The "Assignment List" extension is not currently compatible with multiple |
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.
This part of the documentation is in particular still relevant.
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.
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 |
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.
From here on is also still relevant.
Go ahead and revert and I can address comments...sorry...
…On Thu, Dec 22, 2016 at 10:44 AM, Jessica B. Hamrick < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In nbgrader/apps/extensionapp.py
<#589 (review)>:
> - def start(self):
- if len(self.extra_args) == 0 or "create_assignment" in self.extra_args:
- self.log.info("Deactivating create_assignment nbextension")
- self.section = "notebook"
- self.toggle_nbextension("create_assignment/main")
-
- if sys.platform != 'win32' and (len(self.extra_args) == 0 or "assignment_list" in self.extra_args):
- self.log.info("Deactivating assignment_list server extension")
- self.disable_server_extension('nbgrader.nbextensions.assignment_list')
-
- self.log.info("Deactivating assignment_list nbextension")
- self.section = "tree"
- 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
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?
------------------------------
In nbgrader/apps/extensionapp.py
<#589 (review)>:
>
+To install for all users, replace `--sys-prefix` by `--system`.
What is the default if --sys-prefix is not included?
------------------------------
In nbgrader/apps/extensionapp.py
<#589 (review)>:
>
- flags = {}
- aliases = {}
+ $ jupyter nbextension install --sys-prefix --py nbgrader
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).
------------------------------
In nbgrader/docs/source/user_guide/advanced.rst
<#589 (review)>:
> @@ -11,71 +11,6 @@ Running nbgrader with JupyterHub
Please see :doc:`/configuration/jupyterhub_config`.
-.. _assignment-list-installation:
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?)
------------------------------
In nbgrader/docs/source/user_guide/advanced.rst
<#589 (review)>:
> -.. _assignment-list-installation:
-
-Installing the "Assignment List" plugin for all students on a server
---------------------------------------------------------------------
-
-.. seealso::
-
- :doc:`installation`
- General installation instructions.
-
- :doc:`managing_assignment_files`
- Details on fetching and submitting assignments using the "Assignment List" plugin.
-
-.. warning::
-
- The "Assignment List" extension is not currently compatible with multiple
This part of the documentation is in particular still relevant.
------------------------------
In nbgrader/docs/source/user_guide/advanced.rst
<#589 (review)>:
> -Then, you will need to activate the extension for each student:
-
-.. code:: bash
-
- # assuming the $USERS variable contains a list of all your students'
- # usernames, e.g. something like
- # USERS="jhamrick bitdiddle hacker"
- for user in $USERS; do
- cd /home/$user
- HOME=/home/$user sudo -E -u $user nbgrader extension activate assignment_list
- done
-
-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
From here on is also still relevant.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#589 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABr0LwOcPnxTIyB9Sgw3D7O8G2euJJBks5rKrcIgaJpZM4LTnsL>
.
--
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
bgranger@calpoly.edu and ellisonbg@gmail.com
|
reverted... |
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. |
@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`. |
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.
(This is where I mean that it says you can install for all users, but it doesn't explicitly mention enabling for all users)
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.
Yep, will clarify and expand this section as I know lots of folks deploying nbgrader want to do this stuff.
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.
Great, thanks!
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 😄 |
Fixes #576 and #499