tensa 0.4.0__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.
- tensa-0.4.0/.gitignore +68 -0
- tensa-0.4.0/ANDES_VERSIONS.md +30 -0
- tensa-0.4.0/PKG-INFO +777 -0
- tensa-0.4.0/README.md +67 -0
- tensa-0.4.0/pyproject.toml +139 -0
- tensa-0.4.0/src/tensa/__init__.py +36 -0
- tensa-0.4.0/src/tensa/__main__.py +16 -0
- tensa-0.4.0/src/tensa/api/__init__.py +6 -0
- tensa-0.4.0/src/tensa/api/_run_as_job.py +207 -0
- tensa-0.4.0/src/tensa/api/app.py +515 -0
- tensa-0.4.0/src/tensa/api/error_mapping.py +231 -0
- tensa-0.4.0/src/tensa/api/routes/__init__.py +0 -0
- tensa-0.4.0/src/tensa/api/routes/bundle.py +424 -0
- tensa-0.4.0/src/tensa/api/routes/cases.py +391 -0
- tensa-0.4.0/src/tensa/api/routes/clone.py +431 -0
- tensa-0.4.0/src/tensa/api/routes/cpf.py +377 -0
- tensa-0.4.0/src/tensa/api/routes/disturbances.py +203 -0
- tensa-0.4.0/src/tensa/api/routes/eig.py +422 -0
- tensa-0.4.0/src/tensa/api/routes/elements.py +549 -0
- tensa-0.4.0/src/tensa/api/routes/jobs.py +302 -0
- tensa-0.4.0/src/tensa/api/routes/pflow.py +187 -0
- tensa-0.4.0/src/tensa/api/routes/pmu.py +430 -0
- tensa-0.4.0/src/tensa/api/routes/profiles.py +559 -0
- tensa-0.4.0/src/tensa/api/routes/reports.py +214 -0
- tensa-0.4.0/src/tensa/api/routes/se.py +375 -0
- tensa-0.4.0/src/tensa/api/routes/sessions.py +139 -0
- tensa-0.4.0/src/tensa/api/routes/snapshot.py +718 -0
- tensa-0.4.0/src/tensa/api/routes/sweep.py +280 -0
- tensa-0.4.0/src/tensa/api/routes/tds.py +231 -0
- tensa-0.4.0/src/tensa/api/routes/workspace.py +317 -0
- tensa-0.4.0/src/tensa/api/routes/ws.py +357 -0
- tensa-0.4.0/src/tensa/api/schemas.py +1380 -0
- tensa-0.4.0/src/tensa/cli.py +446 -0
- tensa-0.4.0/src/tensa/core/__init__.py +8 -0
- tensa-0.4.0/src/tensa/core/bundle.py +893 -0
- tensa-0.4.0/src/tensa/core/clone_manager.py +697 -0
- tensa-0.4.0/src/tensa/core/clone_writers/__init__.py +147 -0
- tensa-0.4.0/src/tensa/core/clone_writers/clone_write_index.json +3119 -0
- tensa-0.4.0/src/tensa/core/clone_writers/dyr_writer.py +216 -0
- tensa-0.4.0/src/tensa/core/clone_writers/raw_writer.py +42 -0
- tensa-0.4.0/src/tensa/core/clone_writers/xlsx_writer.py +117 -0
- tensa-0.4.0/src/tensa/core/connectivity_result.py +63 -0
- tensa-0.4.0/src/tensa/core/cpf_result.py +79 -0
- tensa-0.4.0/src/tensa/core/disturbance.py +150 -0
- tensa-0.4.0/src/tensa/core/eig_result.py +78 -0
- tensa-0.4.0/src/tensa/core/errors.py +398 -0
- tensa-0.4.0/src/tensa/core/examples.py +103 -0
- tensa-0.4.0/src/tensa/core/jobs.py +357 -0
- tensa-0.4.0/src/tensa/core/psse_writer.py +406 -0
- tensa-0.4.0/src/tensa/core/report.py +551 -0
- tensa-0.4.0/src/tensa/core/se_result.py +83 -0
- tensa-0.4.0/src/tensa/core/session.py +1930 -0
- tensa-0.4.0/src/tensa/core/snapshot.py +462 -0
- tensa-0.4.0/src/tensa/core/stream.py +778 -0
- tensa-0.4.0/src/tensa/core/sweep.py +287 -0
- tensa-0.4.0/src/tensa/core/worker.py +1322 -0
- tensa-0.4.0/src/tensa/core/wrapper.py +4953 -0
- tensa-0.4.0/src/tensa/mcp_server.py +226 -0
- tensa-0.4.0/src/tensa/py.typed +0 -0
- tensa-0.4.0/src/tensa/security/__init__.py +8 -0
- tensa-0.4.0/src/tensa/security/middleware.py +99 -0
- tensa-0.4.0/src/tensa/security/paths.py +251 -0
tensa-0.4.0/.gitignore
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
.eggs/
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
wheels/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
|
|
14
|
+
# Per-run artifacts from compound-engineering skills (ce-code-review etc.)
|
|
15
|
+
.context/
|
|
16
|
+
.playwright-mcp/
|
|
17
|
+
.claude/
|
|
18
|
+
|
|
19
|
+
# Transient screenshot / scratch artifacts (regenerated per session, never committed)
|
|
20
|
+
polish-*.png
|
|
21
|
+
diag-*.png
|
|
22
|
+
phase[0-9]*-*.png
|
|
23
|
+
v[0-9]-*.png
|
|
24
|
+
*-smoke.png
|
|
25
|
+
sweep-*.png
|
|
26
|
+
devmode-*.png
|
|
27
|
+
/server/openapi.json
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
.ruff_cache/
|
|
30
|
+
.coverage
|
|
31
|
+
.coverage.*
|
|
32
|
+
htmlcov/
|
|
33
|
+
.tox/
|
|
34
|
+
.nox/
|
|
35
|
+
|
|
36
|
+
# Virtual environments
|
|
37
|
+
.venv/
|
|
38
|
+
venv/
|
|
39
|
+
env/
|
|
40
|
+
|
|
41
|
+
# Editor / IDE / agent tooling
|
|
42
|
+
.vscode/
|
|
43
|
+
.idea/
|
|
44
|
+
.claude/settings.local.json
|
|
45
|
+
*.swp
|
|
46
|
+
*.swo
|
|
47
|
+
*~
|
|
48
|
+
.DS_Store
|
|
49
|
+
|
|
50
|
+
# Runtime artifacts (never commit)
|
|
51
|
+
server/src/tensa/workspace/
|
|
52
|
+
~/.tensa/
|
|
53
|
+
*.token
|
|
54
|
+
|
|
55
|
+
# Distribution
|
|
56
|
+
*.whl
|
|
57
|
+
|
|
58
|
+
# ANDES code-generation cache (built by hook; we ship curated subset only)
|
|
59
|
+
# See server/build_hooks/prepare_cache.py
|
|
60
|
+
.andes/
|
|
61
|
+
|
|
62
|
+
# OS
|
|
63
|
+
Thumbs.db
|
|
64
|
+
.DS_Store
|
|
65
|
+
|
|
66
|
+
# Type stubs (generated)
|
|
67
|
+
*.pyi
|
|
68
|
+
paper/paper-preview.pdf
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# ANDES_VERSIONS.md
|
|
2
|
+
|
|
3
|
+
Phase A pins ANDES to `>=2.0,<3.0`. The substrate depends on **seven API contracts** that ANDES does not formally declare as public API — they are documented here so that an ANDES upgrade can be reviewed against this matrix before it lands.
|
|
4
|
+
|
|
5
|
+
## The seven API contracts
|
|
6
|
+
|
|
7
|
+
| # | Contract | Where the substrate uses it | Failure mode if it changes |
|
|
8
|
+
|---|---|---|---|
|
|
9
|
+
| 1 | `andes.System.models` introspection — enumeration of all model classes (Bus, Line, GENROU, etc.) with their `idx` lists | `core/wrapper.topology_snapshot()` to build the topology summary | Topology endpoint missing or duplicating elements |
|
|
10
|
+
| 2 | `Fault`, `Toggle`, `Alter` model param shapes — kwargs accepted by `ss.add('Fault', ...)`, `ss.add('Toggle', ...)`, `ss.add('Alter', ...)` | `core/disturbance.py` translates substrate `DisturbanceDef` payloads to these kwargs | `DisturbanceDef` schema breaks on disturbance creation |
|
|
11
|
+
| 3 | `TDS.callpert` per-step hook — assigning a callable runs it once per integration step | `core/wrapper.run_tds()` and `core/stream.py` for streaming + abort polling | TDS streaming silently degrades or hangs |
|
|
12
|
+
| 4 | `dae.ts` time-series structure — `dae.ts.x`, `dae.ts.y`, `dae.ts.t` arrays grow during TDS | `core/stream.py` reads from these for state-variable snapshots | Streaming returns wrong column shape or no data |
|
|
13
|
+
| 5 | `andes.load(path, addfile=..., setup=False)` semantics — load without committing setup so disturbances can be added | `core/wrapper.load_case()` and `reload_case()` | `add_disturbance` always raises post-setup; v0.1 disturbance flow broken |
|
|
14
|
+
| 6 | **`PFlow.run()` and `TDS.run()` require an explicit prior `ss.setup()` call.** Verified empirically against ANDES 2.0.0: `PFlow.run` on a non-setup System raises `IndexError` because `dae` has no allocated address space. ANDES does NOT auto-call setup from these routines. The wrapper calls `ss.setup()` first if `not ss.is_setup`. | `core/wrapper.run_pflow()`, `run_tds()` | If a future ANDES version starts auto-calling setup, the wrapper's explicit `ss.setup()` call becomes a no-op-with-warning and we must handle that case rather than treating "second setup returned False" as a failure. |
|
|
15
|
+
| 7 | `sys.audit("open", ...)` event coverage — Python-level open() calls from ANDES are visible to the audit hook | `core/wrapper` --strict-fs best-effort logging of secondary file reads | --strict-fs misses reads (caveat already documented in the trust model — C-extension reads are not caught even today) |
|
|
16
|
+
|
|
17
|
+
## Verification matrix
|
|
18
|
+
|
|
19
|
+
| ANDES version | Verified? | Curl walkthrough green? | Notes |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| 2.0.0 | Source-grounded during planning | Pending Unit 8 | Used during plan deepening; `andes/system/facade.py:362-407` confirms `add()` rejects post-setup; `andes/routines/tds.py:446-456` confirms `callpert` per-step invocation |
|
|
22
|
+
|
|
23
|
+
Update this table as the CI matrix expands.
|
|
24
|
+
|
|
25
|
+
## Upgrade procedure
|
|
26
|
+
|
|
27
|
+
1. Bump the version range in `pyproject.toml` deliberately (never automatic).
|
|
28
|
+
2. Re-run the curl walkthrough (`pytest -m acceptance`) on a fresh venv with the new ANDES.
|
|
29
|
+
3. For each row in "The seven API contracts," verify the contract still holds. Add a row to the verification matrix.
|
|
30
|
+
4. If any contract changes, update the wrapper before bumping the production pin and add a regression test in `tests/integration/`.
|