Jupyter Packaging Utilities.
Low maintenance activity. Last release over 4 years ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
pip install jupyter-packagingJupyter Packaging
Tools to help build and install Jupyter Python packages that require a pre-build step that may include JavaScript build steps.
Install
pip install jupyter-packaging
Usage
There are three ways to use jupyter-packaging in another package.
In general, you should not depend on jupyter_packaging as a runtime dependency, only as a build dependency.
As a Build Requirement
Use a pyproject.toml file as outlined in pep-518.
An example:
[build-system]
requires = ["jupyter_packaging>=0.10,<2"]
build-backend = "setuptools.build_meta"
Below is an example setup.py using the above config.
It assumes the rest of your metadata is in setup.cfg.
We wrap the import in a try/catch to allow the file to be run without jupyter_packaging
so that python setup.py can be run directly when not building.
from setuptools import setup
try:
from jupyter_packaging import wrap_installers, npm_builder
builder = npm_builder()
cmdclass = wrap_installers(pre_develop=builder, pre_dist=builder)
except ImportError:
cmdclass = {}
setup(cmdclass=cmdclass))
As a Build Backend
Use the jupyter_packaging build backend.
The pre-build command is specified as metadata in pyproject.toml:
[build-system]
requires = ["jupyter_packaging>=0.10,<2"]
build-backend = "jupyter_packaging.build_api"
[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"
[tool.jupyter-packaging.build-args]
build_cmd = "build:src"
The corresponding setup.py would be greatly simplified:
from setuptools import setup
setup()
The tool.jupyter-packaging.builder section expects a func value that points to an importable
module and a function with dot separators. If not given, no pre-build function will run.
The optional tool.jupyter-packaging.build-args sections accepts a dict of keyword arguments to
give to the pre-build command.
The build backend does not handle the develop command (pip install -e .).
If desired, you can wrap just that command: