Skip to content

Commit

Permalink
Merge branch 'main' into release/0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
akaszynski committed Oct 31, 2023
2 parents e08f33b + 8353b0b commit cb7b8d6
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/cibuildwheel@v2.14.1
uses: pypa/cibuildwheel@v2.16.2

- uses: actions/upload-artifact@v3
with:
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black

Expand All @@ -27,12 +27,12 @@ repos:
]

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
args: ["--skip=*.vt*"]
Expand Down Expand Up @@ -62,11 +62,11 @@ repos:
)$
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.3
rev: 0.27.0
hooks:
- id: check-github-workflows

- repo: https://github.com/dzhu/rstfmt
rev: v0.0.13
rev: v0.0.14
hooks:
- id: rstfmt
14 changes: 10 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ array:
[ 0.56178033, -0.5952229 , 0.57455426],
[ 0.57455426, -0.56178033, 0.5952229 ]], dtype=float32)
>>> indices
array([ 0, 1, 2, ..., 3694, 3693, 3688], dtype=uint32)
array([[ 0, 1, 2],
[ 1, 3, 4],
[ 4, 5, 2],
...,
[9005998, 9005988, 9005999],
[9005999, 9005996, 9005995],
[9005998, 9005999, 9005995]], dtype=uint32)
In this example, ``vertices`` is a 2D NumPy array where each row
represents a vertex and the three columns represent the X, Y, and Z
Expand Down Expand Up @@ -88,7 +94,7 @@ Alternatively, you can load in the STL file as a PyVista PolyData:
***********

The main reason behind writing yet another STL file reader for Python is
to leverage the performant `libstl <https://github.com/aki5/libstl>`
to leverage the performant `libstl <https://github.com/aki5/libstl>`_
library.

Here are some timings from reading in a 1,000,000 point binary STL file:
Expand All @@ -98,7 +104,7 @@ Here are some timings from reading in a 1,000,000 point binary STL file:
+=============+=======================+
| stl-reader | 0.174 |
+-------------+-----------------------+
| numpy-stl | 0.201 (see note |
| numpy-stl | 0.201 (see note) |
+-------------+-----------------------+
| PyVista | 1.663 |
| (VTK) | |
Expand All @@ -111,7 +117,7 @@ Here are some timings from reading in a 1,000,000 point binary STL file:
Comparison with VTK
===================

Here's an additional benchmark comparing VTK with ``stl-reader``
Here's an additional benchmark comparing VTK with ``stl-reader``:

.. code:: python
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ filterwarnings = [

[tool.cibuildwheel]
archs = ["auto64"] # 64-bit only
skip = "pp* *musllinux*" # disable PyPy and musl-based wheels
skip = "cp36-* cp37-* pp* *musllinux*" # disable PyPy and musl-based wheels
test-requires = "pytest pyvista"
test-command = "pytest {project}/tests"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"Programming Language :: Python :: 3.11",
],
python_requires=">=3.8",
url="https://github.com/pyvista/pymeshfix",
url="https://github.com/pyvista/stl-reader",
# Build cython modules
ext_modules=cythonize(
[
Expand Down
6 changes: 4 additions & 2 deletions stl_reader/_stlfile_wrapper.pyx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# cython: language_level=3
# cython: boundscheck=False
# cython: wraparound=False
# cython: cdivision=True

# Import the Python-level symbols of numpy
import numpy as np
Expand Down Expand Up @@ -51,8 +55,6 @@ cdef class ArrayWrapper:
free(<void*>self.data_ptr)


@cython.boundscheck(False)
@cython.wraparound(False)
def get_stl_data(str filename):
cdef:
FILE *fp
Expand Down
10 changes: 8 additions & 2 deletions stl_reader/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _polydata_from_faces(points, faces):
import pyvista as pv
except ModuleNotFoundError:
raise ModuleNotFoundError(
"To use this functionality, install PyVista with\n\npipinstall pyvista"
"To use this functionality, install PyVista with\n\npip install pyvista"
)

from pyvista import ID_TYPE
Expand Down Expand Up @@ -83,7 +83,13 @@ def read(filename):
[ 0.56178033, -0.5952229 , 0.57455426],
[ 0.57455426, -0.56178033, 0.5952229 ]], dtype=float32)
>>> indices
array([ 0, 1, 2, ..., 3694, 3693, 3688], dtype=uint32)
array([[ 0, 1, 2],
[ 1, 3, 4],
[ 4, 5, 2],
...,
[9005998, 9005988, 9005999],
[9005999, 9005996, 9005995],
[9005998, 9005999, 9005995]], dtype=uint32)
"""
return _stlfile_wrapper.get_stl_data(filename)
Expand Down

0 comments on commit cb7b8d6

Please sign in to comment.