11{
22 lib ,
33
4+ stdenv ,
45 buildPythonPackage ,
56 fetchFromGitHub ,
67
78 # nativeBuildInputs
89 nodejs ,
9- fetchYarnDeps ,
10- yarnConfigHook ,
10+ fetchNpmDeps ,
11+ npmHooks ,
1112
1213 # build-system
1314 hatchling ,
1415
1516 # dependencies
1617 imageio ,
1718 msgspec ,
18- nodeenv ,
1919 numpy ,
20- opencv-python ,
21- plyfile ,
22- psutil ,
2320 requests ,
2421 rich ,
25- scikit-image ,
26- scipy ,
2722 tqdm ,
2823 trimesh ,
2924 typing-extensions ,
3025 websockets ,
3126 yourdfpy ,
27+ zstandard ,
3228
3329 # optional-dependencies
3430 hypothesis ,
31+ liblzfse ,
32+ nodeenv ,
33+ opencv-python ,
34+ playwright ,
3535 pre-commit ,
36- pandas ,
36+ psutil ,
3737 pyright ,
3838 pytest ,
39+ pytest-playwright ,
40+ pytest-xdist ,
3941 ruff ,
4042 gdown ,
4143 matplotlib ,
44+ pandas ,
4245 plotly ,
43- # pyliblzfse ,
46+ plyfile ,
4447 robot-descriptions ,
4548 torch ,
4649 tyro ,
4750
4851 # nativeCheckInputs
4952 pytestCheckHook ,
53+ playwright-driver ,
5054} :
5155
52- buildPythonPackage rec {
56+ buildPythonPackage ( finalAttrs : {
5357 pname = "viser" ;
54- version = "1.0.20 " ;
58+ version = "1.0.27 " ;
5559 pyproject = true ;
5660
5761 src = fetchFromGitHub {
58- owner = "nerfstudio -project" ;
62+ owner = "viser -project" ;
5963 repo = "viser" ;
60- tag = "v${ version } " ;
61- hash = "sha256-usnvEvuBNPrqRXV7jh0qw1ppmZgAe1CUhAwd/M5CvC0 =" ;
64+ tag = "v${ finalAttrs . version } " ;
65+ hash = "sha256-qE9V6KjniKm3vBtf5ger6UHob4go0wTaJnmYtvYqvMc =" ;
6266 } ;
6367
6468 postPatch = ''
65- # prepare yarn offline cache
69+ # prepare npm offline cache
6670 mkdir -p node_modules
6771 cd src/viser/client
68- cp package.json yarn. lock ../../..
72+ cp package.json package- lock.json ../../..
6973 ln -s ../../../node_modules
70-
71- # fix: [vite-plugin-eslint] Failed to load config "react-app" to extend from.
72- substituteInPlace vite.config.mts --replace-fail \
73- "eslint({ failOnError: false, failOnWarning: false })," ""
74-
7574 cd ../../..
7675 '' ;
7776
7877 nativeBuildInputs = [
79- yarnConfigHook
78+ npmHooks . npmConfigHook
8079 nodejs
8180 ] ;
8281
83- yarnOfflineCache = fetchYarnDeps {
84- yarnLock = src + "/src/viser/client/yarn.lock" ;
85- hash = "sha256-4x+zJIqjVoKmEdOUPGpCuMmlRBfF++3oWtbNYAvd2ko=" ;
82+ npmDeps = fetchNpmDeps {
83+ name = "${ finalAttrs . pname } -${ finalAttrs . version } -npm-deps" ;
84+ src = finalAttrs . src + "/src/viser/client/" ;
85+ hash = "sha256-fAFN/JCUVSvRDGfq39E3V+dhqp1i6vFG/j8wKmOva4c=" ;
8686 } ;
8787
8888 preBuild = ''
8989 cd src/viser/client
90- yarn --offline build
90+ npm --offline run build
9191 cd ../../..
9292 '' ;
9393
@@ -98,37 +98,39 @@ buildPythonPackage rec {
9898 dependencies = [
9999 imageio
100100 msgspec
101- nodeenv
102101 numpy
103- opencv-python
104- plyfile
105- psutil
106102 requests
107103 rich
108- scikit-image
109- scipy
110104 tqdm
111105 trimesh
112106 typing-extensions
113107 websockets
114108 yourdfpy
109+ zstandard
115110 ] ;
116111
117112 optional-dependencies = {
118113 dev = [
119114 hypothesis
115+ nodeenv
116+ opencv-python
117+ playwright
120118 pre-commit
119+ psutil
121120 pyright
122121 pytest
122+ pytest-playwright
123+ pytest-xdist
123124 ruff
124125 ] ;
125126 examples = [
126127 gdown
128+ liblzfse
127129 matplotlib
130+ opencv-python
128131 pandas
129132 plotly
130133 plyfile
131- # pyliblzfse
132134 robot-descriptions
133135 torch
134136 tyro
@@ -137,18 +139,42 @@ buildPythonPackage rec {
137139
138140 nativeCheckInputs = [
139141 hypothesis
142+ playwright-driver
140143 pytestCheckHook
141144 ] ;
142145
146+ # adding pre-commit here break PYTHONPATH in 3.14
147+ checkInputs = lib . filter ( p : p . pname != "pre-commit" ) finalAttrs . passthru . optional-dependencies . dev ;
148+
149+ env = {
150+ PLAYWRIGHT_BROWSERS_PATH = playwright-driver . browsers ;
151+ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = true ;
152+ PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true ;
153+ } ;
154+
155+ disabledTestPaths = [
156+ # too many flaky tests
157+ "tests/e2e"
158+ ] ;
159+ disabledTests = [
160+ # assert 0 != 0
161+ # (only when xdist)
162+ "test_server_port_is_freed"
163+
164+ # counts ffmpeg pids, can be confused when
165+ # building multiple times this package in parallel
166+ "test_process_termination"
167+ ] ;
168+
143169 pythonImportsCheck = [
144170 "viser"
145171 ] ;
146172
147173 meta = {
148- changelog = "https://github.com/nerfstudio -project/viser/releases/tag/${ src . tag } " ;
149- description = "Web-based 3D visualization + Python" ;
150- homepage = "https://github.com/nerfstudio -project/viser" ;
174+ changelog = "https://github.com/viser -project/viser/releases/tag/${ finalAttrs . src . tag } " ;
175+ description = "Web-based 3D visualization in Python" ;
176+ homepage = "https://github.com/viser -project/viser" ;
151177 license = lib . licenses . asl20 ;
152178 maintainers = with lib . maintainers ; [ nim65s ] ;
153179 } ;
154- }
180+ } )
0 commit comments