Files
2026-07-14 22:48:44 +00:00

85 lines
1.6 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
fetchNpmDeps,
# build-system
hatch-deps-selector,
hatch-jupyter-builder,
hatch-nodejs-version,
hatchling,
# nativeBuildInputs
nodejs,
npmHooks,
# dependencies
jupyter-core,
jupyter-server,
ipykernel,
nodeenv,
# tests
versionCheckHook,
}:
buildPythonPackage (finalAttrs: {
pname = "jupyter-book";
version = "2.1.6";
pyproject = true;
src = fetchFromGitHub {
owner = "jupyter-book";
repo = "jupyter-book";
tag = "v${finalAttrs.version}";
hash = "sha256-J0WzzKg46+0mvZ4goUPfkjO70HsAXQGv1JaoFs8JZ18=";
};
npmDeps = fetchNpmDeps {
inherit (finalAttrs) src;
hash = "sha256-y0QCZhsgcdFlgsjsCZFvLOQP27e5JD0QL0uP2XmpQEs=";
};
build-system = [
hatch-deps-selector
hatch-jupyter-builder
hatch-nodejs-version
hatchling
];
nativeBuildInputs = [
nodejs
npmHooks.npmConfigHook
];
# jupyter-book requires node at runtime
propagatedBuildInputs = [
nodejs
];
dependencies = [
ipykernel
jupyter-core
jupyter-server
nodeenv
];
pythonImportsCheck = [ "jupyter_book" ];
# No python tests
nativeCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = "--version";
meta = {
description = "Build a book with Jupyter Notebooks and Sphinx";
homepage = "https://jupyterbook.org/";
changelog = "https://github.com/jupyter-book/jupyter-book/blob/${finalAttrs.src.tag}/CHANGELOG.md";
license = lib.licenses.bsd3;
teams = [ lib.teams.jupyter ];
mainProgram = "jupyter-book";
};
})