Registry / web-framework / hatch-jupyter-builder

hatch-jupyter-builder

JSON →
library0.9.1pypypiunverified

Hatch Jupyter Builder is a Hatch plugin designed to streamline the building and packaging of Jupyter-related projects, such as JupyterLab extensions, JupyterLite applications, and kernels. It integrates frontend build steps (e.g., npm/yarn) directly into the Python packaging process, ensuring consistent builds and proper inclusion of static assets. The current version is 0.9.1, with a release cadence of regular patch and minor updates addressing bug fixes and enhancements.

pip install hatch hatch-jupyter-builder
INSTALL
IMPORT
SIG · HATCH-JUPYTER-BUIL
H
hatch-jupyter-builder
web-frameworkpythonv0.9.1
Install
7.4s avg
Import
Disk
76MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 73.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 7.4s · import 0.000s · 74MB
76MB installed
● package 76MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Configuration
This plugin is primarily configured via `pyproject.toml`, not typically imported directly in Python code.
Users enable and configure `hatch-jupyter-builder` by adding it to `build-system.requires` and defining options under `[tool.hatch.build.targets.wheel]` and `[tool.hatch.build.hooks.jupyter]`.

This `pyproject.toml` snippet demonstrates how to configure `hatch-jupyter-builder` for a project that includes a JavaScript/TypeScript frontend. It enables the 'jupyter' builder for wheel targets and defines a `jupyter` build hook to execute `npm` commands within a specified `build-dir`.

# pyproject.toml [build-system] requires = ["hatchling>=1.5", "hatch-jupyter-builder>=0.9.0"] build-backend = "hatchling.build" [project] name = "my-jupyter-pkg" version = "0.1.0" requires-python = ">=3.8" description = "A Jupyter package built with hatch-jupyter-builder." [tool.hatch.build.targets.wheel] builder = "jupyter" [tool.hatch.build.hooks.jupyter] # Directory containing package.json for frontend (relative to pyproject.toml) build-dir = "js" # Commands to run for frontend build npm = ["install", "run", "build"] # Files that must exist after the frontend build to indicate success # ensured-targets = [ # "my_jupyter_pkg/static/main.js" # ]
Debug
Known issues
breakingWhen migrating from older build systems like `jupyter_packaging` or manual `setup.py` scripts, `hatch-jupyter-builder` requires a complete re-evaluation of your `pyproject.toml` configuration. Direct translation of options is not always straightforward, especially for build hooks and asset inclusion.
fix
Refer to the `hatch-jupyter-builder` official documentation and examples for the equivalent `pyproject.toml` configuration tailored to your project's specific build requirements.
affects: all versions
gotchaIf your frontend assets are not being built or included in the final package, ensure that `builder = 'jupyter'` is correctly specified under `[tool.hatch.build.targets.wheel]` (and `sdist` if desired) and that `[tool.hatch.build.hooks.jupyter]` contains the correct `build-dir`, `npm` (or `yarn`) commands, and `ensured-targets` paths.
fix
Carefully review your `pyproject.toml` file, paying close attention to the `[tool.hatch.build.hooks.jupyter]` section. Verify that all paths (e.g., `build-dir`, `ensured-targets`) are correct relative to your `pyproject.toml` and that the specified frontend commands execute successfully in isolation.
affects: all versions
gotchaThe `optional-editable-build` feature, which can significantly improve local development workflows by avoiding unnecessary frontend rebuilds, was introduced in `hatch-jupyter-builder` version 0.8.0. Projects attempting to use this option with older plugin versions will encounter build failures.
fix
Upgrade `hatch-jupyter-builder` to version 0.8.0 or newer to utilize `optional-editable-build`. If upgrading is not possible, remove this option from your `pyproject.toml` configuration.
affects: <0.8.0
Upgrade
Version history
0.9.1latest on PyPI · released Mar 12, 2024
Audit
Dependencies
hatchrequiredHatch is the core build tool and ecosystem for which this is a plugin.
npmoptionalOften required for building JavaScript/TypeScript frontends if used with the 'npm' option.
yarnoptionalOften required for building JavaScript/TypeScript frontends if used with the 'yarn' option.
Agent activity
14 hits · last 30 days
node
14
Resources
hatch-jupyter-builder — pip install hatch-jupyter-builder · libregistry