How can I build jupyter source code to wheel?

When I git clone source code from GitHub - jupyter/notebook: Jupyter Interactive Notebook,
and I followed these steps to build :slight_smile:
(1) conda env update --file binder/environment.yml
(2) conda activate notebook
(3) pip install -ve .
(4) jlpm run build
but when I ran “python setup.py build” or “python setup.py sdist” , it met errors:

(notebook) intel@intel:~/notebook$ python setup.py build

error: Multiple top-level packages discovered in a flat-layout: [‘app’, ‘binder’, ‘packages’, ‘notebook’, ‘buildutils’, ‘node_modules’].

To avoid accidental inclusion of unwanted files or directories,

setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages

on purpose, you should not rely on automatic discovery.

Instead, consider the following options:

  1. set up custom discovery (find directive with include or exclude)

  2. use a src-layout

  3. explicitly set py_modules or packages with a list of names

To find more information, look for “package discovery” on setuptools docs.

Who can kindly help me? @
krassowski
@ trungleduc

Instead of python setup.py build try:

conda install build hatch
python -m build
1 Like

Thank you @krassowski .I did it and it was success. I have another question maybe you can give me some help. If I modify some codes, do I need to re-run " jlpm run build" ? If miss this step and directly generate wheel , will the generated wheel contain the modified code and take effect?

It is unlikely that you got the latest code version one the wheel.

By default, we recommend cleaning the code directory before building the wheel to ensure it will rebuild the JavaScript files for the latest version.

You can clean the code using jlpm run clean:all or if you want to reset the git repository using git clean -dfx (be careful with the latter as it will delete all unversioned files).

1 Like