takluyver / cite2c

Citations in the Jupyter Notebook
MIT License
318 stars 35 forks source link

jupyterhub: hub-wide installation and/or hub compatibility #35

Open jlphillipsphd opened 6 years ago

jlphillipsphd commented 6 years ago

I have a jupyterhub installation serving single-user notebooks (wonderful tools!), and would like to have everyone be able to use cite2c for inline citations in their notebooks.

I guess my short question would be: Looking at the install.py script, it looks like it's only able to install for the local user? Is there any known way to install for all users under jupyterhub?

I realize they may need some local files installed in their accounts (like .cls files and such that are installed with zotero - which I have done for one user account for testing purposes). However, the handlers still don't seem to be working properly. Even if I use "python -m cite2c.install" as that user, the cite2c/zotero_oauth page doesn't load and results in a 404 response. I can get a little farther if I manually set up the cite2c.json file with my credentials, but the search gui isn't displaying correctly, and (even though I can get it to read my library, and insert the correct tag information) the citations don't get rendered inline nor in the bibliography. I don't understand the software enough to make any more headway at the moment, but if there are any suggestions on what might need to be altered, I might be able to make some more progress.

Sorry if this has already been addressed before, but I couldn't find any mention of cite2c being used with jupyterhub anywhere.

jlphillipsphd commented 6 years ago

One more thing: I can see in install.py that the user=True option is used throughout. Would a simple user=False option probably make this work?

Edit: Tried the above and installed via flit. Looks like the python bits started working now, so the cite2c/zotero_oauth now works! However, the rendering problems remain, and it appears that most of the js files are being requested at server root url (/) instead of using 'base_url' (which seems to be fine for the python scripts). For example, /nbextension is being used instead of /my/hub/user/uid/nbextension. So, I guess the question would be: what would I use in the js parts of the extension to get that url, or is that even possible? I would like to prepend that onto the jquery/ajax requests so that the other files (.css and .js) can be used.

Getting close now, any help would be greatly appreciated.

takluyver commented 6 years ago

Hi, you're the first person I've heard from trying to install cite2c with Jupyterhub - I'm excited to see it being used for a group like that.

The short answer is that I think modifying the install functions to use user=False should do what you need, so long as all your users are on the same filesystem (not in e.g. docker containers).

(If the users are in docker containers, then I expect it's just a case of installing and enabling cite2c inside the docker container)

There are four pieces I can think of that need to be in place for cite2c to work:

jlphillipsphd commented 6 years ago

Thanks for the info, I'll definitely be using it moving forward.

I made some progress getting cite2c to work with JupyterHub so that the extension can at least now be installed by each user locally. There were a couple of changes necessary to get it work, and those can be found here: #36 With the update, and with cite2c installed alongside JupyterHub, users are able to run 'python -m cite2c.install' from a terminal to activate the extension on a case-by-case basis.

I have not yet had luck getting the system-wide install to work. Setting user=False in the installation script seemed easy enough, but the files get copied to /usr/local/ instead of where the jupyterhub shared files seem to be located (I am using virtualenv). However, I will keep working on this and hopefully have something to contribute back soon...

jlphillipsphd commented 6 years ago

Given that I am also running JupyterLab on the same JupyterHub installation and that I am happy with the current way that cite2c works with JupyterHub now, I am thinking that putting more time into making cite2c compatible with JupyterLab/Hub might be a better use of time instead of the standard notebook server.

Currently, users can visit the standard server at /tree and use cite2c, but JupyterLab is just out of luck for now -> citations do not render (but that's pretty much expected since cite2c isn't compatible with JupyterLab yet).

Any thoughts or concerns about this?

TS-CUBED commented 5 years ago

Thanks for this plugin.

I use cite2c in jupyter notebook, and have tried to get it to work in jupyterhub. Reading this thread I thought the problems were fixed, but while I can get it installed and started, I do get the layout and (not) rendering problems mentioned in this thread: Installation issues:

After that the cite2c extension is loaded and shows the icons, but:

Should this work, or have I misinterpreted jlphillipsphd: "... and that I am happy with the current way that cite2c works with JupyterHub now,.." and it still only works in jupyter notebook? Or is my installation broken?