[build-system]
build-backend = "setuptools.build_meta"
requires = ["setuptools >= 61.0", "wheel"]

[project]
name = "trimesh"
requires-python = ">=3.8"
version = "4.12.1"
authors = [{name = "Michael Dawson-Haggerty", email = "mikedh@kerfed.com"}]
license = {file = "LICENSE.md"}
description = "Import, export, process, analyze and view triangular meshes."
keywords = ["graphics", "mesh", "geometry", "3D"]
classifiers = [
    "Development Status :: 4 - Beta",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Natural Language :: English",
    "Topic :: Scientific/Engineering",
    "Topic :: Multimedia :: Graphics",
    "Topic :: Multimedia :: Graphics :: 3D Modeling"
]
dependencies = ["numpy>=1.20"]

[project.urls]
homepage = "https://github.com/mikedh/trimesh"
documentation = "https://trimesh.org"

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.scripts]
trimesh = "trimesh:__main__.main"

[tool.setuptools]
packages = [
    "trimesh",
    "trimesh.ray",
    "trimesh.path",
    "trimesh.path.exchange",
    "trimesh.scene",
    "trimesh.voxel",
    "trimesh.visual",
    "trimesh.viewer",
    "trimesh.exchange",
    "trimesh.exchange.gltf",
    "trimesh.resources",
    "trimesh.interfaces",
]
include-package-data = false

[tool.setuptools.package-data]
trimesh = [
    "resources/templates/*",
    "resources/*.json*",
    "resources/schema/*",
    "resources/schema/primitive/*.json",
    "resources/*.zip",
]

[project.optional-dependencies]

# this is the base extra most users will want
easy = [
    "colorlog",
    "manifold3d>=2.3.0; python_version<'3.14'", # TODO : waiting on 314 wheels
    "charset-normalizer",
    "lxml",
    "jsonschema",
    "networkx",
    "svg.path",
    "pycollada <= 0.9.0; python_version<'3.9'",
    "pycollada; python_version>='3.9'",
    "shapely",
    "xxhash",
    "rtree",
    "httpx",
    "scipy",
    "embreex",
    "pillow",
    "vhacdx; python_version>='3.9'",
    # old versions of mapbox_earcut produce incorrect values on numpy 2.0
    "mapbox_earcut >= 1.0.2; python_version>='3.9'",
]

recommend = [
    "sympy",
    "pyglet<2",
    "scikit-image",
    "fast-simplification",
    "python-fcl", # do collision checks
    "cascadio", # load `STEP` files
    "manifold3d>=2.3.0; python_version>='3.14'", # TODO : waiting on 314 wheels
]

# stuff to run simple testing
test = [
    "pytest-cov",
    "pytest",
    "pyinstrument",
    "ruff",
]

# this is the list of everything that is ever added anywhere
# mostly useful for getting our test coverage up but may not
# be easy to install on all platforms and is only really
# a good idea in our "cannonical docker images"
test_more = [
    "coveralls",  # report test coverage
    "ezdxf",      # compare our DXF loading with theirs
    "meshio",     # load some FEA-adjacent format s
    "xatlas",     # provide unwrapping for texturing
    "pytest-beartype; python_version>='3.10'", # fail on bad type hints
    "matplotlib", # compare our color maps with theirs
    "pymeshlab; python_version<'3.14'", # compare our vertex counts
    "triangle; python_version<'3.14'",  # polygon tesselator
    "ipython",  # check the notebook stuff
    "marimo",   # different notebook stuff
]

# openctm will be fully removed sometime after June 2026
# as it is unmaintained, wasn't used widely and was inflicting
# a support burden on upstream package management
deprecated = ["openctm"]

# requires pip >= 21.2
# https://hynek.me/articles/python-recursive-optional-dependencies/
all = ["trimesh[easy,recommend,test,test_more,deprecated]"]

[tool.ruff]
target-version = "py38"
line-length = 90

[tool.ruff.lint]
select = [
    "B", # bugbear
    "C", # comprehensions
    "E", # style errors
    "F", # flakes
    "I", # import sorting
    "RUF", # ruff specific rules
    "UP", # upgrade
    "W", # style warnings
    "YTT", # sys.version
    "ISC001",
    "ISC002",
    "NPY201",
    "T20", # flake8-print: catches stray `print`/`pprint` debug calls
    "TID251"
]

ignore = [
  "C901", # Comprehension is too complex (11 > 10)
  "N802", # Function name should be lowercase
  "N806", # Variable in function should be lowercase
  "E501", # Line too long ({width} > {limit} characters)
  "B904", # raise ... from err
  "B905", # zip() without an explicit strict= parameter
  "RUF005", # recommends non-type-aware expansion
]

# don't allow implicit string concatenation
flake8-implicit-str-concat = {"allow-multiline" = false}

# ban debug and usually-a-bug imports in `trimesh` core library
[tool.ruff.lint.per-file-ignores]
# examples/tests/helpers/docs are allowed to print demo / diagnostic output
"{examples,tests,helpers,docs}/*" = ["T20", "TID251"]

[tool.ruff.lint.flake8-tidy-imports.banned-api]
"IPython.embed".msg = "you forgot to remove a debug embed ;)"
"matplotlib".msg = "you forgot to remove a debug plot"
"numpy.empty".msg = "uninitialized arrays are haunted: try numpy.zeros"
"numpy.empty_like".msg = "uninitialized arrays are haunted: try numpy.zeros"

[tool.codespell]
skip = "*.js*,./docs/built/*,./docs/generate/*,./models*,*.toml"
ignore-words-list = "nd,coo,whats,bu,childs,mis,filetests"
