Skip to content

Commit

Permalink
Merge pull request #2188 from mikedh/type/all
Browse files Browse the repository at this point in the history
Run Beartype On All Tests
  • Loading branch information
mikedh authored Mar 25, 2024
2 parents 94b8cea + 8709cc2 commit 1fc240a
Show file tree
Hide file tree
Showing 41 changed files with 410 additions and 325 deletions.
21 changes: 8 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,18 @@ USER user
# install things like pytest
RUN pip install -e .[all]

# check formatting
RUN ruff trimesh



## TODO : get typeguard to pass on more/all of the codebase
## this is running on a very arbitrary subset right now!
RUN pytest \
--typeguard-packages=trimesh.scene,trimesh.base \
-p no:ALL_DEPENDENCIES \
-p no:INCLUDE_RENDERING \
-p no:cacheprovider tests/test_s*
# check for lint problems
RUN ruff check trimesh

# run a limited array of static type checks
# TODO : get this to pass on base
RUN pyright trimesh/base.py || true

# run pytest wrapped with xvfb for simple viewer tests
RUN xvfb-run pytest \
# print more columns so the short summary is usable
RUN COLUMNS=240 xvfb-run pytest \
--cov=trimesh \
--beartype-packages=trimesh \
-p no:ALL_DEPENDENCIES \
-p no:INCLUDE_RENDERING \
-p no:cacheprovider tests
Expand Down
10 changes: 5 additions & 5 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
pypandoc==1.12
pypandoc==1.13
recommonmark==0.7.1
jupyter==1.0.0

# get sphinx version range from furo install
furo==2023.9.10
furo==2024.1.29
myst-parser==2.0.0
pyopenssl==23.3.0
pyopenssl==24.1.0
autodocsumm==0.2.12
jinja2==3.1.3
matplotlib==3.8.2
nbconvert==7.14.1
matplotlib==3.8.3
nbconvert==7.16.2

18 changes: 13 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
[project]
name = "trimesh"
requires-python = ">=3.7"
version = "4.2.0"
version = "4.2.1"
authors = [{name = "Michael Dawson-Haggerty", email = "mikedh@kerfed.com"}]
license = {file = "LICENSE.md"}
description = "Import, export, process, analyze and view triangular meshes."
Expand All @@ -26,7 +26,8 @@ classifiers = [
"Topic :: Multimedia :: Graphics :: 3D Modeling"
]
urls = {Homepage = "https://github.com/mikedh/trimesh"}
dependencies = ["numpy"]

dependencies = ["numpy>=1.20"]

[project.readme]
file = "README.md"
Expand Down Expand Up @@ -91,22 +92,22 @@ recommend = [
"python-fcl", # do collision checks
"openctm", # load `CTM` compressed models
"cascadio", # load `STEP` files
"manifold3d>=2.3.0"
"manifold3d>=2.3.0" # do boolean operations
]

# this is the list of everything that is ever added anywhere
# mostly useful for getting our test coverage up
test = [
"pytest-cov",
"coveralls",
"mypy",
"pyright",
"ezdxf",
"pytest",
"pymeshlab",
"pyinstrument",
"matplotlib",
"ruff",
"typeguard>=4.1.2"
"pytest-beartype; python_version>='3.10'"
]

# requires pip >= 21.2
Expand Down Expand Up @@ -150,3 +151,10 @@ flake8-implicit-str-concat = {"allow-multiline" = false}
[tool.codespell]
skip = "*.js*,./docs/built/*,./docs/generate/*,./models*,*.toml"
ignore-words-list = "nd,coo,whats,bu,childs,mis,filetests"

[tool.mypy]
python_version = "3.8"
ignore_missing_imports = true
disallow_untyped_defs = false
disallow_untyped_calls = false
disable_error_code = ["method-assign"]
2 changes: 1 addition & 1 deletion tests/test_convex.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_convex(self):
(
False,
(
g.trimesh.creation.box(extents=(1, 1, 1))
g.trimesh.creation.box(extents=[1, 1, 1])
+ g.trimesh.creation.box(bounds=[[10, 10, 10], [12, 12, 12]])
),
),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_spheres(self):
assert g.np.allclose(radii, 1.0)

# test additional arguments
red_sphere = g.trimesh.creation.icosphere(face_colors=(1.0, 0, 0))
red_sphere = g.trimesh.creation.icosphere(face_colors=[1.0, 0, 0])
expected = g.np.full((len(red_sphere.faces), 4), (255, 0, 0, 255))
g.np.testing.assert_allclose(red_sphere.visual.face_colors, expected)

Expand Down
1 change: 1 addition & 0 deletions tests/test_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def test_mixed_units(self):

# mixed units should be None
s = g.trimesh.Scene([a, b])
assert len(s.geometry) == 2
assert s.units is None

# now all units should be meters and scene should report that
Expand Down
7 changes: 7 additions & 0 deletions tests/test_unwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ def test_image(self):
# make sure image was attached correctly
assert u.visual.material.image.size == image.size

def test_blender_unwrap(self):
if not g.trimesh.interfaces.blender.exists:
return
m = g.get_mesh("rabbit.obj")
# TODO : verify this returns geometry!
_todo = g.trimesh.interfaces.blender.unwrap(m)


if __name__ == "__main__":
g.trimesh.util.attach_to_log()
Expand Down
Loading

0 comments on commit 1fc240a

Please sign in to comment.