Skip to content

Commit 3191ea7

Browse files
authored
Merge pull request #2039 from mikedh/rc1
Release Candidate: 4.0.0rc1
2 parents 642241e + 6b3b83b commit 3191ea7

229 files changed

Lines changed: 12017 additions & 9783 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ USER user
6969
# install things like pytest
7070
RUN pip install -e .[all]
7171

72+
# check formatting
73+
RUN ruff trimesh
74+
RUN black --check trimesh
75+
7276
# run pytest wrapped with xvfb for simple viewer tests
7377
RUN xvfb-run pytest --cov=trimesh \
7478
-p no:ALL_DEPENDENCIES \

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
| :warning: WARNING |
99
|---------------------------|
10-
| `trimesh >= 4.0.0` on `main` makes minimum Python 3.7 and is in pre-release |
10+
| `trimesh >= 4.0.0` on `release-candidate` makes minimum Python 3.7 is in pre-release |
1111
| Testing with `pip install --pre trimesh` would be much appreciated! |
12-
| Projects that support Python<3.7 should update requirement to `trimesh<4` |
12+
| Projects that support `python<3.7` should update requirement to `trimesh<4` |
1313

1414

1515
Trimesh is a pure Python 3.7+ library for loading and using [triangular meshes](https://en.wikipedia.org/wiki/Triangle_mesh) with an emphasis on watertight surfaces. The goal of the library is to provide a full featured and well tested Trimesh object which allows for easy manipulation and analysis, in the style of the Polygon object in the [Shapely library](https://github.com/Toblerity/Shapely).

docker/vhacd.bash

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/conf.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def abspath(rel):
6161
# for a list of supported languages.
6262
# This is also used if you do content translation via gettext catalogs.
6363
# Usually you set "language" from the command line for these cases.
64-
language = None
64+
language = "en"
6565

6666
# List of patterns, relative to source directory, that match files and
6767
# directories to ignore when looking for source files.
@@ -79,17 +79,9 @@ def abspath(rel):
7979
# The theme to use for HTML and HTML Help pages
8080
html_theme = "furo"
8181

82-
# options for rtd-theme
82+
# options for furo
8383
html_theme_options = {
8484
"display_version": True,
85-
"prev_next_buttons_location": "bottom",
86-
"style_external_links": False,
87-
# toc options
88-
"collapse_navigation": True,
89-
"sticky_navigation": True,
90-
"navigation_depth": 4,
91-
"includehidden": True,
92-
"titles_only": False,
9385
}
9486

9587
# Add any paths that contain custom static files (such as style sheets) here,

docs/examples.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@
1111
import os
1212
import sys
1313

14-
log = logging.getLogger('trimesh')
14+
log = logging.getLogger("trimesh")
1515
log.addHandler(logging.StreamHandler(sys.stdout))
1616
log.setLevel(logging.DEBUG)
1717

1818
# current working directory
19-
pwd = os.path.abspath(os.path.expanduser(
20-
os.path.dirname(__file__)))
19+
pwd = os.path.abspath(os.path.expanduser(os.path.dirname(__file__)))
2120

2221
# where are our notebooks to render
23-
source = os.path.abspath(os.path.join(
24-
pwd, '..', 'examples'))
22+
source = os.path.abspath(os.path.join(pwd, "..", "examples"))
2523

2624
# which index file are we generating
27-
target = os.path.abspath(os.path.join(
28-
pwd, "examples.md"))
25+
target = os.path.abspath(os.path.join(pwd, "examples.md"))
2926

3027

3128
def extract_docstring(loaded):
@@ -45,21 +42,23 @@ def extract_docstring(loaded):
4542
Cleaned up docstring.
4643
"""
4744

48-
source = loaded['cells'][0]['source']
45+
source = loaded["cells"][0]["source"]
4946

5047
assert source[0].strip() == '"""'
5148
assert source[-1].strip() == '"""'
5249

53-
return ' '.join(i.strip() for i in source[1:-1])
50+
return " ".join(i.strip() for i in source[1:-1])
5451

5552

56-
if __name__ == '__main__':
57-
58-
markdown = ['# Examples',
59-
'Several examples are available as rendered IPython notebooks.', '', ]
53+
if __name__ == "__main__":
54+
markdown = [
55+
"# Examples",
56+
"Several examples are available as rendered IPython notebooks.",
57+
"",
58+
]
6059

6160
for fn in os.listdir(source):
62-
if not fn.lower().endswith('.ipynb'):
61+
if not fn.lower().endswith(".ipynb"):
6362
continue
6463
path = os.path.join(source, fn)
6564
with open(path) as f:
@@ -68,10 +67,10 @@ def extract_docstring(loaded):
6867
log.info(f'`{fn}`: "{doc}"\n')
6968
link = f'examples.{fn.split(".")[0]}.html'
7069

71-
markdown.append(f'### [{fn}]({link})')
70+
markdown.append(f"### [{fn}]({link})")
7271
markdown.append(doc)
73-
markdown.append('')
72+
markdown.append("")
7473

75-
final = '\n'.join(markdown)
76-
with open(target, 'w') as f:
74+
final = "\n".join(markdown)
75+
with open(target, "w") as f:
7776
f.write(final)
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,12 @@ if __name__ == '__main__':
7171
When you remove the embed and see the profile result you can then tweak the lines that are slow before finishing the function.
7272

7373
### Automatic Formatting
74-
Before opening a pull request I run some auto-formatting rules which will run autopep8 and yell at you about any `ruff` rule violations. There is a convenience script baked into `setup.py` to run all of these which you can run with:
74+
The only check in that's required to pass in CI is `ruff`, which I usually run with:
7575
```
76-
python setup.py --format
76+
ruff . --fix
7777
```
78+
It can fix a lot of formatting issues automatically. We also periodically run `black` to autoformat the codebase.
7879

79-
This is equivalent to running `codespell`, `autopep8`, and `flake8` on trimesh, examples, and tests. You can also run it yourself with these options:
80-
```
81-
autopep8 --recursive --verbose --in-place --aggressive trimesh
82-
flake8 trimesh
83-
```
8480

8581
## Docstrings
8682

File renamed without changes.

docs/install.md renamed to docs/guides/install.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If you\'d like most soft dependencies which should install cleanly on Mac, Windo
1818
pip install trimesh[easy]
1919
```
2020

21-
Or if you want the full experience, you can try the `all` extra, where packages may only be available for Linux:
21+
Or if you want the full experience, you can try the `all` extra which includes all the testing and recommended packages:
2222
```
2323
pip install trimesh[all]
2424
```
@@ -42,7 +42,7 @@ Ubuntu-Debian Notes
4242
Blender and openSCAD are soft dependencies used for boolean operations with subprocess, you can get them with `apt`:
4343

4444
```
45-
sudo apt-get install openscad blender
45+
sudo apt-get install blender
4646
```
4747

4848
Dependency Overview
@@ -54,31 +54,31 @@ Trimesh has a lot of soft-required upstream packages. We try to make sure they'r
5454
| Package | Description | Alternatives | Level |
5555
| ------ | --------- | ---------- | ----- |
5656
| `numpy` | The base container for fast array types. | | `required` |
57-
| `scipy` | Provides convex hulls (`scipy.spatial.ConvexHull`), fast graph operations (`scipy.sparse.csgraph`), fast nearest-point queries (`scipy.spatial.cKDTree`), b-spline evaluation (`scipy.interpolate`). | Nothing comes to mind, it does a whole heck of a lot. | `easy` |
57+
| `scipy` | Provides convex hulls (`scipy.spatial.ConvexHull`), fast graph operations (`scipy.sparse.csgraph`), fast nearest-point queries (`scipy.spatial.cKDTree`), b-spline evaluation (`scipy.interpolate`). | | `easy` |
5858
| `lxml` | Parse XML documents. We use this over the built-in ones as it was slightly faster, and there was a format implemented which was extremely annoying to handle without the ability to get parent nodes (which `lxml` has but built-in XML doesn't). | Standard library's XML | `easy` |
59-
| `networkx` | A nice-to-use pure Python graph library that's faster than you'd think. It implements DFS, BFS, and the usual FAANG-interview-question algorithms. A lot of the commonly run stuff in trimesh has been re-written to use `scipy.sparse.csgraph` as it's also an easy install and is way faster in most cases. But if you have a small-ish graph the API for `networkx` is way easier to "grok". | `graph-tool`, `scipy.sparse.csgraph` | `easy` |
60-
| `shapely` | Bindings to `GEOS` for 2D spatial stuff: "set-theoretic analysis and manipulation of planar features." It lets you offset, union, and query polygons nicely. | `clipper` maybe? | `easy` |
59+
| `networkx` | Pure Python graph library that's reasonably fast and has a nice API. `scipy.sparse.csgraph` is way faster in most cases but is hard to understand and doesn't implement as many algorithms. | `graph-tool`, `scipy.sparse.csgraph` | `easy` |
60+
| `shapely` | Bindings to `GEOS` for 2D spatial stuff: "set-theoretic analysis and manipulation of planar features" which lets you offset, union, and query polygons. | `clipper` | `easy` |
6161
| `rtree` | Query ND rectangles with a spatial tree for a "broad phase" intersection. Used in polygon generation ("given N closed curves which curve contains the other curve?") and as the broad-phase for the built-in-numpy slow ray query engine. | `fcl` maybe? | `easy` |
6262
|`requests`| Do network queries in `trimesh.exchange.load_remote`, will *only* make network requests when asked | | `easy`|
63-
|`sympy`| Evaluate symbolic algebra | | `easy`|
63+
|`sympy`| Evaluate symbolic algebra | | `recommend`|
6464
|`xxhash`| Quickly hash arrays, used for our cache checking | | `easy`|
65-
|`msgpack`| A serialization method that supports bytes-blobs. | `protobuf` | `easy`|
66-
|`chardet`| When we fail to decode text as UTF-8 we then check with chardet which guesses an encoding. This lets us load files even with weird encodings. | | `easy`|
65+
|`chardet`| When we fail to decode text as UTF-8 we then check with chardet which guesses an encoding, letting us load files even with weird encodings. | | `easy`|
6766
|`colorlog`| Printing logs with colors. | | `easy`|
68-
|`pillow`| Reading raster images for textures, and rendering polygons into raster images. | | `easy`|
67+
|`pillow`| Reading raster images for textures and render polygons into raster images. | | `easy`|
6968
|`svg.path`| Parsing SVG path strings. | | `easy`|
7069
|`jsonschema`| Validating our exports for formats like GLTF. | | `easy`|
7170
|`pycollada`| Parse `dae` files. | | `easy`|
72-
|`pyglet`| OpenGL bindings for our simple debug viewer. | | `easy`|
73-
|`xatlas`| Unwrap meshes to generate UV coordinates quickly and well. | | `all`|
74-
|`python-fcl`| Do collision queries between meshes | | `all`|
75-
|`glooey`| Provide a viewer with widgets. | | `all`|
76-
|`meshio`| Load additional mesh formats. | | `all`|
77-
|`scikit-image`| Used in voxel ops | | `all`|
78-
|`mapbox-earcut`| Triangulate 2D polygons | `triangle` which has an unusual license | `all`|
79-
|`psutil`| Get current memory usage, useful for checking to see if we're going to run out of memory instantiating a giant array | | `all`|
71+
|`pyglet<2`| OpenGL bindings for our simple debug viewer. | | `recommend`|
72+
|`xatlas`| Unwrap meshes to generate UV coordinates quickly and well. | | `recommend`|
73+
|`python-fcl`| Do collision queries between meshes | | `recommend`|
74+
|`glooey`| Provide a viewer with widgets. | | `recommend`|
75+
|`meshio`| Load additional mesh formats. | | `recommend`|
76+
|`scikit-image`| Used in voxel ops | | `recommend`|
77+
|`mapbox-earcut`| Triangulate 2D polygons | `triangle` which has an unusual license | `easy`|
78+
|`psutil`| Get current memory usage, useful for checking to see if we're going to run out of memory instantiating a giant array | | `recommend`|
8079
|`ruff`| A static code analyzer that replaces `flake8`. | `flake8` | `test`|
81-
|`autopep8`| A code formatter which fixes whitespace issues automatically. | | `test`|
80+
|`black`| A code formatter which fixes whitespace issues automatically. | | `test`|
8281
|`pytest`| A test runner. | | `test`|
8382
|`pytest-cov`| A plugin to calculate test coverage. | | `test`|
8483
|`pyinstrument`| A sampling based profiler for performance tweaking. | | `test`|
84+
|`pyvhacd`| A binding for VHACD which provides convex decompositions | | `recommend`|

docs/index.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
.. toctree::
2-
:maxdepth: 2
3-
41
.. include:: README.rst
52

63
Links
@@ -13,7 +10,7 @@ Install
1310
.. toctree::
1411
:maxdepth: 2
1512

16-
install.md
13+
guides/install.md
1714

1815
Examples
1916
==========
@@ -27,14 +24,14 @@ Contributing
2724
.. toctree::
2825
:maxdepth: 1
2926

30-
Contributing <contributing.md>
27+
Contributing <guides/contributing.md>
3128

3229
Docker
3330
==========
3431
.. toctree::
3532
:maxdepth: 1
3633

37-
Docker <docker.md>
34+
Docker <guides/docker.md>
3835

3936
API Reference
4037
=============

docs/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ recommonmark==0.7.1
33
jupyter==1.0.0
44

55
# get sphinx version range from furo install
6-
furo==2023.8.19
6+
furo==2023.9.10
77
myst-parser==2.0.0
88
pyopenssl==23.2.0
99
autodocsumm==0.2.11
1010
jinja2==3.1.2
11-
matplotlib==3.7.2
12-
nbconvert==7.7.4
11+
matplotlib==3.8.0
12+
nbconvert==7.8.0
1313

0 commit comments

Comments
 (0)