numpy-stl 4.0.0
Breaking: Python 3.9 and earlier are no longer supported (minimum is now Python 3.10), and the bundled
stl._speedupsCython extension has been removed. Install the optionalnumpy-stl[fast]extra to keep the C-accelerated ASCII reader/writer.
Fixed
- Binary STL triangle count is now read and written as the unsigned 32-bit integer the spec requires; counts with the high bit set no longer slip past the size check and silently read the whole file
- The
stl,stl2asciiandstl2bincommands work with piped stdin/stdout again: the std stream defaults now use the underlying binary buffers, and non-seekable streams are buffered so format auto-detection can rewind - ASCII STL output uses
{:.9g}formatting: float32 values round-trip exactly instead of values below 5e-7 being flattened to0.000000 save()no longer swallowsOSErrors; write failures (disk full, broken pipe) propagate instead of silently producing truncated outputtransform()now rotates the stored normals along with the verticestranslate(),transform()androtate_using_matrix()invalidate the cachedmin_/max_bounding boxremove_duplicate_polygonscompares full triangles instead of per-axis vertex sums; distinct triangles with equal sums are no longer dropped- PLY reader: elements declared before
vertexare skipped instead of being consumed as vertex data; scalar and extra list face properties around the vertex index list are consumed correctly; out-of-range and negative face indices raiseValueErrorinstead of crashing or wrapping around silently - PLY reader: vertex elements with list properties raise a descriptive
ValueErrorinstead ofKeyError: 'list' - 3MF loader raises descriptive
ValueErrors for missing vertex/triangle attributes and out-of-range vertex indices - The pure-Python ASCII reader no longer hits
RecursionErroron files with long runs of blank lines Mesh.from_file()on an empty file raises a descriptiveValueErrorinstead ofTypeErrorsave()/load()accept plain ints formodeand validate them asModevalues- Speedups are disabled automatically on non-seekable streams for both reading and writing (the C extension requires seekable files)
Changed
get_mass_properties()docs no longer claim aRuntimeErroris raised for open meshes; the actual behavior (warning + unreliable values) is documented- Publishing to PyPI is gated on the full CI test suite
- numpy dependency declares the tested lower bound (
numpy>=1.24) - The ASCII speedups are no longer bundled as a compiled Cython extension. Install the optional
numpy-stl[fast]extra (the externalspeedups>=2.0.0package) to enable them. Without it,speedups=Truetransparently falls back to the pure-Python reader/writer, so existing code keeps working — only the C-accelerated path now needs the extra.
Removed
- Support for Python 3.9 and earlier. The minimum supported version is now Python 3.10 (
requires-python = ">=3.10"); installing on older interpreters resolves to the previous release. - The bundled
stl._speedupsCython extension and its_speedups.pyxsource.import stl._speedupsno longer works; the acceleratedascii_read/ascii_writenow come from the externalspeedupspackage (see thenumpy-stl[fast]extra under Changed above).
Full changelog: v3.2.0...v4.0.0