MeshContract
Requirements-as-code for 3D assets. Think ESLint or a test suite, but for 3D assets.
Describe geometry limits in YAML and check Wavefront OBJ files from the command line. MeshContract returns a CI-friendly exit code and can emit text or JSON.
Installation
Python 3.11 or newer is required. MeshContract is not published on PyPI yet.
Install the current source from GitHub:
python -m pip install "git+https://github.com/Ikonido/MeshContract.git@main"
For local development, clone the repository and install it in editable mode:
git clone https://github.com/Ikonido/MeshContract.git
cd MeshContract
python -m pip install -e '.[dev]'
Quick start
meshcontract check examples/example.obj --contract examples/.meshcontract.yml
Text is the default output and remains suitable for interactive use:
Model: examples/example.obj
Vertices: 8
Faces: 6
Triangles: 12
Dimensions: width=2.000 m, length=4.000 m, height=3.000 m
PASS — contract satisfied
For scripts and CI, request stable JSON output:
meshcontract check examples/example.obj --contract examples/.meshcontract.yml --format json
{
"meshcontract_version": "0.2.0",
"status": "pass",
"model": "examples/example.obj",
"metrics": {
"vertices": 8,
"faces": 6,
"triangles": 12,
"dimensions_m": {
"width": 2.0,
"length": 4.0,
"height": 3.0
}
},
"violations": []
}
YAML contract
version: 1
geometry:
max_triangles: 30000
max_vertices: 25000
max_width_m: 17
max_height_m: 20
max_length_m: 70
allow_ngons: false
All limits are optional. A face with n vertices contributes n - 2 to the virtual triangle count; the OBJ file is not changed. An n-gon means a face with more than four vertices, so quads are allowed when allow_ngons is false.
OBJ does not define a universal unit or axis convention. MeshContract treats coordinate values as meters and maps X to width, Y to length, and Z to height. Export models using that convention, or transform them before checking.
CI / GitHub Actions
Exit codes are stable for CI: 0 means the contract passed, 1 means one or more contract violations, and 2 means invalid input, an invalid contract, or an unsupported model format. A non-zero code fails a GitHub Actions step by default.
The repository includes a copyable GitHub Actions workflow example. Copy it to .github/workflows/ in your asset repository and update the OBJ and contract paths in its final step. It installs the current source from GitHub because MeshContract is not on PyPI yet; for reproducible builds, pin that Git URL to a reviewed commit.
The project test workflow runs the full pytest suite on Python 3.11 and 3.12 for every push and pull request.
Current scope
The v0.2 CI foundation checks Wavefront OBJ vertex and face counts, virtual triangle count, axis-aligned dimensions, and n-gons. JSON contract violations include a stable code, rule, message, actual value, and limit. Invalid input produces a JSON error object when --format json is selected.
The default text format and v0.1 YAML contract remain supported. MeshContract does not currently validate UVs, textures, materials, normals, naming, or collision meshes.
Roadmap
- Finish packaging checks and publish to PyPI when separately authorized.
- Add additional asset backends behind the shared geometry model.
- Explore UV, texture, material, naming, and collision contract sections.
- Consider engine presets, a custom GitHub Action, and semantic asset diffs.
MeshContract is released under the MIT License; see LICENSE.
Metadata
Release files for meshcontract 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| meshcontract-0.2.0.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meshcontract-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.8 kB
Release files / meshcontract-0.2.0.tar.gz
| Download URL | meshcontract-0.2.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3578ba03ae606e279cee2d7383aa599f08479895c5b0a633826e6b55a1d5b5d
|
|
BLAKE2b-256 checksum How to use checksums |
d2baa6510c7526e87175926b14fa52a5694bfe6d62ed3f13d9ab3c7dded592c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency logRelease files / meshcontract-0.2.0-py3-none-any.whl
| Download URL | meshcontract-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
579b8d5c6dae08c7e9d20558af11b33f904cc8002fe78a33b648ff6f1e8cedf4
|
|
BLAKE2b-256 checksum How to use checksums |
f6c53599bf0dcc3deecbf4e94ff56daeb706ad18f38ba2e5de7bb256d8a83e6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 28, 2026.
Transparency log