python312Packages.pythreejs: init at 2.4.2

This commit is contained in:
Florian Klink 2025-04-29 13:14:45 +03:00
parent 9ea402c507
commit b6a2debd9f
3 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,67 @@
{
lib,
buildPythonPackage,
fetchPypi,
jupyterlab,
setuptools,
ipywidgets,
ipydatawidgets,
numpy,
traitlets,
}:
buildPythonPackage rec {
pname = "pythreejs";
version = "2.4.2";
pyproject = true;
# github sources need to invoke npm, but no package-lock.json present:
# https://github.com/jupyter-widgets/pythreejs/issues/419
src = fetchPypi {
inherit pname version;
hash = "sha256-pWi/3Ew3l8TCM5FYko7cfc9vpKJnsI487FEh4geLW9Y=";
};
build-system = [
jupyterlab
setuptools
];
# It seems pythonRelaxDeps doesn't work for these
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "jupyterlab~=" "jupyterlab>="
# https://github.com/jupyter-widgets/pythreejs/pull/420
substituteInPlace setupbase.py \
--replace-fail "import pipes" "" \
--replace-fail "pipes.quote" "shlex.quote"
'';
# Don't run npm install, all files are already where they should be present.
# If we would run npm install, npm would detect package-lock.json is an old format,
# and try to fetch more metadata from the registry, which cannot work in the sandbox.
setupPyBuildFlags = [ "--skip-npm" ];
dependencies = [
ipywidgets
ipydatawidgets
numpy
traitlets
];
# There are no tests
doCheck = false;
pythonImportsCheck = [ "pythreejs" ];
meta = {
description = "Interactive 3D graphics for the Jupyter Notebook and JupyterLab, using Three.js and Jupyter Widgets";
homepage = "https://github.com/jupyter-widgets/pythreejs";
changelog = "https://github.com/jupyter-widgets/pythreejs/releases/tag/${version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ flokli ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/setupbase.py b/setupbase.py
index 0ce0ac8..7762e23 100644
--- a/setupbase.py
+++ b/setupbase.py
@@ -659,7 +659,7 @@ def _translate_glob(pat):
translated_parts.append(_translate_glob_part(part))
os_sep_class = '[%s]' % re.escape(SEPARATORS)
res = _join_translated(translated_parts, os_sep_class)
- return '{res}\\Z(?ms)'.format(res=res)
+ return '(?ms){res}\\Z'.format(res=res)
def _join_translated(translated_parts, os_sep_class):

View file

@ -14363,6 +14363,8 @@ self: super: with self; {
pythran = callPackage ../development/python-modules/pythran { inherit (pkgs.llvmPackages) openmp; };
pythreejs = callPackage ../development/python-modules/pythreejs { };
pytibber = callPackage ../development/python-modules/pytibber { };
pytikz-allefeld = callPackage ../development/python-modules/pytikz-allefeld { };