-
Notifications
You must be signed in to change notification settings - Fork 810
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
turn repo into a fully pip-installable package #671
Conversation
* make a proper package, which can therefore be installed * include package data * don't modify config as part of pip install, only do it as part of explicit script * add setup.cfg to support universal wheel builds
still to do:
|
So what is the best way to move this to jupyter-contrib ? Also todo (probably not in this PR, but needs to be done):
I could work on the first two bullet points. Also, we could autogenerate documentation from the md file. I believe you gave it a try before ? |
Not exactly sure what you mean by this - the md files generally are the documentation, as far as I can see? |
What I meant was to autogenerate a documentation like standard modules have, i.e. like HTML or PDF docs, usually generated by sphinx or so. |
oh, right! I guess this is what gets hosted at, e.g. http://jupyter-notebook.readthedocs.io? But yes, I'm sure we could autogenerate some of the |
I tried to get sphinx to autogenerate documentation from md files some time ago, but got stuck in path problems, i.e. getting sphinx to read from the nbextension directories and getting the graphics imported correctly. It should be doable, however. Now first things first, let's get this PR ready and the we will see, I guess. |
Btw. what is scripts/jupyter-contrib-nbextension for ? |
Ah, that's part of the new installation/configuration mechanism, for which I haven't yet written docs/readme. It makes the application callable as a
where the second part is basically just a wrapper around notebook's |
OK, thanks for the explanation. Sounds good. d:\source.local\IPython-notebook-extensions>jupyter contrib
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\jupyter-contrib-script.py", line 9, in <module>
load_entry_point('jupyter-contrib-core==0.3.0', 'console_scripts', 'jupyter-contrib')()
File "C:\Anaconda3\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Anaconda3\lib\site-packages\traitlets\config\application.py", line 594, in launch_instance
app = cls.instance(**kwargs)
File "C:\Anaconda3\lib\site-packages\traitlets\config\configurable.py", line 405, in instance
inst = cls(*args, **kwargs)
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_core-0.3.0-py3.5.egg\jupyter_contrib_core\application.p
y", line 27, in __init__
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_core-0.3.0-py3.5.egg\jupyter_contrib_core\application.p
y", line 43, in _refresh_subcommands
File "c:\anaconda3\envs\test\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2229, in load
File "c:\anaconda3\envs\test\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2235, in resolve
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\application.py", line 14, in <module>
from jupyter_contrib_nbextensions.install import install, uninstall
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\install.py", line 17, in <module>
import jupyter_contrib_nbextensions.nbconvert_support
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\nbconvert_support\__init__.py", line 11, in <module>
from .toc2 import TocExporter
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\nbconvert_support\toc2.py", line 16, in <module>
from jupyter_contrib_nbextensions.nbconvert_support import templates_directory
ImportError: cannot import name 'templates_directory' |
oh boo, this is something I broke in a rebase, I think. I haven't checked all my CI tests, so it's not surprising I missed something, I guess. I'll check it out now |
Yep, seems I accidentally introduced a circular import. I'll rebase to fix this... |
This is what I see when trying
C:\Anaconda3\envs\test\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'platform'
warnings.warn(msg)
(test) d:\source.local\IPython-notebook-extensions>jupyter contrib
Traceback (most recent call last):
File "C:\Anaconda3\envs\test\Scripts\jupyter-contrib-script.py", line 9, in <module>
load_entry_point('jupyter-contrib-core==0.3.0', 'console_scripts', 'jupyter-contrib')()
File "C:\Anaconda3\envs\test\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Anaconda3\envs\test\lib\site-packages\traitlets\config\application.py", line 594, in launch_instance
app = cls.instance(**kwargs)
File "C:\Anaconda3\envs\test\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_core-0.3.0-py3.5.egg\jupyter_contrib_core\application.p
y", line 27, in __init__
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_core-0.3.0-py3.5.egg\jupyter_contrib_core\application.p
y", line 43, in _refresh_subcommands
File "c:\anaconda3\envs\test\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2229, in load
File "c:\anaconda3\envs\test\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2235, in resolve
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\application.py", line 14, in <module>
from jupyter_contrib_nbextensions.install import install, uninstall
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\install.py", line 17, in <module>
import jupyter_contrib_nbextensions.nbconvert_support
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\nbconvert_support\__init__.py", line 10, in <module>
from .pre_svg2pdf import SVG2PDFPreprocessor
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\nbconvert_support\pre_svg2pdf.py", line 15, in <module>
import requests
ImportError: No module named 'requests'
(test) d:\source.local\IPython-notebook-extensions>jupyter contrib
Traceback (most recent call last):
File "C:\Anaconda3\envs\test\Scripts\jupyter-contrib-script.py", line 9, in <module>
load_entry_point('jupyter-contrib-core==0.3.0', 'console_scripts', 'jupyter-contrib')()
File "C:\Anaconda3\envs\test\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Anaconda3\envs\test\lib\site-packages\traitlets\config\application.py", line 594, in launch_instance
app = cls.instance(**kwargs)
File "C:\Anaconda3\envs\test\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_core-0.3.0-py3.5.egg\jupyter_contrib_core\application.p
y", line 27, in __init__
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_core-0.3.0-py3.5.egg\jupyter_contrib_core\application.p
y", line 43, in _refresh_subcommands
File "c:\anaconda3\envs\test\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2229, in load
File "c:\anaconda3\envs\test\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2235, in resolve
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\application.py", line 14, in <module>
from jupyter_contrib_nbextensions.install import install, uninstall
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\install.py", line 17, in <module>
import jupyter_contrib_nbextensions.nbconvert_support
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\nbconvert_support\__init__.py", line 11, in <module>
from .toc2 import TocExporter
File "C:\Users\hasch\AppData\Roaming\Python\Python35\site-packages\jupyter_contrib_nbextensions-0.0.0-py3.5.egg\jupyter_contrib_nbextensio
ns\nbconvert_support\toc2.py", line 16, in <module>
from jupyter_contrib_nbextensions.nbconvert_support import templates_directory
ImportError: cannot import name 'templates_directory' |
@juhasch sorry for silence on this, it's presumably a bunch of bugs I've fixed between the pippify branch (this PR) and my CI branch, which actually includes travis & appveyor testing, since the CI branch seems to work ok. I'll try to investigate soon. |
This a warning resulting from setuptools/distutils differences that I don't understand properly from googling it (everything I can find seems to say that it means you should have setuptools, but I already do, so I don't see how that can be the problem). At any rate, it doesn't actually cause any problems.
True, I've apparently fixed this in my CI branch through remaking the
this is just a side-effect of the |
No worries :-) So will you update this branch or is it better to try your CI branch ? |
mm, I don't mind really, but I guess merging my CI commits into my pippify branch might be the simplest. I have a couple of changes to the CI one to make first though, to check that migrating from the old repo works ok... |
* add function to find templates directory from nbconvert_support package * update config_scripts to use new package structure * update some readme files which refer to templates directory
based on a jupyter application calling notebook 4.2-style extension API methods Also make check for running server more robust
* tests on travis and appveyor via tox * codecov.yml for github status suppression
* consolidate common operations into functions * test imports in test_preprocessors * skip rather than fail on tests which require pandoc if we can't find it * move svg2pdf inkscape-finding into a function which doesn't raise exceptions, allowing us to skip test if inkscape can't be found, and skip accordingly * use urllib instead of requests in svg2pdf preprocessor * fix flake8 complaints
* fix repo URLs in setup.py * clarify separation of `jupyter_nbextensions_configurator` in readme * add reference to github view for viewing repository readmes * update readme with migration instructions * formatting update for notbook extension structure in readme
* fix urls for appveyor * move notes about custom installs after regualr instrucitons * number installation steps
ok, this seems to have all of its CI tests passing now. I've had a go at updating the readme too. |
More information can also be found in the | ||
[Wiki](https://github.com/ipython-contrib/IPython-notebook-extensions/wiki). | ||
|
||
|
||
The install process has two steps: | ||
|
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 we should first explain the installation approach, and then describe the steps in detail. How about this:
To install notebook extensions, three steps are required. First, this Python package needs to be installed. Then, the notebook extensions themselves can be copied to the Jupyter data directory.
Finally, the installed notebook extensions can be enabled, either by using built-in Jupyter commands, or more convenient by using the jupyter_nbextensions_configurator
server extension.
The Python package installation step is necessary to allow painless installation of the extensions togther with additional items like nbconvert templates, pre-/postprocessors, and exporters.
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.
Sure, sounds reasonable. So that would then replace the current bullet points, I guess? PR away 😉
Looks good. I think we should merge and rename the repo. |
This is really nice indeed! A big and great work! I have some improvements to |
Also, I was wondering whether it might be simpler to make the |
Not sure what you mean by entrypoints here @jfbercher, what exactly are you attempting to do? point me to a branch if you like 😄
I feel like that might get rather confusing for later merges... I guess you could open a PR against the main master, then you can always rebase your branch later to fix merges locally once this is merged, then force-push the rebased branch to update the PR automatically. I know rebases and forced updates are frowned upon from a git standpoint, but I feel like as long as you've warned people that the branch may be volatile, it's not a problem... |
I meant adding entry points in order to register the exporters with the package, thus enabling to call them with a custom short name. This is explained eg here. There is no urgency, I'll wait for the new repo. |
So let's merge. |
Turn setup.py into a proper setuptools installer
setup.py
&MANIFEST.in
to ensure all files are included as part of the packagejupyter contrib
subcommand to install/uninstall all of the nbextensions using jupyter's machinery (or the compatibility shims fromjupyter_contrib_core
for notebook versions < 4.2)