Skip to content

Commit 48350f7

Browse files
committed
merge with main; bump to v0.1.8
2 parents 5636287 + f22bd73 commit 48350f7

File tree

10 files changed

+147
-138
lines changed

10 files changed

+147
-138
lines changed

.github/workflows/testing-and-deployment.yml

Lines changed: 85 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
pull_request:
55
push:
66
tags:
7-
- "v*"
7+
- v*
88
branches:
9-
- main
9+
- main
1010

1111
# disable concurrent runs
1212
concurrency:
@@ -19,71 +19,71 @@ jobs:
1919
runs-on: ubuntu-latest
2020
name: Smoke Testing
2121
steps:
22-
- uses: actions/checkout@v4
23-
24-
- name: Set up Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version: "3.10"
28-
29-
- name: Install OS packages
30-
run: |
31-
sudo apt update
32-
sudo apt install libgl1-mesa-glx
33-
34-
- name: Build and validate wheel
35-
run: |
36-
pip install build twine
37-
python -m build
38-
twine check dist/*
39-
40-
- name: Install
41-
run: pip install dist/*.whl
42-
43-
- name: Test
44-
run: |
45-
pip install -r requirements_test.txt
46-
cd tests && python -m pytest -v
47-
48-
- name: Upload sdist
49-
uses: actions/upload-artifact@v4
50-
with:
51-
path: ./dist/*.tar.gz
52-
name: fast-simplification-sdist
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.10'
28+
29+
- name: Install OS packages
30+
run: |
31+
sudo apt update
32+
sudo apt install libgl1-mesa-glx
33+
34+
- name: Build and validate wheel
35+
run: |
36+
pip install build twine
37+
python -m build
38+
twine check dist/*
39+
40+
- name: Install
41+
run: pip install dist/*.whl
42+
43+
- name: Test
44+
run: |
45+
pip install -r requirements_test.txt
46+
cd tests && python -m pytest -v
47+
48+
- name: Upload sdist
49+
uses: actions/upload-artifact@v4
50+
with:
51+
path: ./dist/*.tar.gz
52+
name: fast-simplification-sdist
5353

5454
docs_build:
5555
name: Build Documentation
5656
runs-on: ubuntu-latest
5757
needs: smoke_testing
5858

5959
steps:
60-
- uses: actions/checkout@v4
61-
62-
- name: Setup Python
63-
uses: actions/setup-python@v5
64-
with:
65-
python-version: "3.10"
66-
67-
- name: Install OS packages
68-
run: |
69-
sudo apt update
70-
sudo apt install libgl1-mesa-glx xvfb
71-
72-
- name: Install library
73-
run: pip install .
74-
75-
- name: Build Documentation
76-
run: |
77-
pip install -r requirements_docs.txt
78-
xvfb-run make -C doc html
79-
80-
- name: Deploy on tag
81-
uses: JamesIves/github-pages-deploy-action@v4
82-
if: startsWith(github.ref, 'refs/tags/')
83-
with:
84-
token: ${{ secrets.GITHUB_TOKEN }}
85-
branch: gh-pages
86-
folder: doc/_build/html
60+
- uses: actions/checkout@v4
61+
62+
- name: Setup Python
63+
uses: actions/setup-python@v5
64+
with:
65+
python-version: '3.10'
66+
67+
- name: Install OS packages
68+
run: |
69+
sudo apt update
70+
sudo apt install libgl1-mesa-glx xvfb
71+
72+
- name: Install library
73+
run: pip install .
74+
75+
- name: Build Documentation
76+
run: |
77+
pip install -r requirements_docs.txt
78+
xvfb-run make -C doc html
79+
80+
- name: Deploy on tag
81+
uses: JamesIves/github-pages-deploy-action@v4
82+
if: startsWith(github.ref, 'refs/tags/')
83+
with:
84+
token: ${{ secrets.GITHUB_TOKEN }}
85+
branch: gh-pages
86+
folder: doc/_build/html
8787

8888
build_wheels:
8989
needs: smoke_testing
@@ -92,21 +92,21 @@ jobs:
9292
strategy:
9393
fail-fast: false
9494
matrix:
95-
os: [ubuntu-latest, windows-2019, macOS-latest]
95+
os: [ubuntu-latest, windows-2019, macos-14, macos-13]
9696

9797
steps:
98-
- uses: actions/checkout@v4
98+
- uses: actions/checkout@v4
9999

100-
- name: Build wheels
101-
uses: pypa/cibuildwheel@v2.16.5
100+
- name: Build wheels
101+
uses: pypa/cibuildwheel@v2.20.0
102102

103-
- name: List generated wheels
104-
run: ls ./wheelhouse/*
103+
- name: List generated wheels
104+
run: ls ./wheelhouse/*
105105

106-
- uses: actions/upload-artifact@v4
107-
with:
108-
path: ./wheelhouse/*.whl
109-
name: fast-simplification-wheel-${{ matrix.os }}
106+
- uses: actions/upload-artifact@v4
107+
with:
108+
path: ./wheelhouse/*.whl
109+
name: fast-simplification-wheel-${{ matrix.os }}
110110

111111
release:
112112
name: Release
@@ -118,18 +118,19 @@ jobs:
118118
url: https://pypi.org/p/fast-simplification
119119
permissions:
120120
id-token: write # this permission is mandatory for trusted publishing
121+
contents: write # required to create a release
121122
steps:
122-
- uses: actions/download-artifact@v4
123-
- name: Flatten directory structure
124-
run: |
125-
mkdir -p dist/
126-
find . -name '*.whl' -exec mv {} dist/ \;
127-
find . -name '*.tar.gz' -exec mv {} dist/ \;
128-
- name: Publish package distributions to PyPI
129-
uses: pypa/gh-action-pypi-publish@release/v1
130-
- name: Create GitHub Release
131-
uses: softprops/action-gh-release@v1
132-
with:
133-
generate_release_notes: true
134-
files: |
135-
./**/*.whl
123+
- uses: actions/download-artifact@v4
124+
- name: Flatten directory structure
125+
run: |
126+
mkdir -p dist/
127+
find . -name '*.whl' -exec mv {} dist/ \;
128+
find . -name '*.tar.gz' -exec mv {} dist/ \;
129+
- name: Publish package distributions to PyPI
130+
uses: pypa/gh-action-pypi-publish@release/v1
131+
- name: Create GitHub Release
132+
uses: softprops/action-gh-release@v1
133+
with:
134+
generate_release_notes: true
135+
files: |
136+
./**/*.whl

