How to configure setup.py for server extension and nbextension

15 views
Skip to first unread message

Adam Rule

unread,
Jun 23, 2017, 3:23:50 PM6/23/17
to Project Jupyter
Hi,

I am following the instructions in the documentation for distributing a server extension and nbextension in a single python module and am having difficulty getting my nbextension .js files to install when I run `python setup.py install`. I think I need to do something in my setup.py or Manifest.in file to tell the module to include the .js files in my static/ folder, but I have so far been unsuccessful in doing so. When I manually copy the static/ folder into my module's folder in site-packages, the rest of the installation works wonderfully, but this should be automated.

How do I inform the module that it needs to include the .js files in the static/ folder? Also, can the documentation be updated with a template setup.py file?


Much thanks!

Adam Rule

unread,
Jun 23, 2017, 5:36:44 PM6/23/17
to Project Jupyter
I think I have resolved the issue using package_data. The following code needed to be included in the setup.py script.  See https://docs.python.org/3.6/distutils/setupscript.html#installing-package-data

setup(
    ...
    package_dir={'mypkg': 'mypkg'},
    package_data={'mypkg': ['static/*.js']}
)

Let me know if this is the desired configuration of the setup.py file. If so I can sumbit a pull request on the appropriate doc, which I believe is https://github.com/jupyter/notebook/blob/e1e760367d3dfd10aa128584dd6be8ea54da64ec/docs/source/examples/Notebook/Distributing%20Jupyter%20Extensions%20as%20Python%20Packages.ipynb
Reply all
Reply to author
Forward
0 new messages