From 987248f56a46df35f553c5d999768438152dfbe0 Mon Sep 17 00:00:00 2001 From: phanirithvij Date: Fri, 30 Jan 2026 13:07:49 +0530 Subject: [PATCH] py3dtiles: init at 12.0.0 Co-authored-by: Ivan Mincik Co-authored-by: Augustin Trancart --- .../python-modules/py3dtiles/default.nix | 146 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 2 + 3 files changed, 150 insertions(+) create mode 100644 pkgs/development/python-modules/py3dtiles/default.nix diff --git a/pkgs/development/python-modules/py3dtiles/default.nix b/pkgs/development/python-modules/py3dtiles/default.nix new file mode 100644 index 000000000000..8a8ccfa66db1 --- /dev/null +++ b/pkgs/development/python-modules/py3dtiles/default.nix @@ -0,0 +1,146 @@ +{ + lib, + fetchpatch2, + fetchFromGitLab, + addBinToPathHook, + + buildPythonPackage, + + # build-system + setuptools, + setuptools-scm, + + # dependencies + lz4, + mapbox-earcut, + numba, + numpy, + psutil, + pygltflib, + pyproj, + pyzmq, + + # optional-dependencies + ifcopenshell, + lark, + laspy, + plyfile, + psycopg2-binary, + + # tests + pytest-benchmark, + pytest-cov-stub, + pytestCheckHook, + writeText, + moreutils, +}: + +buildPythonPackage (finalAttrs: { + pname = "py3dtiles"; + version = "12.0.0"; + pyproject = true; + + src = fetchFromGitLab { + owner = "py3dtiles"; + repo = "py3dtiles"; + tag = "v${finalAttrs.version}"; + hash = "sha256-m8c+g9XXbg9OSC+NNoQkw4RKXvNFRIPWkDjAs6oH3kc="; + }; + + patches = [ + # Remove in the next version + # Patch to avoid using pythonRelaxDeps + (fetchpatch2 { + url = "https://gitlab.com/py3dtiles/py3dtiles/-/commit/0f60691434b9ad4afebec29b2eedfcbbe0b8420d.patch"; + includes = [ "pyproject.toml" ]; + hash = "sha256-TLoKeltI1xxSONX0uu56HKl2fXzAp1ufunsBPRr5Pus="; + }) + ]; + + build-system = [ + setuptools + setuptools-scm + ]; + + dependencies = [ + lz4 + mapbox-earcut + numba + numpy + psutil + pygltflib + pyproj + pyzmq + ]; + + optional-dependencies = { + ifc = [ + ifcopenshell + lark + ]; + las = [ + laspy + ]; + ply = [ + plyfile + ]; + postgres = [ + psycopg2-binary + ]; + }; + + nativeCheckInputs = [ + pytestCheckHook + pytest-benchmark + pytest-cov-stub + moreutils # chronic + ]; + + checkInputs = with finalAttrs.passthru.optional-dependencies; ply ++ las ++ ifc; + + nativeInstallCheckInputs = [ + addBinToPathHook + ]; + + # from .gitlab-ci.yml + # note: nativeCheckInputs are also available for installCheckPhase + # chronic - runs a command quietly unless it fails + installCheckPhase = + let + testScript = writeText "test.py" /* py */ '' + from py3dtiles.tileset.utils import number_of_points_in_tileset + from pathlib import Path + exit(number_of_points_in_tileset(Path("3dtiles/tileset.json")) != 22300) + ''; + in + '' + runHook preInstallCheck + chronic py3dtiles info tests/fixtures/pointCloudRGB.pnts + chronic py3dtiles convert --out test1 ./tests/fixtures/simple.xyz + chronic py3dtiles convert --out test2 ./tests/fixtures/with_srs_3857.las + chronic py3dtiles convert tests/fixtures/simple.ply + chronic python ${testScript} + runHook pytestCheckPhase + runHook postInstallCheck + ''; + + # disable benchmarks to reduce load on the builder + pytestFlags = [ "--benchmark-disable" ]; + + pythonImportsCheck = [ + "py3dtiles" + ]; + + meta = { + changelog = "https://py3dtiles.org/main/changelog.html"; + description = "Python module to manage 3DTiles format"; + downloadPage = "https://gitlab.com/py3dtiles/py3dtiles"; + homepage = "https://py3dtiles.org"; + license = lib.licenses.asl20; + mainProgram = "py3dtiles"; + teams = with lib.teams; [ + geospatial + ngi + ]; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 66b9024e7295..c6c6d689b4d3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3286,6 +3286,8 @@ with pkgs; pulumiPackages = recurseIntoAttrs pulumi.pkgs; + py3dtiles = with python3Packages; toPythonApplication py3dtiles; + patch = gnupatch; pcscliteWithPolkit = pcsclite.override { diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ba7043d0f868..d8627025daec 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12969,6 +12969,8 @@ self: super: with self; { py3dns = callPackage ../development/python-modules/py3dns { }; + py3dtiles = callPackage ../development/python-modules/py3dtiles { }; + py3exiv2 = callPackage ../development/python-modules/py3exiv2 { inherit (pkgs) exiv2; }; py3langid = callPackage ../development/python-modules/py3langid { };