Skip to content

Commit b6a2deb

Browse files
committed
python312Packages.pythreejs: init at 2.4.2
1 parent 9ea402c commit b6a2deb

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
lib,
3+
buildPythonPackage,
4+
fetchPypi,
5+
6+
jupyterlab,
7+
setuptools,
8+
9+
ipywidgets,
10+
ipydatawidgets,
11+
numpy,
12+
traitlets,
13+
}:
14+
15+
buildPythonPackage rec {
16+
pname = "pythreejs";
17+
version = "2.4.2";
18+
pyproject = true;
19+
20+
# github sources need to invoke npm, but no package-lock.json present:
21+
# https://github.com/jupyter-widgets/pythreejs/issues/419
22+
src = fetchPypi {
23+
inherit pname version;
24+
hash = "sha256-pWi/3Ew3l8TCM5FYko7cfc9vpKJnsI487FEh4geLW9Y=";
25+
};
26+
27+
build-system = [
28+
jupyterlab
29+
setuptools
30+
];
31+
32+
# It seems pythonRelaxDeps doesn't work for these
33+
postPatch = ''
34+
substituteInPlace pyproject.toml \
35+
--replace-fail "jupyterlab~=" "jupyterlab>="
36+
37+
# https://github.com/jupyter-widgets/pythreejs/pull/420
38+
substituteInPlace setupbase.py \
39+
--replace-fail "import pipes" "" \
40+
--replace-fail "pipes.quote" "shlex.quote"
41+
'';
42+
43+
# Don't run npm install, all files are already where they should be present.
44+
# If we would run npm install, npm would detect package-lock.json is an old format,
45+
# and try to fetch more metadata from the registry, which cannot work in the sandbox.
46+
setupPyBuildFlags = [ "--skip-npm" ];
47+
48+
dependencies = [
49+
ipywidgets
50+
ipydatawidgets
51+
numpy
52+
traitlets
53+
];
54+
55+
# There are no tests
56+
doCheck = false;
57+
58+
pythonImportsCheck = [ "pythreejs" ];
59+
60+
meta = {
61+
description = "Interactive 3D graphics for the Jupyter Notebook and JupyterLab, using Three.js and Jupyter Widgets";
62+
homepage = "https://github.com/jupyter-widgets/pythreejs";
63+
changelog = "https://github.com/jupyter-widgets/pythreejs/releases/tag/${version}";
64+
license = lib.licenses.bsd3;
65+
maintainers = with lib.maintainers; [ flokli ];
66+
};
67+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/setupbase.py b/setupbase.py
2+
index 0ce0ac8..7762e23 100644
3+
--- a/setupbase.py
4+
+++ b/setupbase.py
5+
@@ -659,7 +659,7 @@ def _translate_glob(pat):
6+
translated_parts.append(_translate_glob_part(part))
7+
os_sep_class = '[%s]' % re.escape(SEPARATORS)
8+
res = _join_translated(translated_parts, os_sep_class)
9+
- return '{res}\\Z(?ms)'.format(res=res)
10+
+ return '(?ms){res}\\Z'.format(res=res)
11+
12+
13+
def _join_translated(translated_parts, os_sep_class):

pkgs/top-level/python-packages.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14363,6 +14363,8 @@ self: super: with self; {
1436314363

1436414364
pythran = callPackage ../development/python-modules/pythran { inherit (pkgs.llvmPackages) openmp; };
1436514365

14366+
pythreejs = callPackage ../development/python-modules/pythreejs { };
14367+
1436614368
pytibber = callPackage ../development/python-modules/pytibber { };
1436714369

1436814370
pytikz-allefeld = callPackage ../development/python-modules/pytikz-allefeld { };

0 commit comments

Comments
 (0)