python3Packages.viser: 1.0.20 -> 1.0.27 + clean (#514883)

This commit is contained in:
Peder Bergebakken Sundt
2026-05-18 12:56:12 +00:00
committed by GitHub
@@ -1,13 +1,14 @@
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# nativeBuildInputs
nodejs,
fetchYarnDeps,
yarnConfigHook,
fetchNpmDeps,
npmHooks,
# build-system
hatchling,
@@ -15,79 +16,78 @@
# dependencies
imageio,
msgspec,
nodeenv,
numpy,
opencv-python,
plyfile,
psutil,
requests,
rich,
scikit-image,
scipy,
tqdm,
trimesh,
typing-extensions,
websockets,
yourdfpy,
zstandard,
# optional-dependencies
hypothesis,
liblzfse,
nodeenv,
opencv-python,
playwright,
pre-commit,
pandas,
psutil,
pyright,
pytest,
pytest-playwright,
pytest-xdist,
ruff,
gdown,
matplotlib,
pandas,
plotly,
# pyliblzfse,
plyfile,
robot-descriptions,
torch,
tyro,
# nativeCheckInputs
pytestCheckHook,
playwright-driver,
}:
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "viser";
version = "1.0.20";
version = "1.0.27";
pyproject = true;
src = fetchFromGitHub {
owner = "nerfstudio-project";
owner = "viser-project";
repo = "viser";
tag = "v${version}";
hash = "sha256-usnvEvuBNPrqRXV7jh0qw1ppmZgAe1CUhAwd/M5CvC0=";
tag = "v${finalAttrs.version}";
hash = "sha256-qE9V6KjniKm3vBtf5ger6UHob4go0wTaJnmYtvYqvMc=";
};
postPatch = ''
# prepare yarn offline cache
# prepare npm offline cache
mkdir -p node_modules
cd src/viser/client
cp package.json yarn.lock ../../..
cp package.json package-lock.json ../../..
ln -s ../../../node_modules
# fix: [vite-plugin-eslint] Failed to load config "react-app" to extend from.
substituteInPlace vite.config.mts --replace-fail \
"eslint({ failOnError: false, failOnWarning: false })," ""
cd ../../..
'';
nativeBuildInputs = [
yarnConfigHook
npmHooks.npmConfigHook
nodejs
];
yarnOfflineCache = fetchYarnDeps {
yarnLock = src + "/src/viser/client/yarn.lock";
hash = "sha256-4x+zJIqjVoKmEdOUPGpCuMmlRBfF++3oWtbNYAvd2ko=";
npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-${finalAttrs.version}-npm-deps";
src = finalAttrs.src + "/src/viser/client/";
hash = "sha256-fAFN/JCUVSvRDGfq39E3V+dhqp1i6vFG/j8wKmOva4c=";
};
preBuild = ''
cd src/viser/client
yarn --offline build
npm --offline run build
cd ../../..
'';
@@ -98,37 +98,39 @@ buildPythonPackage rec {
dependencies = [
imageio
msgspec
nodeenv
numpy
opencv-python
plyfile
psutil
requests
rich
scikit-image
scipy
tqdm
trimesh
typing-extensions
websockets
yourdfpy
zstandard
];
optional-dependencies = {
dev = [
hypothesis
nodeenv
opencv-python
playwright
pre-commit
psutil
pyright
pytest
pytest-playwright
pytest-xdist
ruff
];
examples = [
gdown
liblzfse
matplotlib
opencv-python
pandas
plotly
plyfile
# pyliblzfse
robot-descriptions
torch
tyro
@@ -137,18 +139,42 @@ buildPythonPackage rec {
nativeCheckInputs = [
hypothesis
playwright-driver
pytestCheckHook
];
# adding pre-commit here break PYTHONPATH in 3.14
checkInputs = lib.filter (p: p.pname != "pre-commit") finalAttrs.passthru.optional-dependencies.dev;
env = {
PLAYWRIGHT_BROWSERS_PATH = playwright-driver.browsers;
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = true;
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true;
};
disabledTestPaths = [
# too many flaky tests
"tests/e2e"
];
disabledTests = [
# assert 0 != 0
# (only when xdist)
"test_server_port_is_freed"
# counts ffmpeg pids, can be confused when
# building multiple times this package in parallel
"test_process_termination"
];
pythonImportsCheck = [
"viser"
];
meta = {
changelog = "https://github.com/nerfstudio-project/viser/releases/tag/${src.tag}";
description = "Web-based 3D visualization + Python";
homepage = "https://github.com/nerfstudio-project/viser";
changelog = "https://github.com/viser-project/viser/releases/tag/${finalAttrs.src.tag}";
description = "Web-based 3D visualization in Python";
homepage = "https://github.com/viser-project/viser";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ nim65s ];
};
}
})