Hi, apologies if this isn’t the right forum - I know discourse.jupyter.org is mostly for JupyterHub and Binder issues, but please point me in the right direction if there’s a better place for Jupyter and especially nbextension development.
I want to distribute my Jupyter nbextension package, let’s call it foobar
, with a simple pip install:
pip install foobar
My package includes an index.js file and notebook.json for Jupyter nbextension deployment. I’ve been able to get these included with python setup.py wheel
as follows:
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
include_package_data=True, # Includes everything in src/
Also, the .js/.json files are included in src/foobar. These need to be enabled post-install.
I’ve also tried following the guide here:
https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.html
However, this recommends using data_files
, which Ionel Mărieș says to avoid like the plague:
https://blog.ionelmc.ro/presentations/packaging/#slide:16
Can anyone recommend best practices around this? I’d like to have the package pip install
without sudo, and cross-platform ideally. However, it seems like the Jupyter link forces you to use --sys-prefix, which I’m not sure will always work, whereas --user should have no permissions issues (in theory).
Or, if not using data_files
, is there any way to enable the notebook extensions as part of pip install
, without the user requiring an extra step?
Thanks!
Vaughn