Skip to content

Commit ff6541e

Browse files
authored
Merge pull request #15 from mikedh/main
Build 3.12 Wheels And Update Pyproject
2 parents a147723 + d963c6c commit ff6541e

7 files changed

Lines changed: 77 additions & 49 deletions

File tree

.github/workflows/install-and-test.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,23 @@ jobs:
1010
build:
1111
strategy:
1212
matrix:
13-
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11]
14-
platform: [windows-latest, macos-latest, ubuntu-20.04]
13+
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
14+
platform: [windows-latest, macos-latest, ubuntu-22.04]
1515

1616
runs-on: ${{ matrix.platform }}
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
with:
2121
submodules: true
2222

2323
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip pytest trimesh wheel setuptools
31-
3228
- name: Build and install
33-
run: pip install --verbose .
29+
run: pip install --verbose .[test]
3430

3531
- name: Test
3632
run: pytest tests

.github/workflows/wheels.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
os: [ubuntu-latest, windows-latest, macOS-latest]
16+
os: [ubuntu-latest, windows-latest, macos-latest]
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
with:
2121
submodules: true
2222

2323
- name: Build wheels
24-
uses: pypa/cibuildwheel@v2.11.3
25-
env:
26-
# We don't support Python 2.7
27-
CIBW_SKIP: cp27-*
24+
uses: pypa/cibuildwheel@v2.16.5
2825
with:
2926
output-dir: wheelhouse
3027

@@ -36,11 +33,11 @@ jobs:
3633
name: Build SDist
3734
runs-on: ubuntu-latest
3835
steps:
39-
- uses: actions/checkout@v2
36+
- uses: actions/checkout@v3
4037
with:
4138
submodules: true
4239

43-
- uses: actions/setup-python@v2
40+
- uses: actions/setup-python@v4
4441

4542
- name: Install deps
4643
run: python -m pip install twine build
@@ -62,7 +59,7 @@ jobs:
6259
if: github.event_name == 'release' && github.event.action == 'published'
6360

6461
steps:
65-
- uses: actions/setup-python@v2
62+
- uses: actions/setup-python@v4
6663

6764
- uses: actions/download-artifact@v2
6865
with:

pyproject.toml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,32 @@ requires = [
55
"ninja; sys_platform != 'win32'",
66
"cmake>=3.12",
77
]
8-
build-backend = "setuptools.build_meta"
8+
build-backend = "setuptools.build_meta"
9+
10+
[project]
11+
name = "xatlas"
12+
requires-python = ">=3.7"
13+
version = "0.0.9"
14+
authors = [{name = "Markus Worchel", email = "m.worchel@campus.tu-berlin.de"}]
15+
license = {file = "LICENSE"}
16+
description = "Python bindings for xatlas"
17+
urls = {Homepage = "https://github.com/mworchel/xatlas-python"}
18+
dependencies = ["numpy"]
19+
20+
[project.readme]
21+
file = "README.md"
22+
content-type = "text/markdown"
23+
24+
[project.optional-dependencies]
25+
test = ["trimesh",
26+
"pytest"]
27+
28+
[tool.cibuildwheel]
29+
# Run the package tests on every wheel using `pytest`
30+
test-command = "pytest {package}/tests"
31+
32+
# will install pytest and other packages in the `test` extra
33+
test-extras = ["test"]
34+
35+
# Skip PyPy on Windows as it doesn't appear to have numpy wheels
36+
skip = ["pp*-win*", "*musllinux_i686"]

setup.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
# -*- coding: utf-8 -*-
44
import os
5-
from pathlib import Path
65
import sys
76
import subprocess
87

@@ -62,7 +61,6 @@ def build_extension(self, ext):
6261
cmake_args += ["-GNinja"]
6362

6463
else:
65-
6664
# Single config generators are handled "normally"
6765
single_config = any(x in cmake_generator for x in {"NMake", "Ninja"})
6866

@@ -100,22 +98,11 @@ def build_extension(self, ext):
10098
subprocess.check_call(
10199
["cmake", "--build", "."] + build_args, cwd=self.build_temp
102100
)
103-
104-
long_description = (Path(__file__).parent / "README.md").read_text()
105101

106-
# The information here can also be placed in setup.cfg - better separation of
102+
103+
# The information here can also be placed in pyproject.toml - better separation of
107104
# logic and declaration, and simpler if you include description/version in a file.
108105
setup(
109-
name="xatlas",
110-
version="0.0.8",
111-
description="Python bindings for xatlas",
112-
author="Markus Worchel",
113-
author_email="m.worchel@campus.tu-berlin.de",
114-
license='MIT',
115-
url='https://github.com/mworchel/xatlas-python',
116-
long_description=long_description,
117-
long_description_content_type='text/markdown',
118106
ext_modules=[CMakeExtension("xatlas")],
119107
cmdclass={"build_ext": CMakeBuild},
120-
zip_safe=False,
121108
)

