primvaria-contract 0.1.0b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- primvaria_contract-0.1.0b1/LICENSE +21 -0
- primvaria_contract-0.1.0b1/PKG-INFO +78 -0
- primvaria_contract-0.1.0b1/README.md +49 -0
- primvaria_contract-0.1.0b1/pyproject.toml +52 -0
- primvaria_contract-0.1.0b1/setup.cfg +4 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract/__init__.py +24 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract/conformance.py +44 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract/contract.py +496 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract/ground.py +144 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract/pack.py +177 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract.egg-info/PKG-INFO +78 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract.egg-info/SOURCES.txt +14 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract.egg-info/dependency_links.txt +1 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract.egg-info/requires.txt +5 -0
- primvaria_contract-0.1.0b1/src/primvaria_contract.egg-info/top_level.txt +1 -0
- primvaria_contract-0.1.0b1/tests/test_contract.py +220 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Régis Sarmento Caon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: primvaria-contract
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: The Primvaria OpenUSD contract: the code the Granulaire, Maillage, Filaire and Quincaillerie generators share to write and check their files (identity, variation, packs, ground, engine layers).
|
|
5
|
+
Author: Daniel Régis Sarmento Caon
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://primvaria.com
|
|
8
|
+
Project-URL: Source, https://github.com/drscaon/primvaria/tree/main/contract
|
|
9
|
+
Project-URL: Contract, https://github.com/drscaon/primvaria/blob/main/docs/contract.md
|
|
10
|
+
Project-URL: Changelog, https://github.com/drscaon/primvaria/blob/main/contract/CHANGELOG.md
|
|
11
|
+
Keywords: openusd,physical-ai,robot-learning,simulation,synthetic-data
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: usd-core>=26.5
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
27
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# primvaria-contract
|
|
31
|
+
|
|
32
|
+
The [Primvaria](https://primvaria.com) OpenUSD contract, as code: what the four
|
|
33
|
+
generators of the suite ([Granulaire](https://github.com/drscaon/granulaire),
|
|
34
|
+
[Maillage](https://github.com/drscaon/maillage),
|
|
35
|
+
[Filaire](https://github.com/drscaon/filaire) and
|
|
36
|
+
[Quincaillerie](https://github.com/drscaon/quincaillerie)) write alike and how it is
|
|
37
|
+
checked. The contract itself is
|
|
38
|
+
[docs/contract.md](https://github.com/drscaon/primvaria/blob/main/docs/contract.md).
|
|
39
|
+
|
|
40
|
+
You rarely install it yourself: each generator depends on it and gives its modules
|
|
41
|
+
under its own name (`granulaire.contract`, `granulaire.pack`, `granulaire.ground`,
|
|
42
|
+
`python -m granulaire.conformance`), filled in with the generator's name and version.
|
|
43
|
+
|
|
44
|
+
| Module | What it holds |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `primvaria_contract.contract` | asset identity, drawn and measured values, semantic labels, variant sets, MateFrames, engine layers, and the checks (`conformance`, `check`) |
|
|
47
|
+
| `primvaria_contract.pack` | the pack files, `instances.csv` and `manifest.json` (`write_pack`, `check_pack`) |
|
|
48
|
+
| `primvaria_contract.ground` | the shared ground and physics scene |
|
|
49
|
+
| `primvaria_contract.conformance` | the command line of the check |
|
|
50
|
+
|
|
51
|
+
Check files of any generator of the suite:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install primvaria-contract
|
|
55
|
+
python -m primvaria_contract.conformance output/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Writing takes the generator's name and version explicitly:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from primvaria_contract import contract
|
|
62
|
+
|
|
63
|
+
contract.write_identity(
|
|
64
|
+
prim,
|
|
65
|
+
name="Grain_000",
|
|
66
|
+
preset="beach_sand",
|
|
67
|
+
seed=1,
|
|
68
|
+
identifier="./file.usdc",
|
|
69
|
+
generator="granulaire",
|
|
70
|
+
version="0.6.0b1",
|
|
71
|
+
)
|
|
72
|
+
problems = contract.conformance(stage) # any generator of the suite
|
|
73
|
+
problems = contract.conformance(stage, "granulaire", "0.6.0b1") # and the assets name it
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Released from the [primvaria](https://github.com/drscaon/primvaria) repository
|
|
77
|
+
(folder `contract/`, tags `contract-vX.Y.Z`), before the generators that need its new
|
|
78
|
+
version. MIT licence.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# primvaria-contract
|
|
2
|
+
|
|
3
|
+
The [Primvaria](https://primvaria.com) OpenUSD contract, as code: what the four
|
|
4
|
+
generators of the suite ([Granulaire](https://github.com/drscaon/granulaire),
|
|
5
|
+
[Maillage](https://github.com/drscaon/maillage),
|
|
6
|
+
[Filaire](https://github.com/drscaon/filaire) and
|
|
7
|
+
[Quincaillerie](https://github.com/drscaon/quincaillerie)) write alike and how it is
|
|
8
|
+
checked. The contract itself is
|
|
9
|
+
[docs/contract.md](https://github.com/drscaon/primvaria/blob/main/docs/contract.md).
|
|
10
|
+
|
|
11
|
+
You rarely install it yourself: each generator depends on it and gives its modules
|
|
12
|
+
under its own name (`granulaire.contract`, `granulaire.pack`, `granulaire.ground`,
|
|
13
|
+
`python -m granulaire.conformance`), filled in with the generator's name and version.
|
|
14
|
+
|
|
15
|
+
| Module | What it holds |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `primvaria_contract.contract` | asset identity, drawn and measured values, semantic labels, variant sets, MateFrames, engine layers, and the checks (`conformance`, `check`) |
|
|
18
|
+
| `primvaria_contract.pack` | the pack files, `instances.csv` and `manifest.json` (`write_pack`, `check_pack`) |
|
|
19
|
+
| `primvaria_contract.ground` | the shared ground and physics scene |
|
|
20
|
+
| `primvaria_contract.conformance` | the command line of the check |
|
|
21
|
+
|
|
22
|
+
Check files of any generator of the suite:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install primvaria-contract
|
|
26
|
+
python -m primvaria_contract.conformance output/
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Writing takes the generator's name and version explicitly:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from primvaria_contract import contract
|
|
33
|
+
|
|
34
|
+
contract.write_identity(
|
|
35
|
+
prim,
|
|
36
|
+
name="Grain_000",
|
|
37
|
+
preset="beach_sand",
|
|
38
|
+
seed=1,
|
|
39
|
+
identifier="./file.usdc",
|
|
40
|
+
generator="granulaire",
|
|
41
|
+
version="0.6.0b1",
|
|
42
|
+
)
|
|
43
|
+
problems = contract.conformance(stage) # any generator of the suite
|
|
44
|
+
problems = contract.conformance(stage, "granulaire", "0.6.0b1") # and the assets name it
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Released from the [primvaria](https://github.com/drscaon/primvaria) repository
|
|
48
|
+
(folder `contract/`, tags `contract-vX.Y.Z`), before the generators that need its new
|
|
49
|
+
version. MIT licence.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "primvaria-contract"
|
|
7
|
+
version = "0.1.0b1"
|
|
8
|
+
description = "The Primvaria OpenUSD contract: the code the Granulaire, Maillage, Filaire and Quincaillerie generators share to write and check their files (identity, variation, packs, ground, engine layers)."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
authors = [{ name = "Daniel Régis Sarmento Caon" }]
|
|
14
|
+
keywords = ["openusd", "physical-ai", "robot-learning", "simulation", "synthetic-data"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
"Topic :: Multimedia :: Graphics :: 3D Modeling",
|
|
25
|
+
]
|
|
26
|
+
dependencies = ["usd-core>=26.5"]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = ["pytest>=7", "ruff>=0.5"]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://primvaria.com"
|
|
33
|
+
Source = "https://github.com/drscaon/primvaria/tree/main/contract"
|
|
34
|
+
Contract = "https://github.com/drscaon/primvaria/blob/main/docs/contract.md"
|
|
35
|
+
Changelog = "https://github.com/drscaon/primvaria/blob/main/contract/CHANGELOG.md"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["src"]
|
|
39
|
+
|
|
40
|
+
[tool.pytest.ini_options]
|
|
41
|
+
testpaths = ["tests"]
|
|
42
|
+
addopts = "-q"
|
|
43
|
+
|
|
44
|
+
[tool.ruff]
|
|
45
|
+
line-length = 110
|
|
46
|
+
target-version = "py311"
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = ["E", "F", "W", "I", "UP", "B"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint.isort]
|
|
52
|
+
known-first-party = ["primvaria_contract"]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""The Primvaria OpenUSD contract, shared by the four generators of the suite.
|
|
2
|
+
|
|
3
|
+
Granulaire, Maillage, Filaire and Quincaillerie write their OpenUSD files to the same contract
|
|
4
|
+
(https://github.com/drscaon/primvaria/blob/main/docs/contract.md). This package holds the code
|
|
5
|
+
they share for it, which each generator binds to its own name and version:
|
|
6
|
+
|
|
7
|
+
* ``primvaria_contract.contract``: identity, variation, measurements, semantic labels and
|
|
8
|
+
the checks of the contract (``conformance``, ``check``), engine layers;
|
|
9
|
+
* ``primvaria_contract.pack``: the pack of a generator (``instances.csv``, ``manifest.json``);
|
|
10
|
+
* ``primvaria_contract.ground``: the shared ground and physics scene;
|
|
11
|
+
* ``primvaria_contract.conformance``: the command line of the check.
|
|
12
|
+
|
|
13
|
+
Use it through a generator (``granulaire.contract``, ``granulaire.pack`` ...), which fills in
|
|
14
|
+
the generator's name and version, or directly to check files of any generator::
|
|
15
|
+
|
|
16
|
+
python -m primvaria_contract.conformance output/
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
__version__ = version("primvaria-contract")
|
|
23
|
+
except PackageNotFoundError: # running from a source tree that is not installed
|
|
24
|
+
__version__ = "0+unknown"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Command line of the Primvaria contract check, shared by the four generators::
|
|
2
|
+
|
|
3
|
+
python -m <generator>.conformance output/<preset> # files or folders; exit 1 on any issue
|
|
4
|
+
python -m primvaria_contract.conformance FILES... # files of any generator of the suite
|
|
5
|
+
|
|
6
|
+
A folder is also searched for packs (a ``manifest.json``): their ``instances.csv`` must say
|
|
7
|
+
what their OpenUSD files say.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import sys
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from .contract import CONTRACT, check, usd_files
|
|
16
|
+
from .pack import MANIFEST, check_pack
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main(argv: list[str] | None = None, generator: str | None = None, version: str | None = None) -> int:
|
|
20
|
+
"""generator, version: the files were written by this generator (``<generator>.conformance``),
|
|
21
|
+
so their assets must name it and this version; None: any generator of the suite."""
|
|
22
|
+
paths = sys.argv[1:] if argv is None else argv
|
|
23
|
+
if not paths:
|
|
24
|
+
print(f"usage: python -m {generator or __package__}.conformance FILE_OR_FOLDER...", file=sys.stderr)
|
|
25
|
+
return 2
|
|
26
|
+
files, failed = usd_files(paths), 0
|
|
27
|
+
for f in files:
|
|
28
|
+
issues = check(f, generator, version)
|
|
29
|
+
failed += bool(issues)
|
|
30
|
+
for msg in issues:
|
|
31
|
+
print(f"{f}: {msg}")
|
|
32
|
+
packs = sorted({m.parent for p in map(Path, paths) if p.is_dir() for m in p.rglob(MANIFEST)})
|
|
33
|
+
for folder in packs:
|
|
34
|
+
issues = check_pack(folder)
|
|
35
|
+
failed += bool(issues)
|
|
36
|
+
for msg in issues:
|
|
37
|
+
print(f"{folder}: {msg}")
|
|
38
|
+
checked = f"{len(files)} OpenUSD files and {len(packs)} packs"
|
|
39
|
+
print(f"{checked} checked against contract {CONTRACT}, {failed} with issues")
|
|
40
|
+
return 1 if failed or not files else 0
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if __name__ == "__main__":
|
|
44
|
+
raise SystemExit(main())
|