.pre-commit-config.yaml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.15
3+
rev: v0.6.1
44
hooks:
5-
- id: ruff
6-
args: [--fix, --exit-non-zero-on-fix]
7-
exclude: ^(docs/|tests)
8-
- id: ruff-format
5+
- id: ruff
6+
args: [--fix, --exit-non-zero-on-fix]
7+
exclude: ^(docs/|tests)
8+
- id: ruff-format
99

1010
- repo: https://github.com/pycqa/isort
1111
rev: 5.13.2
1212
hooks:
1313
- id: isort
1414

1515
- repo: https://github.com/codespell-project/codespell
16-
rev: v2.2.6
16+
rev: v2.3.0
1717
hooks:
1818
- id: codespell
19-
args: ["--toml", "pyproject.toml"]
20-
additional_dependencies: ["tomli"]
19+
args: [--toml, pyproject.toml]
20+
additional_dependencies: [tomli]
2121

2222
- repo: https://github.com/keewis/blackdoc
2323
rev: v0.3.9
2424
hooks:
2525
- id: blackdoc
26-
files: '\.py$'
26+
files: \.py$
2727

2828
# - repo: https://github.com/pycqa/pydocstyle
2929
# rev: 6.1.1
@@ -33,7 +33,7 @@ repos:
3333
# exclude: "tests/"
3434

3535
- repo: https://github.com/pre-commit/pre-commit-hooks
36-
rev: v4.5.0
36+
rev: v4.6.0
3737
hooks:
3838
- id: check-merge-conflict
3939
- id: debug-statements
@@ -42,8 +42,16 @@ repos:
4242
args: [--branch, main]
4343
- id: requirements-txt-fixer
4444

45+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
46+
rev: v2.14.0
47+
hooks:
48+
- id: pretty-format-toml
49+
args: [--autofix]
50+
- id: pretty-format-yaml
51+
args: [--autofix, --indent, '2']
52+
4553
# this validates our github workflow files
4654
- repo: https://github.com/python-jsonschema/check-jsonschema
47-
rev: 0.27.4
55+
rev: 0.29.1
4856
hooks:
49-
- id: check-github-workflows
57+
- id: check-github-workflows