tests/test_atlas.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import os
2+
13
import numpy as np
24
import pytest
35
import trimesh
46
import xatlas
57

8+
# current working directory
9+
cwd = os.path.abspath(os.path.expanduser(os.path.dirname(__file__)))
10+
11+
612
def test_add_mesh():
7-
mesh = trimesh.load_mesh("tests/data/00190663.obj")
13+
mesh = trimesh.load_mesh(os.path.join(cwd, "data", "00190663.obj"))
814

915
atlas = xatlas.Atlas()
1016

@@ -40,31 +46,38 @@ def test_add_mesh():
4046

4147
# Normals have wrong shape (first dimension)
4248
with pytest.raises(ValueError) as e:
43-
atlas.add_mesh(mesh.vertices, mesh.faces, np.random.rand(1, 3))
49+
atlas.add_mesh(mesh.vertices, mesh.faces, np.random.rand(1, 3))
4450
assert "first dimension" in str(e.value)
4551

4652
# UVs have wrong shape (number of dimensions)
4753
with pytest.raises(ValueError) as e:
48-
atlas.add_mesh(mesh.vertices, mesh.faces, mesh.vertex_normals, np.random.rand(1))
54+
atlas.add_mesh(
55+
mesh.vertices, mesh.faces, mesh.vertex_normals, np.random.rand(1)
56+
)
4957
assert "Nx2" in str(e.value)
5058

5159
# UVs have wrong shape (second dimension)
5260
with pytest.raises(ValueError) as e:
53-
atlas.add_mesh(mesh.vertices, mesh.faces, mesh.vertex_normals, np.random.rand(1, 1))
61+
atlas.add_mesh(
62+
mesh.vertices, mesh.faces, mesh.vertex_normals, np.random.rand(1, 1)
63+
)
5464
assert "Nx2" in str(e.value)
5565

5666
# UVs have wrong shape (first dimension)
5767
with pytest.raises(ValueError) as e:
58-
atlas.add_mesh(mesh.vertices, mesh.faces, mesh.vertex_normals, np.random.rand(1, 2))
68+
atlas.add_mesh(
69+
mesh.vertices, mesh.faces, mesh.vertex_normals, np.random.rand(1, 2)
70+
)
5971
assert "first dimension" in str(e.value)
6072

6173
# Index array references out-of-bounds vertices
6274
with pytest.raises(RuntimeError) as e:
6375
atlas.add_mesh(np.random.rand(1, 3), mesh.faces)
6476
assert "out of range" in str(e.value)
6577

78+
6679
def test_generate():
67-
mesh = trimesh.load_mesh("tests/data/00190663.obj")
80+
mesh = trimesh.load_mesh(os.path.join(cwd, "data", "00190663.obj"))
6881

6982
atlas = xatlas.Atlas()
7083
atlas.add_mesh(mesh.vertices, mesh.faces, mesh.vertex_normals)
@@ -85,11 +98,12 @@ def test_generate():
8598
assert uvs.shape == (18996, 2)
8699

87100
assert atlas.chart_count == 70
88-
assert atlas.width == 1057
89-
assert atlas.height == 1057
101+
assert atlas.width >= 900
102+
assert atlas.height >= 900
103+
90104

91105
def test_get_mesh():
92-
mesh = trimesh.load_mesh("tests/data/00190663.obj")
106+
mesh = trimesh.load_mesh(os.path.join(cwd, "data", "00190663.obj"))
93107

94108
atlas = xatlas.Atlas()
95109

@@ -106,4 +120,4 @@ def test_get_mesh():
106120

107121
with pytest.raises(IndexError) as e:
108122
atlas.get_mesh(1)
109-
assert "out of bounds" in str(e.value)
123+
assert "out of bounds" in str(e.value)

tests/test_functions.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
import pytest
1+
import os
22
import trimesh
33
import xatlas
44

5+
# current working directory
6+
cwd = os.path.abspath(os.path.expanduser(os.path.dirname(__file__)))
7+
8+
59
def test_parametrize():
6-
mesh = trimesh.load_mesh("tests/data/00190663.obj")
10+
mesh = trimesh.load_mesh(os.path.join(cwd, "data", "00190663.obj"))
711

8-
vmapping, indices, uvs = xatlas.parametrize(mesh.vertices, mesh.faces, mesh.vertex_normals)
12+
vmapping, indices, uvs = xatlas.parametrize(
13+
mesh.vertices, mesh.faces, mesh.vertex_normals
14+
)
915
assert vmapping.shape == (18996,)
1016
assert indices.shape == (32668, 3)
11-
assert uvs.shape == (18996, 2)
17+
assert uvs.shape == (18996, 2)

0 commit comments

Comments
 (0)