Jupyterlab build from source: how to release it, say as a pip (or conda) package?

I am able to build jupyterlab from source (jlpm run build; jlpm run build:core; jupyter lab build all works). So I am attempting to run test: jlpm run build:testutils. It succeed to run a number of tests (except in the module @jupyterlab/services which timeout).

Now I am ready to release it such that I can install this jupyterlab build into different docker images or conda environments. Following the essence of this: https://github.com/jupyterlab/jupyterlab/blob/ad0f1a5bc745a32086403cb89b98f33c09756e98/RELEASE.md
0. In running jlpm bumpversion minor, it ran into module not found for dependency-graph. After npm installing it, it failed in git status --porcelain (as I am not using a git to github). So I skip this step.

  1. In running # npm run publish:all, which translates to node buildutils/lib/publish.js, I ran into
    Error: Cannot find module ‘dependency-graph’.
    So I fix by npm install ‘dependency-graph’. Then repeat the steps for sort-package-json then package-json.
  2. npm run publish:all

npm run clean:slate

@ clean:slate /src/jupyterlab-2.2.x
python clean.py && python -m pip install -v -e .

Found existing installation: jupyterlab 2.2.9
Uninstalling jupyterlab-2.2.9:
Successfully uninstalled jupyterlab-2.2.9
fatal: not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File “clean.py”, line 42, in
subprocess.check_call(git_clean_command, cwd=here)
File “/opt/conda/envs/jupyterlab-dev/lib/python3.6/subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘git’, ‘clean’, ‘-dfx’, ‘–exclude=.iml’, '–exclude=!packages/**/.iml’, ‘–exclude=!/node_modules//.iml’, ‘–exclude=.idea/’, ‘–exclude=!packages//.idea/’, '–exclude=!/node_modules/**/.idea/’, '–exclude=.code-workspace’, ‘–exclude=!packages//*.code-workspace’, '–exclude=!/node_modules//*.code-workspace’, ‘–exclude=.history’, '–exclude=!packages//.history’, ‘–exclude=!/node_modules//.history’, ‘–exclude=.vscode’, ‘–exclude=!packages//.vscode’, '–exclude=!/node_modules/**/.vscode’]’ returned non-zero exit status 128.
npm ERR! errno 1
npm ERR! @ clean:slate: python clean.py && python -m pip install -v -e .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ clean:slate script.

Any idea or suggestion in how to fix this?
Note that I just want to package the built source and release it into an installable package so that it can be installed by pip or by conda.
Thanks very much!!

I think I got further now, and be able to create a .whl for pip install.
Basically, I just follow the key steps in buildutils/src/publish.ts:

$ node buildutils/lib/update-core-mode.js # integrity check
$ python setup.py sdist # generate the tar gz
$ python setup.py bdist_wheel  # generate the .whl
$ python -m pip install -U twine # install twine package
$ twine check dist/* # check both .whl and targz in dist/

Need help!!

Unfortunately, the modified source code in the packages/*-extension/src/index.ts were not added to the generated sdist tar file and wheel file.

It just picked up what were in the staging/, and called webpack to generate the content in static/. The staging files were what was installed from standard npm install (and nothing from the modified dev source). What is needed is to propagate the changes in the dev source code to staging, and I cannot find any way to do it.

Does anyone know how to propagate the changes in source code (visible in jupyterlab --dev-mode) and propagate to staging/ (so that the changes can be packaged into a release wheel file)? Thanks!

Eventually, I found a solution, a rather hack: i just figure out which staging files corresponding to my dev source, and update those manually (through a script). Since I have only a few source code, this was not too bad.

See also my answer at your other post: Jupterlab source build - how are the content of directory staging/ got populated? - #4 by jasongrout