examples/replay.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
This example shows how to replay a decimation sequence with replay.
66
77
"""
8+
89
from time import time
910

1011
import numpy as np

fast_simplification/_replay.pyx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def compute_indice_mapping(int[:, :] collapses, int n_points):
135135
cdef int i = 0
136136
cdef int j = 0
137137

138-
cdef long[:] application = np.zeros(n_points, dtype=int)
138+
cdef int[:] application = np.zeros(n_points, dtype=np.int32)
139139
for i in range(n_points):
140140
if j == len(keep):
141141
break
@@ -148,7 +148,7 @@ def compute_indice_mapping(int[:, :] collapses, int n_points):
148148
return indice_mapping
149149

150150

151-
def clean_triangles_and_edges(long[:, :] mapped_triangles, bool clean_edges=False):
151+
def clean_triangles_and_edges(int[:, :] mapped_triangles, bool clean_edges=False):
152152
"""Return the edges and triangles of a mesh from mapped triangles
153153
154154
Args:
@@ -164,8 +164,8 @@ def clean_triangles_and_edges(long[:, :] mapped_triangles, bool clean_edges=Fals
164164
cdef int n_edges = 0
165165
cdef int n_triangles = 0
166166
cdef int N = len(mapped_triangles)
167-
cdef long[:, :] edges_with_rep = np.zeros((N, 2), dtype=int)
168-
cdef long[:, :] triangles = np.zeros((N, 3), dtype=int)
167+
cdef int[:, :] edges_with_rep = np.zeros((N, 2), dtype=np.int32)
168+
cdef int[:, :] triangles = np.zeros((N, 3), dtype=np.int32)
169169

170170
for i in range(N):
171171
j = mapped_triangles[i, 0]
@@ -201,11 +201,11 @@ def clean_triangles_and_edges(long[:, :] mapped_triangles, bool clean_edges=Fals
201201
return np.asarray(edges_with_rep)[:n_edges, :], np.asarray(triangles)[:n_triangles, :]
202202

203203

204-
cdef long[:, :] edges = np.zeros((n_edges, 2), dtype=int)
204+
cdef int[:, :] edges = np.zeros((n_edges, 2), dtype=np.int32)
205205

206206

207207
# Lexicographic sort
208-
cdef long[:] order = np.lexsort((np.asarray(edges_with_rep[:n_edges, 1]), np.asarray(edges_with_rep[:n_edges, 0])))
208+
cdef int[:] order = np.lexsort((np.asarray(edges_with_rep[:n_edges, 1]), np.asarray(edges_with_rep[:n_edges, 0])))
209209
# Remove duplicates
210210
cdef int n_keep_edges = 1
211211
edges[0, :] = edges_with_rep[order[0], :]
@@ -216,4 +216,4 @@ def clean_triangles_and_edges(long[:, :] mapped_triangles, bool clean_edges=Fals
216216
n_keep_edges += 1
217217

218218

219-
return np.asarray(edges)[:n_keep_edges, :], np.asarray(triangles)[:n_triangles, :]
219+
return np.asarray(edges)[:n_keep_edges, :], np.asarray(triangles)[:n_triangles, :]

fast_simplification/_version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
version_info = 0, 27, 'dev0'
77
88
"""
9-
version_info = 0, 1, 7
9+
10+
version_info = 0, 1, 8
1011
__version__ = ".".join(map(str, version_info))

fast_simplification/simplify.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Simplification library."""
2+
23
import numpy as np
34

45
from . import _simplify
@@ -199,10 +200,7 @@ def simplify_mesh(mesh, target_reduction=None, target_count=None, agg=7, verbose
199200
"Please install pyvista to use this feature with:\n" "pip install pyvista"
200201
)
201202

202-
# installed by pyvista
203-
import numpy as np
204-
205-
n_faces = mesh.n_faces
203+
n_faces = mesh.n_cells
206204
_simplify.load_from_vtk(
207205
mesh.n_points,
208206
mesh.points.astype(np.float64, copy=False),

0 commit comments

Comments
 (0)