physlink 0.1.2__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.
- physlink-0.1.2/LICENSE +21 -0
- physlink-0.1.2/PKG-INFO +117 -0
- physlink-0.1.2/README.md +81 -0
- physlink-0.1.2/pyproject.toml +79 -0
- physlink-0.1.2/setup.cfg +4 -0
- physlink-0.1.2/src/physlink/__init__.py +19 -0
- physlink-0.1.2/src/physlink/adapters/__init__.py +0 -0
- physlink-0.1.2/src/physlink/adapters/dreamer.py +1068 -0
- physlink-0.1.2/src/physlink/core/__init__.py +3 -0
- physlink-0.1.2/src/physlink/core/_types.py +302 -0
- physlink-0.1.2/src/physlink/core/adapter.py +57 -0
- physlink-0.1.2/src/physlink/core/exceptions.py +146 -0
- physlink-0.1.2/src/physlink/core/spaces.py +276 -0
- physlink-0.1.2/src/physlink/core/validation.py +302 -0
- physlink-0.1.2/src/physlink/utils/__init__.py +0 -0
- physlink-0.1.2/src/physlink/utils/diagnostics.py +276 -0
- physlink-0.1.2/src/physlink/utils/visualization.py +75 -0
- physlink-0.1.2/src/physlink.egg-info/PKG-INFO +117 -0
- physlink-0.1.2/src/physlink.egg-info/SOURCES.txt +20 -0
- physlink-0.1.2/src/physlink.egg-info/dependency_links.txt +1 -0
- physlink-0.1.2/src/physlink.egg-info/requires.txt +24 -0
- physlink-0.1.2/src/physlink.egg-info/top_level.txt +1 -0
physlink-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Denis Hamon
|
|
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.
|
physlink-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: physlink
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Backend-agnostic adapter library for physical simulation ML
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://Denis-hamon.github.io/physlink/
|
|
7
|
+
Project-URL: Documentation, https://Denis-hamon.github.io/physlink/
|
|
8
|
+
Project-URL: Repository, https://github.com/Denis-hamon/physlink
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/Denis-hamon/physlink/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Denis-hamon/physlink/blob/main/CHANGELOG.md
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy>=1.24
|
|
15
|
+
Requires-Dist: rich>=13.0
|
|
16
|
+
Requires-Dist: matplotlib>=3.7
|
|
17
|
+
Requires-Dist: pyyaml>=6.0
|
|
18
|
+
Requires-Dist: safetensors>=0.4
|
|
19
|
+
Requires-Dist: Pillow>=9.0
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
22
|
+
Requires-Dist: mypy>=1.9; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-benchmark>=4.0; extra == "dev"
|
|
25
|
+
Requires-Dist: pre-commit>=3.7; extra == "dev"
|
|
26
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
27
|
+
Requires-Dist: torch; extra == "dev"
|
|
28
|
+
Provides-Extra: docs
|
|
29
|
+
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
|
|
30
|
+
Requires-Dist: mkdocstrings[python]>=0.25; extra == "docs"
|
|
31
|
+
Requires-Dist: mike>=2.1; extra == "docs"
|
|
32
|
+
Provides-Extra: notebook
|
|
33
|
+
Requires-Dist: nbconvert>=7.0; extra == "notebook"
|
|
34
|
+
Requires-Dist: nbformat>=5.9; extra == "notebook"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# PhysLink
|
|
38
|
+
|
|
39
|
+
[](https://opensource.org/licenses/MIT)
|
|
40
|
+
[](https://github.com/Denis-hamon/physlink/actions/workflows/ci.yml)
|
|
41
|
+
[](https://Denis-hamon.github.io/physlink/)
|
|
42
|
+
[](https://pypi.org/project/physlink/)
|
|
43
|
+
[](https://pypi.org/project/physlink/)
|
|
44
|
+
[](https://arxiv.org/abs/PLACEHOLDER)
|
|
45
|
+
|
|
46
|
+
[](https://colab.research.google.com/github/Denis-hamon/physlink/blob/main/notebooks/quickstart.ipynb)
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<a href="https://colab.research.google.com/github/Denis-hamon/physlink/blob/main/notebooks/quickstart.ipynb"><strong>Quick Start →</strong></a>
|
|
50
|
+
|
|
|
51
|
+
<a href="https://Denis-hamon.github.io/physlink/lab-adoption-guide/"><strong>Evaluate for your lab →</strong></a>
|
|
52
|
+
|
|
|
53
|
+
<a href="https://Denis-hamon.github.io/physlink/domain-scientists/"><strong>For Domain Scientists →</strong></a>
|
|
54
|
+
</p>
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
**PhysLink bridges physical simulators and deep RL adapters in one `pip install`.**
|
|
59
|
+
|
|
60
|
+
Plug your robot trajectories into [DreamerV3](https://github.com/danijar/dreamerv3) (and future backends) without writing boilerplate space definitions, checkpoint logic, or compliance checks. PhysLink handles the plumbing — you keep the science.
|
|
61
|
+
|
|
62
|
+
## Why PhysLink
|
|
63
|
+
|
|
64
|
+
| Without PhysLink | With PhysLink |
|
|
65
|
+
|-----------------|---------------|
|
|
66
|
+
| Hand-write observation/action space mappings per framework | `ObservationSpace.from_proprioception(joints=7)` |
|
|
67
|
+
| Debug silent OOM on Colab at step 8 000 | `physlink.doctor()` catches it before you start |
|
|
68
|
+
| Lose 3h of T4 training on session disconnect | Auto-checkpoint every N steps, resume on reconnect |
|
|
69
|
+
| Manually verify energy conservation after adaptation | `register_invariant` + `compliance_report()` |
|
|
70
|
+
| Stare at loss curves to diagnose model drift | Triptych GIF — Imagination / Real / Difference in one call |
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install physlink
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Works on Google Colab out of the box. No CUDA required for diagnostics and space definitions.
|
|
79
|
+
|
|
80
|
+
## Quick example
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import physlink
|
|
84
|
+
|
|
85
|
+
# 1. Verify your environment (< 15 s)
|
|
86
|
+
physlink.doctor()
|
|
87
|
+
|
|
88
|
+
# 2. Define spaces from your robot config
|
|
89
|
+
obs = physlink.ObservationSpace.from_proprioception(joints=7, include_velocity=True)
|
|
90
|
+
act = physlink.ActionSpace.continuous(dims=7, bounds=(-1.0, 1.0))
|
|
91
|
+
|
|
92
|
+
# 3. Adapt
|
|
93
|
+
adapter = physlink.DreamerV3Adapter(obs, act)
|
|
94
|
+
adapter.fit(trajectories, steps=10_000)
|
|
95
|
+
|
|
96
|
+
# 4. Validate physics compliance
|
|
97
|
+
physlink.register_invariant(adapter, "energy", fn=energy_fn, tolerance=0.05)
|
|
98
|
+
report = adapter.compliance_report()
|
|
99
|
+
report.plot()
|
|
100
|
+
|
|
101
|
+
# 5. Visualise
|
|
102
|
+
adapter.visualize(trajectories) # → triptych GIF
|
|
103
|
+
adapter.export("./run-01/")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Documentation
|
|
107
|
+
|
|
108
|
+
Full docs at **[Denis-hamon.github.io/physlink](https://Denis-hamon.github.io/physlink/)** — includes API reference, lab adoption guide, and domain-scientist quickstart.
|
|
109
|
+
|
|
110
|
+
## Status
|
|
111
|
+
|
|
112
|
+
`v0.1.x` — public API stable across minor versions (see [CHANGELOG](CHANGELOG.md)).
|
|
113
|
+
`test-cpu` CI passes on every PR. GPU benchmarks run on release tags.
|
|
114
|
+
|
|
115
|
+
## Contributing
|
|
116
|
+
|
|
117
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Issues and PRs welcome — use the provided templates.
|
physlink-0.1.2/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# PhysLink
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://github.com/Denis-hamon/physlink/actions/workflows/ci.yml)
|
|
5
|
+
[](https://Denis-hamon.github.io/physlink/)
|
|
6
|
+
[](https://pypi.org/project/physlink/)
|
|
7
|
+
[](https://pypi.org/project/physlink/)
|
|
8
|
+
[](https://arxiv.org/abs/PLACEHOLDER)
|
|
9
|
+
|
|
10
|
+
[](https://colab.research.google.com/github/Denis-hamon/physlink/blob/main/notebooks/quickstart.ipynb)
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://colab.research.google.com/github/Denis-hamon/physlink/blob/main/notebooks/quickstart.ipynb"><strong>Quick Start →</strong></a>
|
|
14
|
+
|
|
|
15
|
+
<a href="https://Denis-hamon.github.io/physlink/lab-adoption-guide/"><strong>Evaluate for your lab →</strong></a>
|
|
16
|
+
|
|
|
17
|
+
<a href="https://Denis-hamon.github.io/physlink/domain-scientists/"><strong>For Domain Scientists →</strong></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
**PhysLink bridges physical simulators and deep RL adapters in one `pip install`.**
|
|
23
|
+
|
|
24
|
+
Plug your robot trajectories into [DreamerV3](https://github.com/danijar/dreamerv3) (and future backends) without writing boilerplate space definitions, checkpoint logic, or compliance checks. PhysLink handles the plumbing — you keep the science.
|
|
25
|
+
|
|
26
|
+
## Why PhysLink
|
|
27
|
+
|
|
28
|
+
| Without PhysLink | With PhysLink |
|
|
29
|
+
|-----------------|---------------|
|
|
30
|
+
| Hand-write observation/action space mappings per framework | `ObservationSpace.from_proprioception(joints=7)` |
|
|
31
|
+
| Debug silent OOM on Colab at step 8 000 | `physlink.doctor()` catches it before you start |
|
|
32
|
+
| Lose 3h of T4 training on session disconnect | Auto-checkpoint every N steps, resume on reconnect |
|
|
33
|
+
| Manually verify energy conservation after adaptation | `register_invariant` + `compliance_report()` |
|
|
34
|
+
| Stare at loss curves to diagnose model drift | Triptych GIF — Imagination / Real / Difference in one call |
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install physlink
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Works on Google Colab out of the box. No CUDA required for diagnostics and space definitions.
|
|
43
|
+
|
|
44
|
+
## Quick example
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import physlink
|
|
48
|
+
|
|
49
|
+
# 1. Verify your environment (< 15 s)
|
|
50
|
+
physlink.doctor()
|
|
51
|
+
|
|
52
|
+
# 2. Define spaces from your robot config
|
|
53
|
+
obs = physlink.ObservationSpace.from_proprioception(joints=7, include_velocity=True)
|
|
54
|
+
act = physlink.ActionSpace.continuous(dims=7, bounds=(-1.0, 1.0))
|
|
55
|
+
|
|
56
|
+
# 3. Adapt
|
|
57
|
+
adapter = physlink.DreamerV3Adapter(obs, act)
|
|
58
|
+
adapter.fit(trajectories, steps=10_000)
|
|
59
|
+
|
|
60
|
+
# 4. Validate physics compliance
|
|
61
|
+
physlink.register_invariant(adapter, "energy", fn=energy_fn, tolerance=0.05)
|
|
62
|
+
report = adapter.compliance_report()
|
|
63
|
+
report.plot()
|
|
64
|
+
|
|
65
|
+
# 5. Visualise
|
|
66
|
+
adapter.visualize(trajectories) # → triptych GIF
|
|
67
|
+
adapter.export("./run-01/")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Documentation
|
|
71
|
+
|
|
72
|
+
Full docs at **[Denis-hamon.github.io/physlink](https://Denis-hamon.github.io/physlink/)** — includes API reference, lab adoption guide, and domain-scientist quickstart.
|
|
73
|
+
|
|
74
|
+
## Status
|
|
75
|
+
|
|
76
|
+
`v0.1.x` — public API stable across minor versions (see [CHANGELOG](CHANGELOG.md)).
|
|
77
|
+
`test-cpu` CI passes on every PR. GPU benchmarks run on release tags.
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). Issues and PRs welcome — use the provided templates.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "physlink"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "Backend-agnostic adapter library for physical simulation ML"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"numpy>=1.24",
|
|
14
|
+
"rich>=13.0",
|
|
15
|
+
"matplotlib>=3.7",
|
|
16
|
+
"pyyaml>=6.0",
|
|
17
|
+
"safetensors>=0.4",
|
|
18
|
+
"Pillow>=9.0",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
dev = [
|
|
23
|
+
"ruff>=0.4",
|
|
24
|
+
"mypy>=1.9",
|
|
25
|
+
"pytest>=8.0",
|
|
26
|
+
"pytest-benchmark>=4.0",
|
|
27
|
+
"pre-commit>=3.7",
|
|
28
|
+
"build>=1.2",
|
|
29
|
+
"torch", # for adapters/ testing; excluded from core/ strict check
|
|
30
|
+
]
|
|
31
|
+
docs = [
|
|
32
|
+
"mkdocs-material>=9.5",
|
|
33
|
+
"mkdocstrings[python]>=0.25",
|
|
34
|
+
"mike>=2.1",
|
|
35
|
+
]
|
|
36
|
+
notebook = [
|
|
37
|
+
"nbconvert>=7.0",
|
|
38
|
+
"nbformat>=5.9",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://Denis-hamon.github.io/physlink/"
|
|
43
|
+
Documentation = "https://Denis-hamon.github.io/physlink/"
|
|
44
|
+
Repository = "https://github.com/Denis-hamon/physlink"
|
|
45
|
+
"Bug Tracker" = "https://github.com/Denis-hamon/physlink/issues"
|
|
46
|
+
Changelog = "https://github.com/Denis-hamon/physlink/blob/main/CHANGELOG.md"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.ruff]
|
|
52
|
+
target-version = "py310"
|
|
53
|
+
line-length = 100
|
|
54
|
+
src = ["src"]
|
|
55
|
+
exclude = [".agents", ".claude", "_bmad", "_bmad-output", ".venv", "dist", "build"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff.lint]
|
|
58
|
+
select = ["E", "F", "W", "I", "N", "UP", "ANN", "RUF"]
|
|
59
|
+
|
|
60
|
+
[tool.mypy]
|
|
61
|
+
python_version = "3.10"
|
|
62
|
+
strict = true
|
|
63
|
+
|
|
64
|
+
[[tool.mypy.overrides]]
|
|
65
|
+
module = "physlink.adapters.*"
|
|
66
|
+
ignore_missing_imports = true
|
|
67
|
+
strict = false # PyTorch stubs incomplete — ADR-002 defers to v0.3.0
|
|
68
|
+
|
|
69
|
+
[[tool.mypy.overrides]]
|
|
70
|
+
module = "physlink.utils.*"
|
|
71
|
+
ignore_missing_imports = true
|
|
72
|
+
# utils/ may import matplotlib/PIL which have partial stubs
|
|
73
|
+
|
|
74
|
+
[tool.pytest.ini_options]
|
|
75
|
+
testpaths = ["tests"]
|
|
76
|
+
markers = [
|
|
77
|
+
"gpu: requires CUDA GPU — excluded from test-cpu CI job (deselect with '-m not gpu')",
|
|
78
|
+
"notebook_execution: executes the Colab notebook via nbconvert — run separately with '-m notebook_execution'",
|
|
79
|
+
]
|
physlink-0.1.2/setup.cfg
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""PhysLink — backend-agnostic adapter library for physical simulation ML."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.2"
|
|
4
|
+
|
|
5
|
+
from physlink.adapters.dreamer import DreamerV3Adapter # Story 3.1
|
|
6
|
+
from physlink.core.exceptions import PhysLinkError
|
|
7
|
+
from physlink.core.spaces import ActionSpace, ObservationSpace # Story 2.6
|
|
8
|
+
from physlink.core.validation import ComplianceReport, register_invariant # Story 4.3 + 4.4
|
|
9
|
+
from physlink.utils.diagnostics import doctor
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"ActionSpace",
|
|
13
|
+
"ComplianceReport",
|
|
14
|
+
"DreamerV3Adapter",
|
|
15
|
+
"ObservationSpace",
|
|
16
|
+
"PhysLinkError",
|
|
17
|
+
"doctor",
|
|
18
|
+
"register_invariant",
|
|
19
|
+
]
|
|
File without changes
|