1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 pytestCheckHook,
7 pythonOlder,
8 numpy,
9 lxml,
10 trimesh,
11
12 # optional deps
13 colorlog,
14 manifold3d,
15 charset-normalizer,
16 jsonschema,
17 networkx,
18 svg-path,
19 pycollada,
20 shapely,
21 xxhash,
22 rtree,
23 httpx,
24 scipy,
25 pillow,
26 mapbox-earcut,
27 embreex,
28}:
29
30buildPythonPackage rec {
31 pname = "trimesh";
32 version = "4.8.3";
33 pyproject = true;
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchFromGitHub {
38 owner = "mikedh";
39 repo = "trimesh";
40 tag = version;
41 hash = "sha256-ywLbXOE3qO3+hrqy/+cVGZA4V202eHaMUnn3Wz1iNLI=";
42 };
43
44 build-system = [ setuptools ];
45
46 dependencies = [ numpy ];
47
48 optional-dependencies = {
49 easy = [
50 colorlog
51 manifold3d
52 charset-normalizer
53 lxml
54 jsonschema
55 networkx
56 svg-path
57 pycollada
58 shapely
59 xxhash
60 rtree
61 httpx
62 scipy
63 pillow
64 # vhacdx # not packaged
65 mapbox-earcut
66 ]
67 ++ lib.optionals embreex.meta.available [
68 embreex
69 ];
70 };
71
72 nativeCheckInputs = [
73 lxml
74 pytestCheckHook
75 ];
76
77 disabledTests = [
78 # requires loading models which aren't part of the Pypi tarball
79 "test_load"
80 ];
81
82 enabledTestPaths = [ "tests/test_minimal.py" ];
83
84 pythonImportsCheck = [
85 "trimesh"
86 "trimesh.ray"
87 "trimesh.path"
88 "trimesh.path.exchange"
89 "trimesh.scene"
90 "trimesh.voxel"
91 "trimesh.visual"
92 "trimesh.viewer"
93 "trimesh.exchange"
94 "trimesh.resources"
95 "trimesh.interfaces"
96 ];
97
98 meta = {
99 description = "Python library for loading and using triangular meshes";
100 homepage = "https://trimesh.org/";
101 changelog = "https://github.com/mikedh/trimesh/releases/tag/${src.tag}";
102 license = lib.licenses.mit;
103 mainProgram = "trimesh";
104 maintainers = with lib.maintainers; [
105 pbsds
106 ];
107 };
108}