From a3875db067741c1f410b117b6f43acd72c3f5143 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 13:24:32 -0700 Subject: [PATCH 01/16] docs: design staged sysid backends and solver support --- ...10-29-sysid-backends-and-solvers-design.md | 387 ++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md diff --git a/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md b/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md new file mode 100644 index 0000000..f2ca6ae --- /dev/null +++ b/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md @@ -0,0 +1,387 @@ +# Pluggable sysID backends and configurable Newton solvers + +Date: 2026-10-29 +Status: Builder-reviewed draft; awaiting design approval + +## Intent and agreed scope + +Allow actuator system identification to select a simulator backend and, within +Newton, select and configure a physics solver. Deliver the work in independently +reviewable PRs. Implement Newton MuJoCo and VBD; leave additional real simulator +implementations and MPM outside this project. + +Use the Newton fork at +`https://github.com/skulkar22/newton`, branch `dev/rigid-vbd-integration`. +The inspected revision is `1e5036c48ec92d44782dfe0f448dc25d64984b58` +(`1.8.0.dev0`). Lock this exact revision; updating the branch deliberately is a +dependency change, not an implicit change between runs. + +User requirements: + +- Keep the simulator boundary separate from Newton's solver selection. +- Accept solver-specific settings through a general YAML dictionary rather than + duplicating all solver constructor options in handwritten configuration models. +- Warn about unknown/skipped solver settings. In recorded settings, replace that + setting's value with a short string explaining why it was not set. +- Include the extension points needed for another simulator to supply sysID. +- Use external implicit PD actuation with effort clamping and bias feedback. +- Ignore the velocity limit in the new external actuator path. +- Preserve existing MuJoCo configuration and native-actuation behavior. + +## Current architecture + +`SimulationContext` owns one lazily loaded model and state per process. Its only +abstract operation is model loading; it does not define a complete stepping or +sysID execution protocol. `SIMULATION_CONTEXTS` currently registers only Newton. + +`PopulationEvaluator.evaluate(population, trajectories)` is already independent +of the simulator. The objective and optimizer consume scores through this +protocol. However, `ActuatorSysIdTask` constructs `NewtonPopulationEvaluator` +directly, the simulation schema permits only Newton, and the evaluator checks +for `NewtonSimulationContext` before manipulating Newton/Warp arrays. + +The Newton context hardcodes MuJoCo construction and attribute registration. +The evaluator maps three YAML options to MuJoCo constructor keywords and fixes +its internal algorithm to `solver="newton"`. + +Common result writing currently invokes a Newton-specific USD exporter and +requires an `identified.usda` result. This coupling must move behind the backend +boundary as well as evaluator construction. + +## Approaches and selected direction + +Two architecture choices were considered: + +1. Expand `SimulationContext` into a universal physics interface for every sysID + array operation. This centralizes execution but forces different simulators + and device layouts into one detailed model/state contract. +2. Keep `SimulationContext` responsible for resources, and select a backend's + population evaluator through the existing scoring protocol. Keep solver + integration beneath Newton. This preserves efficient native simulation and + scoring while leaving the optimization algorithm independent of the backend. + +The discussion selected the second direction, including the backend selection +work in this project. Do not introduce a universal array abstraction or duplicate +Newton's existing `SolverBase` lifecycle interface. + +For numerical settings, use constructor-based discovery. Arbitrary post-build +attribute assignment is unsuitable: constructors resolve settings, allocate +buffers, and create cached values that assigning an attribute may not update. + +## Backend boundary + +Provide an explicit sysID backend registration containing: + +- A backend name and configuration model. +- A population-evaluator factory implementing the existing scoring protocol. +- A simulation context factory compatible with resource ownership. +- An optional fitted-model export hook. + +Registration must connect to the existing simulation registry rather than +requiring inconsistent declarations in unrelated catalogs. Validate duplicate +registrations and missing sysID capabilities before running optimization. +Support registration through the Python API and discovery through the +`anchor_bench.sysid_backends` entry-point group, so an installed backend can run +through the CLI without editing core source. Load registration metadata before +parsing its configuration, with deterministic duplicate-name errors. + +Common sysID data remains joint names, candidate physical parameters, aligned +command/measurement trajectories, timing, and one finite position-MSE score per +candidate. A backend owns candidate application, state resets, actuation, +stepping, and score calculation. The objective, CMA-ES implementation, dataset +loader, delay semantics, and buffer exclusion are unchanged. + +The simulation configuration dispatches on its existing `type` field. Keep +shared timing fields available to task invariant validation; Newton owns +`usd_path` and its solver block. Registered backend configuration models retain +their own validation and complete serialization. A custom backend's parsing and +execution must not construct or require a Newton context. + +Common output files remain `config.yaml`, `best_params.yaml`, +`optimization_log.csv`, `run_summary.yaml`, and `.completed`. Backend-specific +model export is optional. Newton continues to write `identified.usda`; another +backend can write a different identified model or only the common results. +Represent optional model artifacts without requiring a USD path. Preserve the +existing Newton result access and filename for current callers. + +Prove the boundary with a test backend using its own configuration, model/state +objects, deterministic population evaluation, and non-USD export. It must run +through configuration parsing, optimization, and common output writing without +constructing Newton objects. This is contract validation, not a second simulator +implementation. + +## Newton solver selection and settings + +Newton's backend owns a solver registry/factory and the small setup hooks needed +by each supported solver. Initial public names are `warp_mujoco` and `vbd`. +Unknown solver names fail before simulation setup. Settings never import an +arbitrary class named by a configuration string. + +The preferred configuration is: + +```yaml +simulation: + type: newton + usd_path: path/to/robot.usda + physics_freq: 1000 + control_freq: 200 + render_freq: 60 + solver: + type: vbd + settings: + iterations: 20 + rigid_compliant_alm: true + rigid_articulation_solve: block_sparse_joints +``` + +Inspect the selected solver's public constructor to identify keyword parameters. +Exclude resource arguments owned by the context, including `model` and +`collision_pipeline`. Do not interpret an unrestricted `**kwargs` argument as +proof that an arbitrary option is supported. Normalize supported enum-valued +options from YAML using explicit public types; runtime resources are never +constructed from arbitrary YAML objects. Constructor failures for recognized +arguments remain errors and must identify the offending configuration path. + +Keep legacy MuJoCo `integrator`, `solver_iterations`, and +`line_search_iterations`, translating them to the same construction path. +Preserve the current internal `solver="newton"` default for legacy configs. +If legacy and new settings specify the same argument, reject ambiguous duplicate +specification rather than silently choosing precedence. + +Register selected-solver custom attributes before USD import and on population +builders. Preserve solver-specific attributes authored in USD. VBD colors the +population builder before finalization and checks articulation layout for sparse +modes. Arbitrary YAML overrides of per-joint or per-particle attributes are not +part of this first implementation; they are distinct from constructor options. + +The initialized-context identity includes solver selection and accepted settings +alongside world count and builder configuration. Reusing the process singleton +with a different solver/configuration must fail clearly. Solver settings remain +fixed during a run; candidate physical parameters update between generations. + +### Warning and provenance behavior + +Warn once during setup for each unknown, internally managed, or demonstrably +ignored requested setting. Keep the input configuration intact. Add the compact +runtime solver-settings mapping to `run_summary.yaml`; accepted requested values +remain values, and skipped values become explanatory strings: + +```yaml +simulation: + type: newton + solver: + type: vbd + settings: + iterations: 20 + misspelled_option: "NOT SET: unknown constructor parameter" +``` + +Do not create a second failure list or copy every library default into the +summary. The dependency lock identifies defaults. Preserve the fork revision in +run metadata. Use documented ignored parameters and captured, attributable +Newton warnings to distinguish accepted-but-ignored options; a deprecation +warning alone does not prove an option is ignored. Do not claim to detect every +conditionally inactive setting from constructor introspection. + +## Newton lifecycle and VBD capabilities + +Use the solver's existing `step`, `reset`, `notify_model_changed`, and custom +attribute registration interfaces. Small Newton-owned handlers cover resource +construction, preparation, capability checks, and reset coordination, not a +second hierarchy duplicating every solver method. + +Create an explicit `CollisionPipeline` for VBD before solver construction and +use the fork's solver-owned collision scheduling. Do not also run a duplicate +external collision pass. Reset collision matching as well as solver history +between independent trajectories. Preallocate/warm up required buffers outside +capture, then restore initial simulation, collision, and actuator state before +capturing or evaluating a trajectory. + +The pinned fork publishes `state.joint_q` and `state.joint_qd` for revolute, +prismatic, and D6 joints, including continuous turns. Consume these directly; +do not overwrite continuous output with generic inverse kinematics. Reset from +measured joint coordinates with matching forward-kinematic body poses and +preserve full turn counts. Candidate/world isolation, delayed commands, scoring +alignment, and stable canonical state-buffer identities remain invariant. + +Validate physical capabilities using solver mode, joint types, actual authored +model values, and configured candidate bounds. In this fork: + +- Drive stiffness/damping and passive viscous damping support revolute, + prismatic, and D6 joints. +- Dry friction under local compliant ALM supports static sticking. Sparse modes + use regularized Coulomb friction, which has different near-zero behavior. +- Revolute armature requires a declared articulation solved with + `block_sparse_joints` or `block_sparse_levels`; the local fallback must not be + accepted for a fitted or nonzero armature. +- Sparse reduced-elastic articulation joints have further restrictions on + armature, passive damping, friction, and mimics. Reject unsupported combinations. +- External actuation supplies effort clamping independently of VBD's unsupported + native effort-limit property. Velocity limiting is intentionally unused. + +Do not reject armature and friction merely because released Newton 1.4.0 lacked +them. Conversely, accepting a constructor setting does not establish that the +selected model/joint/mode supports every fitted physical parameter. + +## External implicit PD actuation with bias + +Add an explicit controller implementation choice: existing configurations default +to `native`; new external actuation is `external_implicit`. This is a design +proposal for the configuration spelling, not an existing field. Support the +external mode with MuJoCo and VBD so solver comparisons can use the same control +law. Keep native MuJoCo behavior as the compatibility baseline. + +The supported matrix is MuJoCo/native, MuJoCo/external implicit, and VBD/external +implicit. VBD/native is outside this project. Selecting VBD with the compatibility +default `native` must fail before optimization with a message requiring +`controller.implementation: external_implicit`; do not switch it silently. The +VBD example explicitly sets this field for every identified joint group. + +Use Newton's `Actuator`, `DrivePD`, `ClampingMaxEffort`, +`JointSpaceResponse`, and `Actuator.set_effort_mode_implicit`. Effort saturation +is enforced inside the implicit actuator solve, not after an explicit PD step. +Use one actuator with all optimized DOFs for each replicated model so the +implicit solve retains coupling within each articulation and isolation between +worlds. All joints sharing an articulation's coupled external controller must +use compatible implementation/options; reject a mixed native/external selection +within that articulation for the first implementation. + +Provide optional `implicit_options` under an external controller for public +`Actuator.ImplicitOptions` values. Use the same recognized-option filtering and +compact skipped-setting reporting policy. External implicit mode always includes +bias prediction; do not silently fall back to explicit PD, omit bias, or use a +diagonal response. + +Each physics substep performs: + +1. Expose the current simulated joint/body state and delayed control targets. +2. Refresh the coupled joint-space inverse-mass response at the current state, + including the current candidate's armature. +3. Evaluate `newton.eval_inverse_dynamics_passive` at the current simulated state + into preallocated gravity and Coriolis arrays; form their sum as `bias_force`. +4. Clear actuator output effort, evaluate the implicit actuator with the physics + timestep and `bias_force`, and write its clamped effort to `control.joint_f`. +5. Advance the selected Newton solver. Native PD is disabled on externally + controlled DOFs; physical armature, dry friction, and viscous damping remain + active in the physics solver. + +The bias convention is `tau = M*qdd + b`, with `b = gravity + Coriolis`. +The actuator predicts `qd_next = qd + M_inverse * (impulse - dt*b)`. Passing +`bias_force` is not an additional gravity-compensation feedforward torque. +The physics solver applies its own gravity/Coriolis forces; do not add the bias +as another output torque. This interprets the user's bias-feedback requirement +as the pinned fork's implicit actuator bias input. + +Use `JointSpaceResponse.refresh(state)` for both MuJoCo and VBD initially. This +constructs the full coupled articulation mass response with current armature, +keeps the controller prediction consistent across solvers, and avoids depending +on a MuJoCo factorization from the preceding step. This is a design choice for +review. It is a prediction model, not the exact constrained solver response: +contacts, friction, damping, joint limits, and loop constraints are not folded +into its inertia. The bias input similarly covers gravity and Coriolis, not +contact/limit reactions, passive joint damping, or other applied forces. Do not +claim equivalence to either solver's complete constrained dynamics. A future +solver-faithful inertia response can use `refresh_from_solve` once current-state +preparation and its behavior are independently validated. + +The fork's passive inverse-dynamics helper allocates scratch per call. The +external mode therefore requires Warp's device memory pool for CUDA capture; +warm up and validate that requirement before capturing. If the memory pool is +unavailable, log the reason and execute the same full response/bias/actuator +sequence eagerly. Do not capture only the solver or silently omit bias to make +capture succeed. + +Bind each candidate's gains to the actuator-owned parameter arrays after +implicit-mode binding; assigning the model's native PD arrays alone is +insufficient. Do not rebind arrays after graph capture. Capture response refresh, +bias evaluation, actuator stepping, and solver stepping as one substep sequence. +Reset any actuator history between independent trajectories. Keep the existing +trajectory command-delay implementation and do not apply a second actuator delay. + +Ignore `velocity_limit` in external mode. Retain the legacy input field for +configuration compatibility, report `"NOT SET: velocity limit ignored"` in +runtime controller provenance, and do not add a DC-motor speed envelope or hard +speed constraint. The external model export must not author a stronger finite +velocity-limit opinion that implies it was enforced during fitting. Export +metadata must preserve the selected controller implementation and solver so +replay can reproduce its actuation semantics. + +Replay acceptance means reimporting the exported fitted model and evaluating +its fitted parameters through the same sysID backend/evaluator with the recorded +solver/controller configuration. It does not add external-actuator or VBD +selection to the training replay validator. That validator remains on its +existing native MuJoCo path, with regression compatibility checked in stage 1. +Do not add a separate replay CLI or change the training validator's product +contract as part of this project. + +## Delivery stages + +Each stage is its own PR and must be mergeable with its tests and documentation. +The default execution is one stage at a time. Do not combine all product changes +into one PR or merge/publish stages merely because this design is approved. + +| Stage | Change | Acceptance boundary | +| --- | --- | --- | +| 1 | Pin the Newton fork and migrate existing API usage | Existing native MuJoCo sysID and training/replay workflows work on the exact fork revision; no new solver exposed yet. | +| 2 | Register sysID backends, dispatch configuration/evaluator, and isolate model export | Existing Newton behavior remains; an installed test backend runs the complete CLI flow without Newton context construction or USD-only output requirements. | +| 3 | Add Newton solver factory, general settings, legacy translation, and compact runtime provenance | MuJoCo runs through the new factory; known options reach construction, unknown/ignored options warn and appear as strings, and singleton configuration conflicts are rejected. | +| 4 | Add external implicit PD, coupled response, gravity/Coriolis bias, effort clamp, and reset/capture support | MuJoCo external mode has verified saturation, live candidate gains/armature, coupled multi-DOF response, bias sign, and independent trajectory/world behavior. Native mode remains compatible. | +| 5 | Enable VBD with its preparation, collision/reset integration, capability checks, and example | VBD sysID runs with external implicit PD and effort clamping, supported fitted physical parameters, repeatable replay/export, and validated eager/graph execution. | + +An installed third-party simulator, a universal simulator tensor API, MPM, +explicit external PD, velocity limiting, generic YAML model-attribute overrides, +and equivalence of all solver physics are non-goals. BDF2 may be configured only +where the fork supports it; adding a separate BDF2 feature project is unnecessary. + +## Validation + +Use meaningful behavior tests at each boundary, not only constructor mocks: + +- Existing native MuJoCo configuration, result exports, and score alignment. +- Backend discovery/registration, strict custom schema round-trip, config errors, + evaluator selection, optional/non-USD exports, and Newton-independent execution. +- Actual constructor-option forwarding and errors, legacy compatibility, unknown + and documented ignored settings, provenance without input-config mutation. +- PD effort saturation under large position error, implicit coupled response + versus an analytic small articulation, and gravity/Coriolis bias sign and + effect. Include nonzero armature and multiple replicated worlds. +- Candidate updates visible during CUDA graph replay, independent trajectory + reset, history restoration after warm-up/capture, and eager/graph agreement. +- VBD friction/damping changes, sparse-mode armature, unsupported model/mode + rejection, continuous joint coordinates, fresh collisions after reset, and + absence of duplicate native PD forces. +- A short real SO-101 sysID run per supported mode and replay of exported + parameters using the recorded solver/controller configuration. Do not require + identical fitted parameters or trajectories across different solvers. + +The repository gates apply to every code/dependency stage: `uv run ruff check`, +`uv run ruff format --check`, `uv run pyright`, and appropriate pytest coverage. +Because the dependency migration and simulation changes affect shared +infrastructure and integrations, run the complete unit and integration suite +with `uv run pytest -o "addopts="` for those stages. CUDA claims require actual +CUDA validation; document any unavailable hardware or unrelated baseline failure. +Documentation-only design work does not run these gates. + +## Builder decisions and follow-up checks + +The builder may choose file layout, precise registration function signatures, +optional-result compatibility helpers, and test fixture structure. The proposed +controller field names and entry-point group are design choices for review. + +Confirm contact capacity warm-up and graph capture restore all solver-owned +history, not just the visible state arrays. The chosen generic response path is +part of the external controller's recorded runtime implementation; no stale +MuJoCo solve or unrecorded controller-mode fallback is allowed. + +The inspected fork source and its tests support these design claims, but have +not been installed or executed during design research. Stage 1 establishes the +runtime baseline before subsequent feature work. + +## Source evidence + +- [Pinned fork revision](https://github.com/skulkar22/newton/commit/1e5036c48ec92d44782dfe0f448dc25d64984b58). +- [VBD capabilities, settings, collision and reset behavior](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/_src/solvers/vbd/solver_vbd.py). +- [External implicit actuation and bias conventions](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/docs/concepts/actuators.rst). +- [Coupled joint-space response](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/_src/actuators/joint_space_response.py). +- [Actuator, bias, clamping, and live-update tests](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/tests/test_actuators.py). +- [Sparse articulation and armature tests](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/tests/test_vbd_sparse_articulation.py). From e1a202c1cc64f31fc121737a6ab5654d668425ac Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 13:34:12 -0700 Subject: [PATCH 02/16] docs: plan staged sysid backend and solver implementation --- .../2026-10-29-sysid-backends-and-solvers.md | 276 ++++++++++++++++++ ...10-29-sysid-backends-and-solvers-design.md | 2 +- 2 files changed, 277 insertions(+), 1 deletion(-) create mode 100644 docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md diff --git a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md new file mode 100644 index 0000000..cbcb299 --- /dev/null +++ b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md @@ -0,0 +1,276 @@ +# Pluggable sysID Backends and Newton Solvers Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Deliver simulator-pluggable sysID, general Newton solver settings, and VBD with external implicit PD, bias prediction, and effort clamping through five separate PRs. + +**Architecture:** Keep model/state ownership in `SimulationContext` and backend-specific population evaluation behind `PopulationEvaluator`. Put Newton solver construction and preparation beneath `NewtonSimulationContext`; use Newton's actuator and solver lifecycle APIs rather than a universal physics-array interface. + +**Tech Stack:** Python >=3.10, Pydantic 2, Newton fork `1.8.0.dev0`, Warp >=1.17.0, MuJoCo/MuJoCo Warp ~=3.16.0, Optuna/CMA-ES, OpenUSD, pytest, uv. + +**Spec:** [Approved design](../specs/2026-10-29-sysid-backends-and-solvers-design.md). + +## Global Constraints + +- Pin `https://github.com/skulkar22/newton`, branch provenance `dev/rigid-vbd-integration`, exact revision `1e5036c48ec92d44782dfe0f448dc25d64984b58`. Never substitute a moving branch head. +- Preserve existing MuJoCo configuration and native-actuation behavior. +- Supported new matrix: MuJoCo/native, MuJoCo/external implicit, VBD/external implicit. VBD/native fails before optimization. +- External mode uses `JointSpaceResponse.refresh(state)` for both solvers, gravity plus Coriolis as `bias_force`, and `ClampingMaxEffort` inside the implicit solve. Ignore velocity limiting. +- Use one coupled actuator over the identified DOFs; do not split coupled coordinates into independent scalar actuator solves. Keep worlds isolated. +- Unknown, internally managed, and demonstrably ignored options warn once; replace their values with `"NOT SET: "` in runtime provenance. Preserve input configuration. Constructor errors for accepted settings remain errors. +- No MPM, real second simulator, explicit external PD, generic YAML model-attribute overrides, new replay CLI, or training-validator feature expansion. +- Preserve command-delay indexing, buffer exclusion, canonical state identity, native Newton USD outputs, and common result files. +- Use `vidur/` branches, authenticated `gh` for GitHub operations, and no attribution or co-author trailers to automated tools. +- All new/touched code headers use the 2026 repository licensing header. Run the repository gates before committing applicable code/dependency changes, including the complete unit/integration gate for shared infrastructure and dependency commits. A later stage's planned checks cannot justify an earlier unchecked commit. + +## Review Focus + +1. Plugin-only settings must survive strict parsing, serialization, configuration hashing, and tracking; test this in Task 3. +2. A recognized but invalid constructor argument must not be mislabeled as an ignored typo; test actual constructor failure and duplicate aliases in Task 5. +3. New solver/model configuration must not silently reuse a process singleton or stale captured graph; test this in Tasks 3 and 6. +4. Candidate gains and armature must affect captured implicit control without duplicate native PD; test this in Tasks 7 and 8. +5. Trajectory resets must discard solver/contact/actuator history, preserve full turns, and retain bias updates; test this in Tasks 8 and 9. + +## Delivery and parallel execution + +| PR | Branch | Tasks | Mergeable outcome | +| --- | --- | --- | --- | +| 1 | `vidur/sysid-newton-pin` | 1–2 | Existing native workflows run on the pinned fork. | +| 2 | `vidur/sysid-backends` | 3–4 | An installed test backend runs sysID without Newton model construction or USD-only output. | +| 3 | `vidur/sysid-solver-settings` | 5–6 | MuJoCo uses the solver factory and general settings with compact runtime provenance. | +| 4 | `vidur/sysid-implicit-pd` | 7–8 | External implicit MuJoCo PD includes coupled response, bias, and effort limits. | +| 5 | `vidur/sysid-vbd` | 9 | VBD sysID, example, and fitted-model replay work through the same backend. | + +Execute and review one PR stage at a time. The first product branch includes the approved design/plan commits; later stages start from the accepted preceding stage. Do not merge PRs automatically or implement later stages against unreviewed API assumptions. + +Parallel agents are explicitly requested. Assign disjoint file ownership within a stage and parallelize independent research, regression work, and review. The controller owns dependency files and integration. Tasks sharing an interface or source file wait for that interface to land; do not run all five stages as concurrent edits. Reuse a suitable clean checkout; additional worktrees are only needed if isolation actually requires them, using the native worktree workflow. + +At each stage finish, run the applicable gates, obtain independent code review, create a concrete draft PR with `gh`, and attach its URL to the task. PR titles/descriptions describe that stage only. A stage is not complete merely because a plan checkbox is checked. + +## File and interface map + +| File | Responsibility | +| --- | --- | +| `core/simulation/__init__.py` | Simulator-neutral resource identity and lazy model/state ownership. | +| `core/simulation/registry.py` | Authoritative backend registrations, sysID capability, and installed-provider discovery. | +| `schema/simulation.py` (new) | Shared sysID timing configuration and Newton-specific simulation/solver configuration. | +| `tasks/actuator_sys_id/backends/newton.py` (new) | Lazy Newton context/evaluator/export/provenance adapters. | +| `tasks/actuator_sys_id/task.py` | Select backend, optimize, request optional export and runtime description. | +| `tasks/actuator_sys_id/artifacts.py`, `model.py` | Common outputs and optional backend model artifacts. | +| `core/simulation/newton_options.py` (new) | Recognize public construction options and record skipped settings. | +| `core/simulation/newton_solvers.py` (new) | Newton solver descriptors, preparation, and owned resources. | +| `core/simulation/newton.py`, `newton_stepper.py` | Newton model lifecycle, canonical stepping, capture, and reset coordination. | +| `tasks/actuator_sys_id/newton_actuation.py` (new) | Coupled external implicit actuator, bias, live parameters, and history. | +| `tasks/actuator_sys_id/newton_capabilities.py` (new) | Validate VBD mode/joint/candidate/model capability combinations. | +| `tasks/actuator_sys_id/simulation.py`, `usd.py` | Newton evaluation and fitted USD semantics. | + +Paths above are relative to `anchor_bench/`. Tests and documentation are named in their owning tasks below. Keep existing imports available through re-exports where the original name is public. + +## PR 1: Pinned Newton runtime + +### Task 1: Pin the fork and migrate model construction + +**Files:** Modify `pyproject.toml`, `uv.lock`, `THIRD_PARTY_LICENSES.md`, `anchor_bench/core/simulation/newton.py`, `tests/test_newton_simulation_context.py`, `tests/integration/usd_trajectory.py`, `docs/system-identification.md`. + +**Interfaces:** Preserve `NewtonSimulationContext(usd_path: str, *, fixed_base: bool=False)` and `initialize(world_count=...)`. Internally use `builder.replicate(template, copy_count=world_count)` and an owned `CollisionPipeline(model, broad_phase="explicit")` with `pipeline.contacts()`. + +- [ ] **Step 1: Write migration regressions.** Extend `test_initializes_one_configurable_replicated_simulation` and `test_lazily_builds_one_newton_model_and_state`: record `copy_count`, one pipeline, contacts identity, attributes registered before import/finalize, and unchanged MuJoCo options. Have fakes reject the deprecated `world_count` replicate keyword and deprecated `model.contacts()` path. +- [ ] **Step 2: Run the red tests.** `uv run pytest tests/test_newton_simulation_context.py -q`; require failures at the old construction calls. Record dependency/version availability separately rather than mistaking installation failure for a behavioral red test. +- [ ] **Step 3: Pin and migrate.** Set the dependency to `newton[importers,sim] @ git+https://github.com/skulkar22/newton.git@1e5036c48ec92d44782dfe0f448dc25d64984b58`; run `uv lock` and `uv sync --locked --extra dev`. Use the public construction APIs above; remove the obsolete `newton.use_coord_layout_targets` assignment from the integration helper. Do not add external collision stepping to native MuJoCo. +- [ ] **Step 4: Verify resolution and tests.** Run `uv lock --check`, the Task 1 tests, and inspect Newton's installed `direct_url.json`: `vcs_info.commit_id` must equal the full SHA and package version must be `1.8.0.dev0`. Keep importer/sim extras. Resolve root constraints for Warp >=1.17.0, MuJoCo/MJWarp ~=3.16.0, and schemas >=0.5.0; update affected third-party version/source rows from the actual lock. Do not assume the dependency's uv index settings propagate to the root. +- [ ] **Step 5: Gate and commit.** Run the applicable lint/type gates plus targeted construction tests. Commit as `build: pin Newton rigid VBD integration revision` including migration and license-manifest changes. Do not expose VBD or change native actuation in this task. + +### Task 2: Verify real native sysID, replay, and training on the fork + +**Files:** Create `tests/integration/test_newton_native_runtime.py`; extend `tests/test_newton_replay_adapter.py` or its real-runtime integration counterparts; modify `anchor_bench/tasks/train/validators/newton_replay_adapter.py`, `anchor_bench/tasks/train/data_processors/gru.py`, `anchor_bench/core/simulation/newton_stepper.py`, and `anchor_bench/tasks/actuator_sys_id/simulation.py` only for demonstrated fork incompatibilities. Preserve existing SO-101/G1 integration assertions. + +**Interfaces:** Existing candidate application, `notify_model_changed`, measured-pose reset, direct/residual training replay, and CPU bias mappings remain native MuJoCo contracts. Reuse the existing `NewtonStepExecutor` public API. + +- [ ] **Step 1: Add physical tests.** `test_native_mujoco_candidate_updates_change_each_world_response` uses two scalar-joint worlds and swaps candidates, asserting finite scores and swapped world responses. `test_native_mujoco_repeated_trajectory_reset_is_deterministic` evaluates A/B/A and compares repeated A, delay alignment, and buffer exclusion. `test_native_mujoco_cuda_graph_matches_eager_with_live_candidates` covers odd/even substeps, stable `state` identity, and live gain/armature/target updates. +- [ ] **Step 2: Establish the fork baseline.** Run `uv run pytest -m integration tests/integration/test_newton_native_runtime.py -q`. Add `test_native_replay_direct_and_residual_reset` and `test_offline_bias_matches_live_replay_bias` with nonzero q/qd and MuJoCo `dof_ref`; compare the latter against `mj_forward(...).qfrc_bias`. New regression tests may already pass because this is a compatibility upgrade; do not manufacture failures or change physics to make them red. +- [ ] **Step 3: Fix only demonstrated API incompatibilities.** Preserve native target arrays, modes, reset order, and `joint_target_q_start` indexing. Keep the training replay product on native MuJoCo. Warm up real graphs outside capture and restore state before measuring. +- [ ] **Step 4: Run Stage 1 acceptance.** Run the complete gate below, including existing SO-101 two-generation/six-world export-MSE and held-out accuracy assertions plus G1 residual/full-torque training. Keep SO-101 MSE tolerance `rel=1e-4, abs=1e-7`. Diagnose changed outcomes instead of lowering thresholds. GPU-only claims require observed CUDA results. +- [ ] **Step 5: Review, commit, and prepare PR 1.** Commit compatibility coverage/fixes as `test: verify native simulation against pinned Newton`. Use independent agents on native sysID versus training/bias tests with disjoint files. Review the combined branch, then prepare its own draft PR and attach it. + +## PR 2: Simulator-pluggable sysID + +### Task 3: Generalize resources and register typed backend capabilities + +**Files:** Modify `anchor_bench/core/simulation/__init__.py`, `newton.py`, `registry.py`, `anchor_bench/schema/actuator_sys_id.py`, `anchor_bench/tasks/actuator_sys_id/model.py`, `anchor_bench/errors.py`; create `anchor_bench/schema/simulation.py`, `tests/test_simulation_context.py`, `tests/test_sysid_backends.py`; extend `tests/test_actuator_sys_id_config.py`, `tests/test_simulation_registry.py`, and test-only context subclasses in `tests/test_newton_simulation_context.py`, `tests/test_data_processors.py`, `tests/test_data_processor_runner.py`. Make package initializers lazy only where needed to remove import cycles. + +**Interfaces:** + +```python +SimulationContext.__new__(cls, *, resource_key: Hashable) -> Self +SimulationContext.__init__(self, *, resource_key: Hashable) -> None +SimulationContext.resource_key -> Hashable +SimulationContext._load(self) -> tuple[ModelT, StateT] +``` + +Move file resolution/validation, `usd_path`, and `fixed_base` to `NewtonSimulationContext`; its existing public constructor calls the base with `(resolved_path, fixed_base)`. Preserve the existing training adapter `create_simulation_context(backend, usd_path, *, fixed_base=False)`. + +Define `SysIdSimulationConfig(type: str, physics_freq, control_freq, render_freq)` with common timing validation. Move `WarpMujocoSolverConfig` and `NewtonSimulationConfig` to the neutral schema module and re-export their old names; Newton's config extends the common model with `type: Literal["newton"]`, `usd_path`, and existing solver fields. `ActuatorSysIdConfig.simulation` uses `SerializeAsAny[SysIdSimulationConfig]` and registered strict dispatch before validation. Add frozen `IdentifiedModelArtifact(path: Path, format: str)` to `model.py` now so registry annotations are defined before Task 4 consumes them. + +In `core/simulation/registry.py` define frozen `SimulationBackend(name, context_type, sysid: SysIdBackend|None)` and `SysIdBackend(config_model, create_context, create_evaluator, export_model=None, describe_runtime=None)`. Factories have these signatures: + +```python +create_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any] +create_evaluator(config: ActuatorSysIdConfig, space: ParameterSpace, + context: SimulationContext[Any, Any]) -> PopulationEvaluator +export_model(config: ActuatorSysIdConfig, best: Candidate, + context: SimulationContext[Any, Any], output: Path + ) -> IdentifiedModelArtifact | None +describe_runtime(evaluator: PopulationEvaluator) -> Mapping[str, JsonValue] +register_simulation_backend(registration: SimulationBackend) -> None +get_sysid_backend(name: str) -> SysIdBackend +discover_sysid_backends() -> None +``` + +`JsonValue` is Pydantic's public recursive JSON-compatible alias, re-exported by the neutral schema module. Use postponed annotations and `TYPE_CHECKING` to avoid schema/registry/task cycles. + +- [ ] **Step 1: Write boundary tests.** `test_path_free_context_loads_once` constructs `ToyContext(resource_key=("toy", 2))` without a file and asserts model/state cache identity. Add incompatible-class/key and unhashable-key cases. `test_plugin_simulation_roundtrips_without_losing_fields` validates a typed toy config, rejects extras/wrong types, preserves fields through JSON and config hashing, and detects changed plugin values. +- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_simulation_context.py tests/test_sysid_backends.py tests/test_actuator_sys_id_config.py -q`; require missing neutral-resource/registration behavior to fail. +- [ ] **Step 3: Implement atomic registration and discovery.** Entry-point group is `anchor_bench.sysid_backends`; providers are zero-argument callables returning `SimulationBackend`. Sort names, reject duplicate metadata names before loading, require entry-point and registration names to match, reject duplicate built-in/Python names, and wrap errors in `SimulationBackendError(AnchorBenchError)`. Discover before both direct `model_validate` and YAML parsing; mark discovery successful only after all registrations validate. A context factory returning the wrong concrete registered type is an error. +- [ ] **Step 4: Verify shared-resource compatibility.** Add `test_discovery_is_idempotent`, `test_discovery_error_does_not_leave_partial_registration`, `test_registered_backend_without_sysid_fails_early`, and repeated singleton-incompatibility tests. Run all Task 3 files plus data-processor/context tests. Imports must not construct Newton objects or import the sysID task from the neutral registry. +- [ ] **Step 5: Gate and commit.** Run lint/format/type checks and Task 3 tests; commit as `refactor: register simulation resources and sysid capabilities`. + +### Task 4: Dispatch evaluation, isolate export, and prove installed-plugin CLI use + +**Files:** Create `anchor_bench/tasks/actuator_sys_id/backends/__init__.py`, `backends/newton.py`, `tests/integration/test_sysid_backend_cli.py`, and `tests/fixtures/sysid_backend/`; modify `task.py`, `simulation.py`, `artifacts.py`, `model.py` in that task package, `tests/test_actuator_sys_id_task.py`, and `docs/system-identification.md`. + +**Interfaces:** Consume Task 3's `IdentifiedModelArtifact`. Add `identified_model_path: Path|None` and retain optional `identified_usd_path` in `SysIdResult`; explicitly declared format `"usd"` supplies the compatibility path, never suffix inference. Extend the existing `write_artifacts(..., config, model_artifact: IdentifiedModelArtifact|None=None, runtime_simulation: Mapping[str,JsonValue]|None=None)` signature. It never imports `usd.py`. Newton's export callback invokes the existing USD writer and returns `format="usd"`. + +Preserve `PopulationEvaluator.evaluate` as its only required method. Newton's factory injects the selected context into `NewtonPopulationEvaluator(config, space, *, simulation_context=None)`; preserve its existing two-positional-argument use. The task selects one backend and context, constructs the evaluator, optimizes, invokes its optional exporter/runtime description, and writes common artifacts. + +- [ ] **Step 1: Write orchestration/export regressions.** `test_task_uses_registered_evaluator_and_context` asserts selected factories receive the same context and optimizer behavior remains unchanged. Parameterize `test_common_artifacts_allow_missing_or_json_model_export`; assert optional result paths and no forced USD import. `test_export_failure_prevents_completion` asserts no `.completed` marker after exporter failure. +- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_actuator_sys_id_task.py tests/test_sysid_backends.py -q`; require the hardcoded Newton task/export path to fail toy-backend expectations. +- [ ] **Step 3: Implement the lazy Newton adapter and generic task path.** Re-export moved Newton config names for existing callers. Keep common scores, history, MLOps upload/completion ordering, delay, and datasets unchanged. A missing sysID capability must fail before constructing the optimizer or evaluating a population. +- [ ] **Step 4: Prove real installed discovery.** The integration fixture writes an importable toy package and `.dist-info/METADATA` plus `entry_points.txt` into `tmp_path`, then launches a fresh CLI subprocess with that path. Use real Parquet and CMA-ES; guard Newton context/model construction to raise. Assert plugin-specific config values survive, scores are finite/repeatable, common outputs complete, JSON export appears, and `identified.usda` does not. Repeat with no exporter. Run `uv run pytest -m integration tests/integration/test_sysid_backend_cli.py tests/integration/so101_actuator_sysid/test_cli.py -q`. +- [ ] **Step 5: Gate, commit, review, and prepare PR 2.** Run the full gate; document the Python registration API and entry-point provider contract. Commit as `feat: run sysid through registered simulator backends` and prepare the separate PR. + +## PR 3: General solver settings + +### Task 5: Resolve constructor settings and preserve legacy MuJoCo YAML + +**Files:** Create `anchor_bench/core/simulation/newton_options.py`, `newton_solvers.py`, `tests/test_newton_solver_options.py`, `tests/test_newton_solvers.py`; modify `anchor_bench/schema/simulation.py` and solver-config tests. + +**Interfaces:** Define frozen `OptionResolution(kwargs: dict[str, object], recorded: dict[str, JsonValue])` and: + +```python +resolve_constructor_options(constructor: Callable[..., object], + requested: Mapping[str, JsonValue], *, path: str, + managed: frozenset[str], + enum_converters: Mapping[str, Callable[[JsonValue], object]], + ignored: Mapping[str, str]) -> OptionResolution +get_newton_solver(name: str) -> NewtonSolverDescriptor +resolve_newton_solver_settings(config: NewtonSolverConfig) -> OptionResolution +``` + +`NewtonSolverConfig` accepts `type: str`, JSON-compatible `settings`, and optional legacy MuJoCo fields. Use explicit field-presence tracking for alias conflicts; do not inject legacy defaults into VBD or generic settings. Keep legacy runtime defaults `integrator="implicitfast"`, `solver="newton"`, and existing required iteration settings for legacy syntax. + +`NewtonSolverDescriptor` contains name, solver class, `register_attributes(builder)`, `prepare_builder(builder)`, and `build_resources(model, options)`; Task 6 defines the resource record. Initially register only `warp_mujoco`. + +- [ ] **Step 1: Write option tests.** `test_known_options_reach_constructor` asserts exact keyword forwarding. `test_unknown_managed_and_documented_ignored_options_warn_once` asserts omission plus string replacement. `test_kwargs_does_not_accept_arbitrary_names` rejects names merely hidden by `**kwargs`. `test_legacy_aliases_preserve_mujoco_arguments` asserts original option dictionary; `test_duplicate_legacy_and_settings_argument_fails` rejects even equal duplicate values. +- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_newton_solver_options.py tests/test_newton_solvers.py tests/test_actuator_sys_id_config.py -q`. +- [ ] **Step 3: Implement public-option resolution.** Exclude `self`, positional-only parameters, `*args`, `**kwargs`, and context-owned resources including `model`/`collision_pipeline`. Use explicit public enum converters for supported enum settings; never load runtime objects from arbitrary strings. Unknown solver names fail. Maintain a small pinned-version map only for documented ignored options; do not mark an option ignored merely because it is deprecated. +- [ ] **Step 4: Verify error boundaries.** Add `test_recognized_invalid_value_is_constructor_error`, asserting a supported option rejected by the real constructor fails with the configuration path and original reason. Verify warnings and provenance never mutate the input dictionary, and unrelated Newton warnings remain visible. +- [ ] **Step 5: Gate and commit.** Run quality gates and Task 5 tests; commit as `feat: resolve generic Newton solver settings`. + +### Task 6: Integrate solver resources, context identity, and compact provenance + +**Files:** Modify `anchor_bench/core/simulation/newton.py`, `newton_stepper.py`, `newton_solvers.py`, `anchor_bench/tasks/actuator_sys_id/simulation.py`, `backends/newton.py`, `tests/test_newton_simulation_context.py`, `tests/test_actuator_sys_id_simulation.py`, `tests/test_actuator_sys_id_task.py`, and `docs/system-identification.md`. + +**Interfaces:** Define frozen `NewtonSolverResources(solver: SolverBase, contacts: Contacts|None, step_contacts: Contacts|None, collision_pipeline: CollisionPipeline|None)`. Context initialization adds `solver_type: str="warp_mujoco"` and optional `solver_resolution: OptionResolution|None` while preserving `solver_options`; supplying both option forms is an error. The evaluator passes Task 5's resolution, while direct callers' raw `solver_options` are resolved inside the context. Resolve once before resource creation and retain `solver_settings: Mapping[str,JsonValue]` for reporting. The executor's step argument comes from `step_contacts`, independently of inspected `context.contacts`. + +Newton's backend `describe_runtime(evaluator)` returns the compact runtime simulation configuration. The common writer nests it in `run_summary.yaml`; accepted requested values stay values and omitted values become strings. Record the exact Newton revision without duplicating every constructor default or adding separate failure lists. + +- [ ] **Step 1: Write context/report tests.** `test_solver_attributes_are_registered_before_import_and_replication` checks both builders. `test_context_rejects_changed_solver_or_accepted_options` asserts singleton protection. `test_runtime_solver_settings_replace_only_skipped_values` checks output YAML and unchanged input/config hash. `test_same_accepted_options_reuse_context` covers equivalent requests with skipped keys. +- [ ] **Step 2: Run red tests.** Run modified context/evaluator/task tests plus Task 5 files; require hardcoded construction or missing provenance behavior to fail. +- [ ] **Step 3: Use descriptor resources throughout Newton setup.** Type solver ownership as `SolverBase`. Register attributes before import/replication, prepare the replicated builder before finalization, and include solver identity/normalized accepted values in singleton compatibility. Never expose VBD until Task 9 supplies its preparation and validation. +- [ ] **Step 4: Run real MuJoCo settings acceptance.** Parameterize a short native runtime over legacy/new settings forms and compare forwarded settings and scores with the original behavior. Run the native runtime integration, installed toy-backend integration, and SO-101 integration. Validate constructor errors prevent optimization/completion. +- [ ] **Step 5: Gate, commit, review, and prepare PR 3.** Run full acceptance and document generic YAML/legacy compatibility. Commit as `feat: configure Newton solvers through shared construction` and prepare the separate PR. + +## PR 4: External implicit PD with bias + +### Task 7: Build the coupled external actuator and bind live candidates + +**Files:** Create `anchor_bench/tasks/actuator_sys_id/newton_actuation.py`, `tests/test_newton_sysid_actuation.py`; modify controller schema in `anchor_bench/schema/actuator_sys_id.py` and its tests. + +**Interfaces:** Add `PdControllerConfig.implementation: Literal["native", "external_implicit"]="native"` and optional JSON `implicit_options` valid only for external mode. Reject mixed implementations/options within one coupled articulation for this release. Define: + +```python +ExternalImplicitPD.build(model: newton.Model, config: ActuatorSysIdConfig, *, + joint_names: Sequence[str], q_indices: np.ndarray, + dof_indices: np.ndarray, target_indices: np.ndarray) -> ExternalImplicitPD +ExternalImplicitPD.apply_population(population: Sequence[Candidate]) -> None +ExternalImplicitPD.reset() -> None +ExternalImplicitPD.before_substep(state: newton.State, + control: newton.Control, dt: float) -> None +ExternalImplicitPD.runtime_metadata() -> Mapping[str, JsonValue] +ExternalImplicitPD.supports_graph_capture() -> tuple[bool, str | None] +``` + +- [ ] **Step 1: Write analytic actuator tests.** `test_implicit_pd_matches_scalar_solution_with_bias` asserts the uncapped scalar effort against the equation below. `test_implicit_pd_effort_is_bounded_inside_solve` uses large error and nonzero bias to assert `abs(effort) <= effort_limit`. `test_implicit_pd_uses_off_diagonal_response` compares a two-DOF articulation with a dense coupled oracle, not independent scalar PD. + + For the unclamped oracle, use `A=M_inverse`, `K=diag(dt*kp+kd)` and solve `(I + dt*K*A)*tau = kp*(target_q-q) + kd*target_qd - K*qd + dt*K*A*bias`. Use small deterministic articulated models; compare the actuator effort, not exact constrained simulator trajectories. +- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_newton_sysid_actuation.py tests/test_actuator_sys_id_config.py -q` must fail because the external mode is absent. +- [ ] **Step 3: Implement through Newton's public actuator API.** Construct full coupled `JointSpaceResponse`, `DrivePD`, `ClampingMaxEffort`, and one `Actuator` across selected DOFs/worlds. Call `set_effort_mode_implicit` before storing gain references; write candidates into the resulting `drive.kp`/`drive.kd` views. Keep separate position, DOF, target indices and preallocated full-DOF gravity/Coriolis/bias arrays. Do not add DC-motor velocity limiting or a second command delay. +- [ ] **Step 4: Verify updates and provenance.** Add `test_bound_gain_views_remain_live_after_implicit_binding`, `test_response_refresh_includes_updated_armature`, `test_bias_uses_current_state_without_mutating_body_poses`, and `test_external_velocity_limit_is_recorded_as_ignored`. Assert the implicit options use the same skip/error policy as solver options. Check no extra gravity-compensation torque is added. +- [ ] **Step 5: Gate and commit.** Run quality gates, controller/config tests, and real actuator tests; commit as `feat: add coupled implicit PD with bias and effort limits`. + +### Task 8: Integrate full physics-substep capture, reset, and fitted-model replay + +**Files:** Modify `anchor_bench/core/simulation/newton_stepper.py`, `newton.py`, `anchor_bench/tasks/actuator_sys_id/simulation.py`, `usd.py`, `backends/newton.py`; extend `tests/test_newton_step_executor.py`, `tests/test_actuator_sys_id_simulation.py`, `tests/test_actuator_sys_id_usd.py`; create `tests/integration/test_sysid_external_pd.py` and `tests/integration/sysid_replay.py`; update `docs/system-identification.md`. + +**Interfaces:** The executor accepts optional `before_substep: Callable[[State, Control, float], None]` and calls it after clearing forces, before every solver step, both eager and captured; supplying it without a control buffer is an error. Add `restore_state: Callable[[], None]|None` to capture orchestration and `can_capture: Callable[[], tuple[bool,str|None]]|None`; native callers remain compatible. Expose context `configure_step_callbacks(*, before_substep, restore_state, can_capture, configuration_key: Hashable) -> None` to attach these once before capture. Reject replacement by different callbacks after attachment; do not retain a stale actuator owner or graph. Include controller implementation and accepted implicit options in the evaluator's builder/runtime configuration key. `ExternalImplicitPD.before_substep` executes response refresh, passive inverse dynamics, bias sum, effort clear, and implicit actuator step with physics dt. Replay helper runs in a fresh process to avoid source/export singleton collisions. + +- [ ] **Step 1: Write lifecycle regressions.** `test_external_pd_runs_before_each_physics_substep` asserts full ordering and dt. `test_external_candidate_updates_do_not_restore_native_pd` asserts native ke/kd stay zero while external gains change. `test_bias_and_clamp_are_present_in_captured_substeps` asserts numerical output, not just callback invocation. `test_capture_restores_initial_state_and_histories` compares repeated independent runs. `test_context_rejects_native_external_reconfiguration_or_hook_replacement` prevents stale callback/gain ownership when the USD and world count are unchanged. +- [ ] **Step 2: Run red tests.** Run the modified stepper/evaluator tests and new external-PD integration. Existing native tests must continue to pass with callbacks omitted. +- [ ] **Step 3: Wire the external path.** Disable native gains on external DOFs (MuJoCo effort mode; VBD cannot rely on target mode). Keep physical armature/friction/damping updates in the model. Retain delayed command targets at control rate and recompute response/bias/effort at every physics substep. Warm up full intervals outside capture, restore both visible state buffers/control plus solver/contact/actuator history before capture and again afterward. Reset output efforts between substeps and histories between trajectories. +- [ ] **Step 4: Verify physical, graph, and export behavior.** Add two-world A/B/A and live-candidate CUDA replay cases; compare eager/graph results for odd/even substeps. Require `device.is_cuda` and `wp.is_mempool_enabled(device)` for capture of bias scratch allocations; when unavailable, log the reason and run the entire sequence eagerly. Persist external mode/options/ignored velocity metadata. External export must not author a stronger finite velocity opinion. Reimport the exported USD in a fresh process with recorded config and fitted parameters, tile the candidate across worlds, and compare MSE to the recorded optimum. Keep the existing native replay helper and training validator unchanged. +- [ ] **Step 5: Gate, commit, review, and prepare PR 4.** Run full acceptance including native and external MuJoCo plus installed backend integration. Commit as `feat: run sysid with external implicit PD actuation` and prepare its separate PR. + +## PR 5: VBD sysID + +### Task 9: Add VBD resources, capability validation, and real sysID acceptance + +**Files:** Modify `anchor_bench/core/simulation/newton_solvers.py`, `newton.py`, `anchor_bench/tasks/actuator_sys_id/simulation.py`, `backends/newton.py`; create `newton_capabilities.py` in that task package, `tests/test_newton_sysid_capabilities.py`, `tests/integration/test_sysid_vbd.py`, and `examples/system_identification/so101_vbd.yaml`; extend solver/context/reset tests and `docs/system-identification.md`. + +**Interfaces:** Add `validate_newton_sysid_capabilities(config: ActuatorSysIdConfig, model: newton.Model, *, joint_names: Sequence[str], dof_indices: np.ndarray) -> None`. Add descriptor `vbd`: register its attributes before USD import, color the replicated builder before finalize, create the collision pipeline before solver construction, and pass the pipeline to VBD. Resources expose `contacts=solver.contacts` for inspection and `step_contacts=None` for solver-owned detection. + +- [ ] **Step 1: Write capability and ordering tests.** `test_vbd_requires_external_implicit`, `test_vbd_pipeline_owns_contacts_and_detection`, and `test_vbd_is_colored_after_replication` assert the supported configuration and resource order. `test_vbd_armature_requires_revolute_in_actual_sparse_articulation` checks upper bounds/nonzero fixed values and imported unselected joints, not only initial values or a sparse-setting string. Reject sparse local fallback, unsupported joint types, sparse reduced-elastic combinations, unsupported tendon resets, collision settings that leave stale contacts after episode reset, and `integrate_with_external_rigid_solver=True` without a rigid-body coupler. +- [ ] **Step 2: Run red tests.** Run `uv run pytest tests/test_newton_sysid_capabilities.py tests/test_newton_solvers.py tests/test_newton_simulation_context.py -q`; missing VBD resources/capability checks must fail. +- [ ] **Step 3: Enable VBD with the shared implicit controller.** Use `block_sparse_joints` or `block_sparse_levels` where armature requires them. Keep local compliant ALM available only for compatible zero-armature models; document its static friction versus sparse regularized friction. Send appropriate model-change notifications. Reset VBD with `flags=0`, write measured/full-turn coordinates and velocities into both buffers, run FK, reset pipeline contact matching and actuator state, then let VBD's schedule generate fresh contacts. Read fork-published joint outputs directly without `eval_ik` or overwriting body poses. Normalize public collision-slot/frequency enums and Warp deterministic options; classify the fork's documented ignored VBD options explicitly, including the three `rigid_contact_stick_*_eps` fields, `rigid_tendon_relaxation`, and `rigid_enable_dahl_friction`. +- [ ] **Step 4: Run real VBD acceptance and document the example.** `test_vbd_sysid_changes_friction_damping_and_sparse_armature` proves each supported property affects motion. `test_vbd_reset_preserves_continuous_turns_and_cold_contacts` checks A/B/A and contact resets. `test_vbd_external_pd_cuda_matches_eager` covers full bias/actuator/solver graph execution and live candidates. A short SO-101 sparse VBD run uses explicit `controller.implementation: external_implicit`, effort limits, ignored velocity, finite scores, common outputs, and fresh-process fitted-model replay matching its logged MSE. Do not require identical identified parameters across MuJoCo and VBD. Test BDF2 settings only under the fork's documented restrictions, with early errors for incompatible models. +- [ ] **Step 5: Gate, commit, review, and prepare PR 5.** Run full acceptance for native/external MuJoCo, VBD, and toy backend, then commit as `feat: support VBD actuator system identification` and prepare its separate PR. + +## Stage acceptance and finishing + +For every product stage run from the repository root: + +```bash +uv run ruff check +uv run ruff format --check +uv run pyright +uv run pytest +uv run pytest -o "addopts=" +``` + +The final command includes integration tests because all stages affect shared simulation/task infrastructure or its dependencies. Run tests once after the final relevant edits; repeat only for new failures or changes. Report actual hardware skips, download/environment failures, and unrelated baseline failures without weakening assertions or claiming unexecuted checks passed. + +The existing relevant integration gates are: + +```bash +uv run pytest -m integration tests/integration/so101_actuator_sysid/test_cli.py +uv run pytest -m integration tests/integration/g1/test_training.py +``` + +New integration modules join the targeted gate when their stage lands. Independent review checks the design and tests against the exact diff before PR creation. Use a temporary body file with `gh pr create --draft --body-file ...`, describe only the completed stage and observed validation, then attach its URL with the app artifact tool. Preserve separate stage branches/PRs and wait for stage acceptance before beginning dependent stages. + +## Planning evidence and self-review + +- Dependency migration research verified `copy_count`, explicit collision pipelines, intrinsic coordinate targets, retained native APIs, and the actual fork dependency floors. +- Backend research verified the USD assumption in the base context, eager-import cycles, polymorphic Pydantic serialization, and a real installed-metadata fixture rather than mocked discovery. +- Solver/actuator research verified owned `contacts=None`, packed gain views after implicit binding, per-call bias scratch allocation, full coupled response, and fresh-process replay requirements. +- Coverage: Tasks 1–2 cover the pinned runtime; Tasks 3–4 cover backend/config/context/export/discovery; Tasks 5–6 cover settings/identity/provenance; Tasks 7–8 cover implicit PD/bias/clamp/reset/capture/export; Task 9 covers VBD capabilities, runtime, examples, and replay. No design section is assigned to an unimplemented future stage outside these five PRs. +- Self-review checked interface definitions before consumers, export/provenance types, legacy/raw option entry points, context identity including controller mode, and the ownership of captured callbacks. File arrangement and helper bodies remain implementation choices; user-visible configuration names, supported modes, physics sequence, error behavior, and acceptance boundaries are fixed by this plan and the approved design. diff --git a/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md b/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md index f2ca6ae..3b5a263 100644 --- a/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md +++ b/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md @@ -1,7 +1,7 @@ # Pluggable sysID backends and configurable Newton solvers Date: 2026-10-29 -Status: Builder-reviewed draft; awaiting design approval +Status: Approved on 2026-10-29; implementation plan in review ## Intent and agreed scope From 47e23f9dfbfbac1c43f165b1f632b73b82993cff Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 14:06:29 -0700 Subject: [PATCH 03/16] build: pin Newton rigid VBD integration revision --- THIRD_PARTY_LICENSES.md | 54 +- anchor_bench/core/simulation/newton.py | 7 +- .../2026-10-29-sysid-backends-and-solvers.md | 10 +- docs/system-identification.md | 6 + pyproject.toml | 2 +- tests/integration/usd_trajectory.py | 6 +- tests/test_newton_simulation_context.py | 51 +- uv.lock | 793 ++++++++++++++---- 8 files changed, 748 insertions(+), 181 deletions(-) diff --git a/THIRD_PARTY_LICENSES.md b/THIRD_PARTY_LICENSES.md index 0ba3464..61c6aeb 100644 --- a/THIRD_PARTY_LICENSES.md +++ b/THIRD_PARTY_LICENSES.md @@ -1,22 +1,27 @@ # Third-Party Licenses Anchor Bench is licensed under Apache-2.0 (see `LICENSE`). It does not vendor or -redistribute third-party source code; the packages below are resolved from PyPI at -install time and are listed here to attribute each dependency and its license. +redistribute third-party source code; the packages below are resolved from PyPI, +[NVIDIA's package index](https://pypi.nvidia.com/), or pinned Git sources at install +time and are listed here to attribute each dependency and its license. -- **182** packages are installed alongside the project at runtime and are +- **200** packages are installed alongside the project at runtime and are marked *Distributed*. - **8** are build, lint, or test tools only, marked *Development only*, and are never shipped to users. -Each entry is pinned to the exact version in `uv.lock`. License identifiers come from -the corresponding release's PyPI metadata. Consult each project for its full license -text, which its distribution includes. +Each entry is pinned to the exact version in `uv.lock`. License identifiers come +from the corresponding release's PyPI metadata or the pinned source's package +metadata. Consult each project for its full license text, which its distribution +includes. + +Newton is installed from revision +[`1e5036c48ec92d44782dfe0f448dc25d64984b58`](https://github.com/skulkar22/newton/commit/1e5036c48ec92d44782dfe0f448dc25d64984b58) +of `skulkar22/newton`; its package metadata declares Apache-2.0. | Package | Version | License | Usage | | --- | --- | --- | --- | | absl-py | 2.5.0 | Apache-2.0 | Distributed | -| addict | 2.4.0 | MIT License | Distributed | | aiohappyeyeballs | 2.7.1 | Python Software Foundation License | Distributed | | aiohttp | 3.14.3 | Apache-2.0 AND MIT | Distributed | | aiosignal | 1.4.0 | Apache Software License | Distributed | @@ -25,6 +30,7 @@ text, which its distribution includes. | annotated-doc | 0.0.5 | MIT | Distributed | | annotated-types | 0.8.0 | MIT | Distributed | | anyio | 4.14.2 | MIT | Distributed | +| asttokens | 3.0.2 | Apache 2.0 | Distributed | | async-timeout | 5.0.1 | Apache Software License | Distributed | | attrs | 26.1.0 | MIT | Distributed | | blinker | 1.9.0 | MIT License | Distributed | @@ -36,7 +42,7 @@ text, which its distribution includes. | click-log | 0.4.0 | MIT License | Distributed | | cloudpickle | 3.1.2 | BSD License | Distributed | | cmaes | 0.13.0 | MIT | Distributed | -| coacd | 1.0.11 | MIT License | Distributed | +| coacd | 1.0.14 | MIT License | Distributed | | colorama | 0.4.6 | BSD License | Distributed | | colorlog | 6.12.0 | MIT License | Distributed | | comm | 0.2.3 | BSD License | Distributed | @@ -51,10 +57,12 @@ text, which its distribution includes. | cycler | 0.12.1 | BSD License | Distributed | | dash | 4.4.1 | MIT License | Distributed | | databricks-sdk | 0.67.0 | Apache Software License | Distributed | +| decorator | 5.3.1 | BSD-2-Clause | Distributed | | docker | 7.2.0 | Apache-2.0 | Distributed | | etils | 1.13.0 | Apache Software License | Distributed | | etils | 1.14.0 | Apache Software License | Distributed | | exceptiongroup | 1.3.1 | MIT License | Distributed | +| executing | 2.3.0 | MIT License | Distributed | | fast-simplification | 0.1.13 | MIT License | Distributed | | fastapi | 0.141.1 | MIT | Distributed | | fastjsonschema | 2.22.1 | BSD License | Distributed | @@ -79,35 +87,42 @@ text, which its distribution includes. | importlib-metadata | 9.0.0 | Apache-2.0 | Distributed | | importlib-resources | 7.1.0 | Apache-2.0 | Distributed | | iniconfig | 2.3.0 | MIT | Development only | +| ipython | 8.39.0 | BSD License | Distributed | +| ipython | 9.17.1 | BSD-3-Clause | Distributed | +| ipython-pygments-lexers | 1.1.1 | BSD License | Distributed | +| ipywidgets | 8.1.9 | BSD License | Distributed | | itsdangerous | 2.2.0 | BSD License | Distributed | | janus | 2.0.0 | Apache Software License | Distributed | +| jedi | 0.20.1 | MIT License | Distributed | | jinja2 | 3.1.6 | BSD License | Distributed | | joblib | 1.5.3 | BSD-3-Clause | Distributed | | jsonschema | 4.26.0 | MIT | Distributed | | jsonschema-specifications | 2025.9.1 | MIT | Distributed | | jupyter-core | 5.9.1 | BSD-3-Clause | Distributed | +| jupyterlab-widgets | 3.0.17 | BSD License | Distributed | | kiwisolver | 1.5.0 | BSD License | Distributed | | mako | 1.4.1 | MIT | Distributed | | markdown-it-py | 4.2.0 | MIT License | Distributed | | markupsafe | 3.0.3 | BSD-3-Clause | Distributed | | matplotlib | 3.10.9 | Python Software Foundation License | Distributed | | matplotlib | 3.11.1 | Python Software Foundation License | Distributed | +| matplotlib-inline | 0.2.2 | BSD-3-Clause | Distributed | | mdurl | 0.1.2 | MIT License | Distributed | | meshio | 5.3.5 | MIT License | Distributed | | mlflow | 3.15.2 | Apache Software License | Distributed | | mlflow-skinny | 3.15.2 | Apache Software License | Distributed | | mlflow-tracing | 3.15.2 | Apache Software License | Distributed | | mpmath | 1.3.0 | BSD License | Distributed | -| mujoco | 3.10.0 | Apache-2.0 | Distributed | -| mujoco-warp | 3.10.0.3 | Apache-2.0 | Distributed | +| mujoco | 3.16.0 | Apache-2.0 | Distributed | +| mujoco-warp | 3.16.0 | Apache-2.0 | Distributed | | multidict | 6.7.1 | Apache License 2.0 | Distributed | | narwhals | 2.24.0 | MIT | Distributed | | nbformat | 5.11.0 | BSD License | Distributed | | nest-asyncio | 1.6.0 | BSD License | Distributed | | networkx | 3.4.2 | BSD License | Distributed | | networkx | 3.6.1 | BSD-3-Clause | Distributed | -| newton | 1.4.0 | Apache-2.0 | Distributed | -| newton-usd-schemas | 0.4.1 | Apache-2.0 | Distributed | +| newton | 1.8.0.dev0 | Apache-2.0 | Distributed | +| newton-usd-schemas | 0.6.0 | Apache-2.0 | Distributed | | nodeenv | 1.10.0 | BSD License | Development only | | numpy | 2.2.6 | BSD License | Distributed | | numpy | 2.4.6 | BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0 | Distributed | @@ -127,7 +142,7 @@ text, which its distribution includes. | nvidia-nvjitlink | 13.3.33 | UNRESOLVED | Distributed | | nvidia-nvshmem-cu13 | 3.4.5 | UNRESOLVED | Distributed | | nvidia-nvtx | 13.0.85 | Apache 2.0 | Distributed | -| open3d | 0.19.0 | MIT License | Distributed | +| open3d | 0.20.0 | MIT License | Distributed | | opentelemetry-api | 1.44.0 | Apache-2.0 | Distributed | | opentelemetry-proto | 1.44.0 | Apache-2.0 | Distributed | | opentelemetry-sdk | 1.44.0 | Apache-2.0 | Distributed | @@ -135,13 +150,19 @@ text, which its distribution includes. | optuna | 4.9.0 | MIT License | Distributed | | packaging | 26.3 | Apache-2.0 OR BSD-2-Clause | Distributed | | pandas | 2.3.3 | BSD License | Distributed | +| parso | 0.8.7 | MIT License | Distributed | +| pexpect | 4.9.0 | ISC License (ISCL) | Distributed | | pillow | 12.3.0 | MIT-CMU | Distributed | | platformdirs | 4.11.0 | MIT | Distributed | | plotly | 6.9.0 | MIT | Distributed | | pluggy | 1.6.0 | MIT License | Development only | | prettytable | 3.18.0 | BSD-3-Clause | Distributed | +| prompt-toolkit | 3.0.53 | BSD License | Distributed | | propcache | 0.5.2 | Apache Software License | Distributed | | protobuf | 7.36.0 | 3-Clause BSD License | Distributed | +| psutil | 7.2.2 | BSD-3-Clause | Distributed | +| ptyprocess | 0.7.0 | ISC License (ISCL) | Distributed | +| pure-eval | 0.2.4 | MIT License | Distributed | | pyarrow | 25.0.0 | Apache-2.0 | Distributed | | pyasn1 | 0.6.4 | BSD-2-Clause | Distributed | | pyasn1-modules | 0.4.2 | BSD License | Distributed | @@ -152,7 +173,6 @@ text, which its distribution includes. | pygments | 2.20.0 | BSD-2-Clause | Distributed | | pyopengl | 3.1.10 | BSD License | Distributed | | pyparsing | 3.3.2 | MIT | Distributed | -| pyquaternion | 0.9.9 | MIT License | Distributed | | pyright | 1.1.411 | MIT | Development only | | pytest | 9.1.1 | MIT | Development only | | pytest-cov | 7.1.0 | MIT | Development only | @@ -182,6 +202,7 @@ text, which its distribution includes. | smmap | 5.0.3 | BSD License | Distributed | | sqlalchemy | 2.0.51 | MIT | Distributed | | sqlparse | 0.6.0 | BSD License | Distributed | +| stack-data | 0.6.3 | MIT License | Distributed | | starlette | 1.4.1 | BSD-3-Clause | Distributed | | sympy | 1.14.0 | BSD License | Distributed | | threadpoolctl | 3.6.0 | BSD License | Distributed | @@ -200,9 +221,12 @@ text, which its distribution includes. | usd-exchange | 2.3.0 | Apache-2.0 | Distributed | | uvicorn | 0.52.1 | BSD-3-Clause | Distributed | | waitress | 3.0.2 | Zope Public License | Distributed | -| warp-lang | 1.16.0 | Apache-2.0 | Distributed | +| warp-lang | 1.18.0 | Apache-2.0 | Distributed | | wcwidth | 0.8.2 | MIT | Distributed | +| websockets | 16.1.1 | BSD-3-Clause | Distributed | +| websockets | 17.3 | BSD-3-Clause | Distributed | | werkzeug | 3.1.8 | BSD-3-Clause | Distributed | +| widgetsnbextension | 4.0.16 | BSD License | Distributed | | yarl | 1.24.5 | Apache-2.0 | Distributed | | zipp | 4.1.0 | MIT | Distributed | diff --git a/anchor_bench/core/simulation/newton.py b/anchor_bench/core/simulation/newton.py index dae5a4c..b1584a4 100644 --- a/anchor_bench/core/simulation/newton.py +++ b/anchor_bench/core/simulation/newton.py @@ -32,6 +32,7 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): _configuration_key: Hashable | None _solver_options: dict[str, Any] _control: newton.Control + _collision_pipeline: newton.CollisionPipeline _contacts: newton.Contacts _solver: newton.solvers.SolverMuJoCo _step_executor: NewtonStepExecutor @@ -101,12 +102,13 @@ def initialize( configure_builder(template) builder = self._create_builder() - builder.replicate(template, world_count=world_count) + builder.replicate(template, copy_count=world_count) model = builder.finalize() state = model.state() state_next = model.state() control = model.control() - contacts = model.contacts() + collision_pipeline = newton.CollisionPipeline(model, broad_phase="explicit") + contacts = collision_pipeline.contacts() solver = newton.solvers.SolverMuJoCo(model, **requested_solver_options) step_executor = NewtonStepExecutor( model=model, @@ -120,6 +122,7 @@ def initialize( self._model = model self._state = state self._control = control + self._collision_pipeline = collision_pipeline self._contacts = contacts self._solver = solver self._step_executor = step_executor diff --git a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md index cbcb299..eec3249 100644 --- a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md +++ b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md @@ -74,11 +74,11 @@ Paths above are relative to `anchor_bench/`. Tests and documentation are named i **Interfaces:** Preserve `NewtonSimulationContext(usd_path: str, *, fixed_base: bool=False)` and `initialize(world_count=...)`. Internally use `builder.replicate(template, copy_count=world_count)` and an owned `CollisionPipeline(model, broad_phase="explicit")` with `pipeline.contacts()`. -- [ ] **Step 1: Write migration regressions.** Extend `test_initializes_one_configurable_replicated_simulation` and `test_lazily_builds_one_newton_model_and_state`: record `copy_count`, one pipeline, contacts identity, attributes registered before import/finalize, and unchanged MuJoCo options. Have fakes reject the deprecated `world_count` replicate keyword and deprecated `model.contacts()` path. -- [ ] **Step 2: Run the red tests.** `uv run pytest tests/test_newton_simulation_context.py -q`; require failures at the old construction calls. Record dependency/version availability separately rather than mistaking installation failure for a behavioral red test. -- [ ] **Step 3: Pin and migrate.** Set the dependency to `newton[importers,sim] @ git+https://github.com/skulkar22/newton.git@1e5036c48ec92d44782dfe0f448dc25d64984b58`; run `uv lock` and `uv sync --locked --extra dev`. Use the public construction APIs above; remove the obsolete `newton.use_coord_layout_targets` assignment from the integration helper. Do not add external collision stepping to native MuJoCo. -- [ ] **Step 4: Verify resolution and tests.** Run `uv lock --check`, the Task 1 tests, and inspect Newton's installed `direct_url.json`: `vcs_info.commit_id` must equal the full SHA and package version must be `1.8.0.dev0`. Keep importer/sim extras. Resolve root constraints for Warp >=1.17.0, MuJoCo/MJWarp ~=3.16.0, and schemas >=0.5.0; update affected third-party version/source rows from the actual lock. Do not assume the dependency's uv index settings propagate to the root. -- [ ] **Step 5: Gate and commit.** Run the applicable lint/type gates plus targeted construction tests. Commit as `build: pin Newton rigid VBD integration revision` including migration and license-manifest changes. Do not expose VBD or change native actuation in this task. +- [x] **Step 1: Write migration regressions.** Extend `test_initializes_one_configurable_replicated_simulation` and `test_lazily_builds_one_newton_model_and_state`: record `copy_count`, one pipeline, contacts identity, attributes registered before import/finalize, and unchanged MuJoCo options. Have fakes reject the deprecated `world_count` replicate keyword and deprecated `model.contacts()` path. +- [x] **Step 2: Run the red tests.** `uv run pytest tests/test_newton_simulation_context.py -q`; require failures at the old construction calls. Record dependency/version availability separately rather than mistaking installation failure for a behavioral red test. +- [x] **Step 3: Pin and migrate.** Set the dependency to `newton[importers,sim] @ git+https://github.com/skulkar22/newton.git@1e5036c48ec92d44782dfe0f448dc25d64984b58`; run `uv lock` and `uv sync --locked --extra dev`. Use the public construction APIs above; remove the obsolete `newton.use_coord_layout_targets` assignment from the integration helper. Do not add external collision stepping to native MuJoCo. +- [x] **Step 4: Verify resolution and tests.** Run `uv lock --check`, the Task 1 tests, and inspect Newton's installed `direct_url.json`: `vcs_info.commit_id` must equal the full SHA and package version must be `1.8.0.dev0`. Keep importer/sim extras. Resolve root constraints for Warp >=1.17.0, MuJoCo/MJWarp ~=3.16.0, and schemas >=0.5.0; update affected third-party version/source rows from the actual lock. Do not assume the dependency's uv index settings propagate to the root. +- [x] **Step 5: Gate and commit.** Run the applicable lint/type gates plus targeted construction tests. Commit as `build: pin Newton rigid VBD integration revision` including migration and license-manifest changes. Do not expose VBD or change native actuation in this task. ### Task 2: Verify real native sysID, replay, and training on the fork diff --git a/docs/system-identification.md b/docs/system-identification.md index 3656f0f..1297b52 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -8,6 +8,12 @@ recorded state. Newton's simulation components are included in the default Anchor Bench installation. +The Newton dependency is pinned to revision +[`1e5036c48ec92d44782dfe0f448dc25d64984b58`](https://github.com/skulkar22/newton/commit/1e5036c48ec92d44782dfe0f448dc25d64984b58) +of the `dev/rigid-vbd-integration` branch in `skulkar22/newton`. Installing +Anchor Bench resolves that exact revision rather than the moving branch head. +The current sysID configuration continues to use MuJoCo. + ## Run the included example The maintained SO-101 example includes its source USD and three recorded diff --git a/pyproject.toml b/pyproject.toml index b8e8f0b..b86f593 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ dependencies = [ "cmaes", "GitPython==3.1.60", "mlflow>=3.15.2,<4", - "newton[importers,sim]==1.4.0", + "newton[importers,sim] @ git+https://github.com/skulkar22/newton.git@1e5036c48ec92d44782dfe0f448dc25d64984b58", "numpy>=1.23,<3", "optuna>=4.9,<5", "pandas>=2.1,<3", diff --git a/tests/integration/usd_trajectory.py b/tests/integration/usd_trajectory.py index 2cf531f..0abb99f 100644 --- a/tests/integration/usd_trajectory.py +++ b/tests/integration/usd_trajectory.py @@ -94,7 +94,6 @@ class _NewtonTrajectoryRunner: """Replay measured commands using actuator properties authored in one USD.""" def __init__(self, config: ActuatorSysIdConfig) -> None: - newton.use_coord_layout_targets = True builder = newton.ModelBuilder() newton.solvers.SolverMuJoCo.register_custom_attributes(builder) builder.add_usd( @@ -102,6 +101,9 @@ def __init__(self, config: ActuatorSysIdConfig) -> None: floating=False, ) self._model = builder.finalize() + self._collision_pipeline = newton.CollisionPipeline( + self._model, broad_phase="explicit" + ) self._solver = newton.solvers.SolverMuJoCo( self._model, solver="newton", @@ -110,7 +112,7 @@ def __init__(self, config: ActuatorSysIdConfig) -> None: integrator=config.simulation.solver.integrator, ) self._newton = newton - self._contacts = self._model.contacts() + self._contacts = self._collision_pipeline.contacts() self._control_dt = 1.0 / config.simulation.control_freq self._substeps = ( config.simulation.physics_freq // config.simulation.control_freq diff --git a/tests/test_newton_simulation_context.py b/tests/test_newton_simulation_context.py index c09e294..04d5f9e 100644 --- a/tests/test_newton_simulation_context.py +++ b/tests/test_newton_simulation_context.py @@ -16,7 +16,6 @@ class FakeModel: def __init__(self) -> None: self.states = [] self.control_buffer = object() - self.contacts_buffer = object() def state(self): """Return a new fake state.""" @@ -31,7 +30,24 @@ def control(self): return self.control_buffer def contacts(self): - """Return the model contacts buffer.""" + """Reject Newton's deprecated model-level contacts factory.""" + + raise AssertionError("Construct contacts through CollisionPipeline.contacts().") + + +class FakeCollisionPipeline: + """Own contacts independently of Newton's deprecated model factory.""" + + instances: ClassVar[list["FakeCollisionPipeline"]] = [] + + def __init__(self, model: FakeModel, *, broad_phase: str) -> None: + self.model = model + self.broad_phase = broad_phase + self.contacts_buffer = object() + self.instances.append(self) + + def contacts(self): + """Return this pipeline's shared contacts buffer.""" return self.contacts_buffer @@ -61,7 +77,8 @@ class FakeModelBuilder: def __init__(self) -> None: self.usd_source = None self.replicated_template = None - self.world_count = 1 + self.copy_count = 1 + self.custom_attributes_registered = False self.world_gravity = [] self.floating = None self.options = {} @@ -78,6 +95,7 @@ def add_usd( ) -> None: """Record the USD source passed to Newton.""" + assert self.custom_attributes_registered self.usd_source = source self.floating = floating self.options = options @@ -85,18 +103,19 @@ def add_usd( def finalize(self) -> FakeModel: """Return the finalized fake model.""" + assert self.custom_attributes_registered return self.model def replicate( self, template: "FakeModelBuilder", *, - world_count: int, + copy_count: int, ) -> None: """Record a replicated model request.""" self.replicated_template = template - self.world_count = world_count + self.copy_count = copy_count class FakeSolver: @@ -107,6 +126,7 @@ class FakeSolver: @classmethod def register_custom_attributes(cls, builder: FakeModelBuilder) -> None: + builder.custom_attributes_registered = True cls.registered_builders.append(builder) def __init__(self, model: FakeModel, **options: Any) -> None: @@ -144,6 +164,7 @@ def _install_fake_newton(monkeypatch: pytest.MonkeyPatch) -> None: fake_newton = SimpleNamespace( ModelBuilder=FakeModelBuilder, + CollisionPipeline=FakeCollisionPipeline, solvers=SimpleNamespace(SolverMuJoCo=FakeSolver), ) monkeypatch.setattr( @@ -152,6 +173,7 @@ def _install_fake_newton(monkeypatch: pytest.MonkeyPatch) -> None: ) FakeModelBuilder.instance_count = 0 FakeModelBuilder.instances = [] + FakeCollisionPipeline.instances = [] FakeSolver.registered_builders = [] FakeSolver.instances = [] @@ -192,7 +214,8 @@ def test_lazily_builds_one_newton_model_and_state( assert template.options == {} assert template.world_gravity == [] assert population.replicated_template is template - assert population.world_count == 1 + assert population.copy_count == 1 + assert FakeSolver.registered_builders == [template, population] assert model is fake_model assert state is fake_model.states[0] assert loaded_model is model @@ -200,10 +223,16 @@ def test_lazily_builds_one_newton_model_and_state( assert context.state is fake_model.states[0] assert context.state_next is fake_model.states[1] assert context.control is fake_model.control_buffer - assert context.contacts is fake_model.contacts_buffer + pipeline = FakeCollisionPipeline.instances[0] + assert pipeline.model is fake_model + assert pipeline.broad_phase == "explicit" + assert context._collision_pipeline is pipeline + assert context.contacts is pipeline.contacts_buffer assert context.solver is FakeSolver.instances[0] + assert FakeSolver.instances[0].options == {} assert context.world_count == 1 assert FakeModelBuilder.instance_count == 2 + assert len(FakeCollisionPipeline.instances) == 1 def test_initializes_one_configurable_replicated_simulation( @@ -234,14 +263,20 @@ def test_initializes_one_configurable_replicated_simulation( assert template.usd_source == str(source) assert configured == [template] assert population.replicated_template is template - assert population.world_count == 4 + assert population.copy_count == 4 assert context.model is population.model fake_solver = FakeSolver.instances[0] assert context.solver is fake_solver assert fake_solver.model is population.model assert fake_solver.options == {"iterations": 5} + pipeline = FakeCollisionPipeline.instances[0] + assert pipeline.model is population.model + assert pipeline.broad_phase == "explicit" + assert context._collision_pipeline is pipeline + assert context.contacts is pipeline.contacts_buffer assert FakeModelBuilder.instance_count == 2 assert len(FakeSolver.instances) == 1 + assert len(FakeCollisionPipeline.instances) == 1 def test_rejects_conflicting_reinitialization( diff --git a/uv.lock b/uv.lock index 8954f2d..e01e75c 100644 --- a/uv.lock +++ b/uv.lock @@ -17,15 +17,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/58/0a/a10b45aab35b175aded078a462dc8d0c698f5b13946e7cb0869097b78bb6/absl_py-2.5.0-py3-none-any.whl", hash = "sha256:0f17b89f2a4eaaedc4f28c622998aa690564b3012a396a4ffad0821007fe03ba", size = 137410, upload-time = "2026-07-03T10:57:46.735Z" }, ] -[[package]] -name = "addict" -version = "2.4.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/85/ef/fd7649da8af11d93979831e8f1f8097e85e82d5bfeabc8c68b39175d8e75/addict-2.4.0.tar.gz", hash = "sha256:b3b2210e0e067a281f5646c8c5db92e99b7231ea8b0eb5f74dbdf9e259d4e494", size = 9186, upload-time = "2020-11-21T16:21:31.416Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6a/00/b08f23b7d7e1e14ce01419a467b583edbb93c6cdb8654e54a9cc579cd61f/addict-2.4.0-py3-none-any.whl", hash = "sha256:249bb56bbfd3cdc2a004ea0ff4c2b6ddc84d53bc2194761636eb314d5cfa5dfc", size = 3832, upload-time = "2020-11-21T16:21:29.588Z" }, -] - [[package]] name = "aiohappyeyeballs" version = "2.7.1" @@ -262,7 +253,7 @@ requires-dist = [ { name = "cmaes" }, { name = "gitpython", specifier = "==3.1.60" }, { name = "mlflow", specifier = ">=3.15.2,<4" }, - { name = "newton", extras = ["importers", "sim"], specifier = "==1.4.0" }, + { name = "newton", extras = ["importers", "sim"], git = "https://github.com/skulkar22/newton.git?rev=1e5036c48ec92d44782dfe0f448dc25d64984b58" }, { name = "numpy", specifier = ">=1.23,<3" }, { name = "optuna", specifier = ">=4.9,<5" }, { name = "pandas", specifier = ">=2.1,<3" }, @@ -314,6 +305,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/da/35/f2287558c17e29fafc8ef3daf819bb9834061cfa43bff8014f7df7f63bdc/anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494", size = 125813, upload-time = "2026-07-12T20:29:05.763Z" }, ] +[[package]] +name = "asttokens" +version = "3.0.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/25/1e/faf0f247f6f881b98fc4d6d07e14085cb89d13665084e6d6ac1dc2c03d0b/asttokens-3.0.2.tar.gz", hash = "sha256:3ecdbd8f2cc195f53ccada3a613538bb5f9ef6f6869129f13e03c30a677b8fe2", size = 63136, upload-time = "2026-07-12T03:31:49.084Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d4/2b/04b8a15f3a1c77bc79ddf5c73875327f34b4fa75982df2b76e45e402d364/asttokens-3.0.2-py3-none-any.whl", hash = "sha256:9da13157f5b28becde0bd374fc677dcd3c290614264eff096f167c469cd9f933", size = 28702, upload-time = "2026-07-12T03:31:47.542Z" }, +] + [[package]] name = "async-timeout" version = "5.0.1" @@ -605,18 +605,18 @@ wheels = [ [[package]] name = "coacd" -version = "1.0.11" +version = "1.0.14" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" }, - { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and python_full_version < '3.14'" }, + { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/1d/3b/434beab9e1754ca0ae3a619b383243dd85aa65d03a4dc7333c8296c97a92/coacd-1.0.11-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:adbc58259a721cc5ede24cc8c2671a95e75a8a52dc1ee4d953d80d236b192da9", size = 3299264, upload-time = "2026-05-04T19:23:36.183Z" }, - { url = "https://files.pythonhosted.org/packages/cb/a7/06f63baa29198f681ba60848e3271cc625eddd61cd4e59071f56ffce9362/coacd-1.0.11-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e376fadb22790444c7253f0cee9104a1af01ec965488c1318e84e3b2dbf1e2a3", size = 2573832, upload-time = "2026-05-04T19:23:38.008Z" }, - { url = "https://files.pythonhosted.org/packages/0e/b4/057c78f7b16b87871cfcecc6febe70522e77a2a33f8788960377152c224d/coacd-1.0.11-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a60f700a52e5b40462e508c14bb756cd63ce7e6a95ff72ae0b1592be1dbb0106", size = 2640170, upload-time = "2026-05-04T19:23:39.322Z" }, - { url = "https://files.pythonhosted.org/packages/00/83/c50472ce98175fddd86d4aba861fea89f30350a5487880b3a81d34915a85/coacd-1.0.11-cp39-abi3-win_amd64.whl", hash = "sha256:4de22f70d1a3fa8c44698c8006a223fe5fb0ee84b76adecf3726cf2003e9145f", size = 1465079, upload-time = "2026-05-04T19:23:41.604Z" }, + { url = "https://files.pythonhosted.org/packages/3d/94/622a380a5c4cac78c1f19379b1d3fa193903f848311c200924309797abf8/coacd-1.0.14-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:4cd9e1f327af766f6364e79e384ebfe152780a3d8dbbd09ce0756ec14f9e1256", size = 3426003, upload-time = "2026-08-28T21:53:32.005Z" }, + { url = "https://files.pythonhosted.org/packages/d6/3e/e930a366ec69a966f1a55307b52d036d266314e2f6c58e72e212fdc09182/coacd-1.0.14-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1242941fc9d49ebcb0368c68f31c86e278b9a6f1a255d11da2f1668797e2626e", size = 2584591, upload-time = "2026-08-28T21:53:33.537Z" }, + { url = "https://files.pythonhosted.org/packages/88/7c/ec7edfc77c48fe97434ae813eca7614103289105bb546952ed9a0a266ce8/coacd-1.0.14-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c135b717af096523bbebf1fd8d326e8950c024237fe9806ad46dedd8b4c31f0", size = 2651838, upload-time = "2026-08-28T21:53:34.776Z" }, + { url = "https://files.pythonhosted.org/packages/5f/28/edbc4d6766fb3504bf15dabe7340e5686c72b9e3be030b3c8c40469e7af6/coacd-1.0.14-cp39-abi3-win_amd64.whl", hash = "sha256:6b548f44d9a4694cde594dc8cc8fefa678fb7c88153583be4e8b2c707de8fbbd", size = 1487726, upload-time = "2026-08-28T21:53:36.6Z" }, ] [[package]] @@ -1099,18 +1099,18 @@ name = "dash" version = "4.4.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "comm", marker = "python_full_version < '3.14'" }, - { name = "flask", marker = "python_full_version < '3.14'" }, - { name = "importlib-metadata", marker = "python_full_version < '3.14'" }, - { name = "janus", marker = "python_full_version < '3.14'" }, - { name = "nest-asyncio", marker = "python_full_version < '3.14'" }, - { name = "plotly", marker = "python_full_version < '3.14'" }, - { name = "pydantic", marker = "python_full_version < '3.14'" }, - { name = "requests", marker = "python_full_version < '3.14'" }, - { name = "retrying", marker = "python_full_version < '3.14'" }, - { name = "setuptools", marker = "python_full_version < '3.14'" }, - { name = "typing-extensions", marker = "python_full_version < '3.14'" }, - { name = "werkzeug", marker = "python_full_version < '3.14'" }, + { name = "comm" }, + { name = "flask" }, + { name = "importlib-metadata" }, + { name = "janus" }, + { name = "nest-asyncio" }, + { name = "plotly" }, + { name = "pydantic" }, + { name = "requests" }, + { name = "retrying" }, + { name = "setuptools" }, + { name = "typing-extensions" }, + { name = "werkzeug" }, ] sdist = { url = "https://files.pythonhosted.org/packages/5a/67/d5cea6dedfbfde4165436fb58154480ea6358a9e71a739d3366575b5b724/dash-4.4.1.tar.gz", hash = "sha256:9356ca7856bc496c12c5b6de5978aaf783e090d07450ee395ade1c0c2cbdf816", size = 8536482, upload-time = "2026-07-21T18:58:19.72Z" } wheels = [ @@ -1130,6 +1130,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a0/ca/2aff3817041483fb8e4f75a74a36ff4ca3a826e276becd1179a591b6348f/databricks_sdk-0.67.0-py3-none-any.whl", hash = "sha256:ef49e49db45ed12c015a32a6f9d4ba395850f25bb3dcffdcaf31a5167fe03ee2", size = 718422, upload-time = "2025-09-25T13:32:09.011Z" }, ] +[[package]] +name = "decorator" +version = "5.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/60/8b/32f9823da46cde7df2087faa08cd98d01b908f8dcab982cdba9c84e85355/decorator-5.3.1.tar.gz", hash = "sha256:4cbcdd55a6efadb9dbea26b858f4fb3264567b52d69ca0d25b721b553f60ea82", size = 58084, upload-time = "2026-05-18T06:03:28.057Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/05/7f/798705f5296a58ca505d600456748d1be48078eac8a7050d8a98bc9edb89/decorator-5.3.1-py3-none-any.whl", hash = "sha256:f47fe6fdbd2edd623ecfe36875d37aba411624e2670dd395dddae1358689bb3c", size = 10365, upload-time = "2026-05-18T06:03:26.517Z" }, +] + [[package]] name = "docker" version = "7.2.0" @@ -1197,6 +1206,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740, upload-time = "2025-11-21T23:01:53.443Z" }, ] +[[package]] +name = "executing" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/52/92/8a611141e42930c0f194f7504063ab87dfe970cf1a5af28e7703df448734/executing-2.3.0.tar.gz", hash = "sha256:15919cb5d667e5cb4e099511971d00d659573fff2dd5c4e6cd8b71636c7858d2", size = 1338003, upload-time = "2026-10-10T14:06:04.64Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4d/dd/8bc67e7d5ffc1d88aa5af511189dfb76dc4e1e5b808fab186146ef2663e5/executing-2.3.0-py3-none-any.whl", hash = "sha256:736e859c9f8701f11fcf516856f26f562e04776387824b43a35a1dfe21c84122", size = 29393, upload-time = "2026-10-10T14:06:02.777Z" }, +] + [[package]] name = "fast-simplification" version = "0.1.13" @@ -1700,6 +1718,87 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, ] +[[package]] +name = "ipython" +version = "8.39.0" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11'", +] +dependencies = [ + { name = "colorama", marker = "python_full_version < '3.11' and sys_platform == 'win32'" }, + { name = "decorator", marker = "python_full_version < '3.11'" }, + { name = "exceptiongroup", marker = "python_full_version < '3.11'" }, + { name = "jedi", marker = "python_full_version < '3.11'" }, + { name = "matplotlib-inline", marker = "python_full_version < '3.11'" }, + { name = "pexpect", marker = "python_full_version < '3.11' and sys_platform != 'emscripten' and sys_platform != 'win32'" }, + { name = "prompt-toolkit", marker = "python_full_version < '3.11'" }, + { name = "pygments", marker = "python_full_version < '3.11'" }, + { name = "stack-data", marker = "python_full_version < '3.11'" }, + { name = "traitlets", marker = "python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/40/18/f8598d287006885e7136451fdea0755af4ebcbfe342836f24deefaed1164/ipython-8.39.0.tar.gz", hash = "sha256:4110ae96012c379b8b6db898a07e186c40a2a1ef5d57a7fa83166047d9da7624", size = 5513971, upload-time = "2026-03-27T10:02:13.94Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c0/56/4cc7fc9e9e3f38fd324f24f8afe0ad8bb5fa41283f37f1aaf9de0612c968/ipython-8.39.0-py3-none-any.whl", hash = "sha256:bb3c51c4fa8148ab1dea07a79584d1c854e234ea44aa1283bcb37bc75054651f", size = 831849, upload-time = "2026-03-27T10:02:07.846Z" }, +] + +[[package]] +name = "ipython" +version = "9.17.1" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.14'", + "python_full_version >= '3.12' and python_full_version < '3.14'", + "python_full_version == '3.11.*'", +] +dependencies = [ + { name = "colorama", marker = "python_full_version >= '3.11' and sys_platform == 'win32'" }, + { name = "ipython-pygments-lexers", marker = "python_full_version >= '3.11'" }, + { name = "jedi", marker = "python_full_version >= '3.11'" }, + { name = "matplotlib-inline", marker = "python_full_version >= '3.11'" }, + { name = "pexpect", marker = "python_full_version >= '3.11' and sys_platform != 'emscripten' and sys_platform != 'win32'" }, + { name = "prompt-toolkit", marker = "python_full_version >= '3.11'" }, + { name = "psutil", marker = "python_full_version >= '3.11' and sys_platform != 'cygwin' and sys_platform != 'emscripten'" }, + { name = "pygments", marker = "python_full_version >= '3.11'" }, + { name = "stack-data", marker = "python_full_version >= '3.11'" }, + { name = "traitlets", marker = "python_full_version >= '3.11'" }, + { name = "typing-extensions", marker = "python_full_version == '3.11.*'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b9/32/99451b1283ec5d92ad77073f12e1c667dc10775384d8f15c2914207149dd/ipython-9.17.1.tar.gz", hash = "sha256:8919be8c27f20a6f4423145028063f6637b42a03ce57665bb12015ee1f073529", size = 4539289, upload-time = "2026-09-01T08:29:32.6Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2d/1e/65b59cf518c106aa755e7f7da3099027738687a862ec785060702a481320/ipython-9.17.1-py3-none-any.whl", hash = "sha256:6d1645743cfd1a07eb695d85aa2b5fa66721f8cbae9431d4049f7084bbf06509", size = 639038, upload-time = "2026-09-01T08:29:30.673Z" }, +] + +[[package]] +name = "ipython-pygments-lexers" +version = "1.1.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pygments", marker = "python_full_version >= '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ef/4c/5dd1d8af08107f88c7f741ead7a40854b8ac24ddf9ae850afbcf698aa552/ipython_pygments_lexers-1.1.1.tar.gz", hash = "sha256:09c0138009e56b6854f9535736f4171d855c8c08a563a0dcd8022f78355c7e81", size = 8393, upload-time = "2025-01-17T11:24:34.505Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d9/33/1f075bf72b0b747cb3288d011319aaf64083cf2efef8354174e3ed4540e2/ipython_pygments_lexers-1.1.1-py3-none-any.whl", hash = "sha256:a9462224a505ade19a605f71f8fa63c2048833ce50abc86768a0d81d876dc81c", size = 8074, upload-time = "2025-01-17T11:24:33.271Z" }, +] + +[[package]] +name = "ipywidgets" +version = "8.1.9" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "comm" }, + { name = "ipython", version = "8.39.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "ipython", version = "9.17.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, + { name = "jupyterlab-widgets" }, + { name = "traitlets" }, + { name = "widgetsnbextension" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c9/7c/6db60eddf38547353b06d57941f5eee22a990640ce30479fd71a810507f2/ipywidgets-8.1.9.tar.gz", hash = "sha256:bcccba38a6ec3253f7a39c943cea5b9ad01999ce071396171adbc51c6a6a8613", size = 117252, upload-time = "2026-08-18T08:54:24.123Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c3/55/298e9b3b864a198234997e87a1471c1b17d7f3546ace6d18fb5cf1ce24b2/ipywidgets-8.1.9-py3-none-any.whl", hash = "sha256:f2b8cbcaae10252b809fbe4d7470db75c09b769a32cbf816d20e5ca6d3c5a79d", size = 140101, upload-time = "2026-08-18T08:54:22.339Z" }, +] + [[package]] name = "itsdangerous" version = "2.2.0" @@ -1718,6 +1817,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/68/34/65604740edcb20e1bda6a890348ed7d282e7dd23aa00401cbe36fd0edbd9/janus-2.0.0-py3-none-any.whl", hash = "sha256:7e6449d34eab04cd016befbd7d8c0d8acaaaab67cb59e076a69149f9031745f9", size = 12161, upload-time = "2024-12-13T12:59:06.106Z" }, ] +[[package]] +name = "jedi" +version = "0.20.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "parso" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/a4/4692ecd7fa700ac1066b1c1f6cadef60aa2e01e5e364710235137d823e0a/jedi-0.20.1.tar.gz", hash = "sha256:2f71208c3f9c1bca057c0e90d3f272aba44ace88fc4067d7587e9e069331b7e5", size = 3121738, upload-time = "2026-10-12T17:42:24.361Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/be/c7/71eb0d51cdcbb63b857c931aa4e9218b078b5d9f8ecd383b234f28fe7b0f/jedi-0.20.1-py2.py3-none-any.whl", hash = "sha256:0fb16d86c4a4c73c37ba518c77419975e30fcc620658a8d14fbb5720cdd34142", size = 4885980, upload-time = "2026-10-12T17:42:21.585Z" }, +] + [[package]] name = "jinja2" version = "3.1.6" @@ -1744,11 +1855,11 @@ name = "jsonschema" version = "4.26.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "attrs", marker = "python_full_version < '3.14'" }, - { name = "jsonschema-specifications", marker = "python_full_version < '3.14'" }, - { name = "referencing", marker = "python_full_version < '3.14'" }, + { name = "attrs" }, + { name = "jsonschema-specifications" }, + { name = "referencing" }, { name = "rpds-py", version = "0.30.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "rpds-py", version = "2026.6.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11' and python_full_version < '3.14'" }, + { name = "rpds-py", version = "2026.6.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" } wheels = [ @@ -1760,7 +1871,7 @@ name = "jsonschema-specifications" version = "2025.9.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "referencing", marker = "python_full_version < '3.14'" }, + { name = "referencing" }, ] sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" } wheels = [ @@ -1772,14 +1883,23 @@ name = "jupyter-core" version = "5.9.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "platformdirs", marker = "python_full_version < '3.14'" }, - { name = "traitlets", marker = "python_full_version < '3.14'" }, + { name = "platformdirs" }, + { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/02/49/9d1284d0dc65e2c757b74c6687b6d319b02f822ad039e5c512df9194d9dd/jupyter_core-5.9.1.tar.gz", hash = "sha256:4d09aaff303b9566c3ce657f580bd089ff5c91f5f89cf7d8846c3cdf465b5508", size = 89814, upload-time = "2025-10-16T19:19:18.444Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/e7/e7/80988e32bf6f73919a113473a604f5a8f09094de312b9d52b79c2df7612b/jupyter_core-5.9.1-py3-none-any.whl", hash = "sha256:ebf87fdc6073d142e114c72c9e29a9d7ca03fad818c5d300ce2adc1fb0743407", size = 29032, upload-time = "2025-10-16T19:19:16.783Z" }, ] +[[package]] +name = "jupyterlab-widgets" +version = "3.0.17" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/21/8b/e739cf9066ad5037a2d4b0a403f06da374fdccb9748221661c8b492d3dbc/jupyterlab_widgets-3.0.17.tar.gz", hash = "sha256:6e61fe21ca8a66039180a5cc52a433e07279d2fee79c8be963e00d55193f17a8", size = 213919, upload-time = "2026-08-18T08:52:17.511Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/33/ef/6d27fc118f58cb24886da413545a7efb0853d405fddbfd8b2d9ac09fbed4/jupyterlab_widgets-3.0.17-py3-none-any.whl", hash = "sha256:40ac1e9955acf116c4d995d9bfa082d86ad9ec6d91c4f134827cf5e0a5eb75e0", size = 217292, upload-time = "2026-08-18T08:52:15.47Z" }, +] + [[package]] name = "kiwisolver" version = "1.5.0" @@ -2159,6 +2279,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8a/6d/69552382fcc8e93d1f2763ef2665980a900a48b7f3a4c57ed290726d1cbc/matplotlib-3.11.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:e4b9ac2f1f607ecda2af90a5232beee2af7582fce1cc30c4b6a1b012dc21ee99", size = 10019439, upload-time = "2026-07-18T03:39:43.78Z" }, ] +[[package]] +name = "matplotlib-inline" +version = "0.2.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "traitlets" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/bd/c0/9f7c9a46090390368a4d7bcb76bb87a4a36c421e4c0792cdb53486ffac7a/matplotlib_inline-0.2.2.tar.gz", hash = "sha256:72f3fe8fce36b70d4a5b612f899090cd0401deddc4ea90e1572b9f4bfb058c79", size = 8150, upload-time = "2026-05-08T17:33:33.49Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/41/09/5b161152e2d90f7b87f781c2e1267494aef9c32498df793f73ad0a0a494a/matplotlib_inline-0.2.2-py3-none-any.whl", hash = "sha256:3c821cf1c209f59fb2d2d64abbf5b23b67bcb2210d663f9918dd851c6da1fcf6", size = 9534, upload-time = "2026-05-08T17:33:32.055Z" }, +] + [[package]] name = "mdurl" version = "0.1.2" @@ -2281,7 +2413,7 @@ wheels = [ [[package]] name = "mujoco" -version = "3.10.0" +version = "3.16.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "absl-py" }, @@ -2292,39 +2424,48 @@ dependencies = [ { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" }, { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "pyopengl" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/a2/3b/c76837b7fdb007f7605ff783689a0bd23a5a49b065928bec2f1fa7ea3d67/mujoco-3.10.0.tar.gz", hash = "sha256:c9e8d5d87d82204ed5bccc87d843c0a53e75aaf381de2938ec46d04f1ac6e24e", size = 1094987, upload-time = "2026-06-22T17:40:59.904Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/57/ed/9b8df6c801fa25542d4c2dc417063611474a070c4bef52e896fa57726d94/mujoco-3.10.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:c1c9dfb4ba3f1ef14b70968e9cd41b14fa1877f9697369953a471aa17324f443", size = 7745281, upload-time = "2026-06-22T17:39:47.198Z" }, - { url = "https://files.pythonhosted.org/packages/09/be/3d9a1ecfe3501a84ece0d5824ff67a0933337650fb48b26c8db0b43de0cd/mujoco-3.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c8e4688d87b85be27dfcfdf957f05f1450a99131f9f8b1818613a2e4fd8d7321", size = 19324219, upload-time = "2026-06-22T17:39:49.666Z" }, - { url = "https://files.pythonhosted.org/packages/03/37/5580b126403510a80a059a66d3ea21f3e55d47960e480e66ff2a7723b514/mujoco-3.10.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b4e1e2c0c72200340d413da4211b56a8885a7ed78e893f36d97e5696e8f4af3e", size = 19628590, upload-time = "2026-06-22T17:39:53.624Z" }, - { url = "https://files.pythonhosted.org/packages/d6/3c/e3768418794c4450c6bef971eaa2314e1fac7d46abc6968b6722b0b654a0/mujoco-3.10.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:47a89c371cc171a38eb6c03172aff2f905e54c1261d87b3575a9d77fe3a29a55", size = 20763444, upload-time = "2026-06-22T17:39:56.559Z" }, - { url = "https://files.pythonhosted.org/packages/af/3c/a3c5121ca9356e78dd1f09ad48e7fa034b91e02124d533e64252c314b646/mujoco-3.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:2f71cb614559cd06a8ce57bd255146e15ccb49ee7dea316aeb895838ba82e1e0", size = 17719988, upload-time = "2026-06-22T17:39:59.614Z" }, - { url = "https://files.pythonhosted.org/packages/45/bd/c3a4ad6884e60bbbff3d77df75358570bcf9b97ff8d81a0ea3b311b0276e/mujoco-3.10.0-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:62b7e9faf714f1582e1dd923ba3ea769a939cc572f6d77909752cbb31db5409f", size = 7758349, upload-time = "2026-06-22T17:40:02.329Z" }, - { url = "https://files.pythonhosted.org/packages/41/69/4c55c05fe602d72be5526d911e6802de1e67ad70c9301f556eef1d78a4bb/mujoco-3.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0b812e0e36e8b2dde8ce4ad9b25e189b658b9c94f5e798aa64783261abb88321", size = 19348907, upload-time = "2026-06-22T17:40:04.634Z" }, - { url = "https://files.pythonhosted.org/packages/05/19/a8a560f29f7f0137da6d41d633bc892a9e8ebc36af64c31a3db5882d26d8/mujoco-3.10.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c0eff9fb64c39c21f5e29f39996c152ed9a2a5c783818b524c77abf41f6e5751", size = 19654107, upload-time = "2026-06-22T17:40:07.594Z" }, - { url = "https://files.pythonhosted.org/packages/b1/07/a37fc7fa55d38e9225884b80c3d241e669357e83f7e23f80b8860a7e14cd/mujoco-3.10.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5489e18a8dd09da2dd71d28563e17889a2e5a0ad07943ebcaa1446d6c4d4e1dd", size = 20789312, upload-time = "2026-06-22T17:40:10.656Z" }, - { url = "https://files.pythonhosted.org/packages/82/84/6548d32afc49fb79015a0b98d1119628ce94dd8befb4526c2cd10429e13f/mujoco-3.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:45a27a8982e6f89f09e87e4578a5d3e7c9b5667f3db07052e518993b78c9b3ea", size = 17757305, upload-time = "2026-06-22T17:40:13.448Z" }, - { url = "https://files.pythonhosted.org/packages/03/a2/4dd9f4cec6ce92f836a8b2de1cc799c4458af1467d7a044ef8014217bdb4/mujoco-3.10.0-cp312-cp312-macosx_10_16_x86_64.whl", hash = "sha256:47d4a22b7667c60e24e7ef6acb027c13abe9abba9acf17cc8db6fb250ba275ea", size = 7772567, upload-time = "2026-06-22T17:40:16.539Z" }, - { url = "https://files.pythonhosted.org/packages/5d/7d/ebe5342c136de27e0c430ba781f829df2cd66c00ed22627c1964fbd5d7fe/mujoco-3.10.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a4d35e9d0b13ff9ad3196294a7dac363f1d0cdaa988832d0b687d42d98f4ee29", size = 19380823, upload-time = "2026-06-22T17:40:19.211Z" }, - { url = "https://files.pythonhosted.org/packages/d8/5d/43d1b2b9fe97676e5af03020e132ac497b45a0333a4c61de657d0d52170a/mujoco-3.10.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:cb7f0d7c148a588f3633020807fc0ec3f3a9aff1f647406e3e0ffe96b05dfd57", size = 19705628, upload-time = "2026-06-22T17:40:22.549Z" }, - { url = "https://files.pythonhosted.org/packages/c3/11/c69199e4123935f98068ab6ab6b35955b4de0f6a91d3f9883805a5789394/mujoco-3.10.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:966d12f88e77e2b188e7530667b519d6963b9b906cff83bab534e5e4279325a0", size = 20904309, upload-time = "2026-06-22T17:40:25.861Z" }, - { url = "https://files.pythonhosted.org/packages/47/13/07bf2550c7dcd69ee8c7fd1f5c400a4ba2e4ede0a29a463ad3ac4cc9da90/mujoco-3.10.0-cp312-cp312-win_amd64.whl", hash = "sha256:708edb5aceee96f2767b1072641523060043b2c67000e39e6e9797addf073696", size = 17865123, upload-time = "2026-06-22T17:40:28.996Z" }, - { url = "https://files.pythonhosted.org/packages/c0/ea/a9a19f025d3b323aca9d00e34fdc177e7290c5f23adf6341109a7e961920/mujoco-3.10.0-cp313-cp313-macosx_10_16_x86_64.whl", hash = "sha256:396a49c1baeb4cb1efd1fc213e54baf6d2a5ca42bcd99da82278501a32cb5d42", size = 7772943, upload-time = "2026-06-22T17:40:31.951Z" }, - { url = "https://files.pythonhosted.org/packages/68/ea/15dfc7cc10f44f46286a0634499f3a63e03269adb4788903f3751e964be0/mujoco-3.10.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:db794d8b8a64e3bb6a0f226a9200293a4890f490c93411fcc531a145f373521b", size = 19381290, upload-time = "2026-06-22T17:40:34.251Z" }, - { url = "https://files.pythonhosted.org/packages/76/82/ab50abb150805e711e02b7b7424b86bd12297bc5476fb1455ce739fa0d1b/mujoco-3.10.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:720174e7132ccf5f7e9eb86a0855c1b1e93330755f734c21fa58e7bde65bd140", size = 19705727, upload-time = "2026-06-22T17:40:36.968Z" }, - { url = "https://files.pythonhosted.org/packages/52/49/f6f0c7c54c646adda647aa7495bdc69572419480c37d5cd0bee132ebacd6/mujoco-3.10.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e0a5725cc9c9a4da1d5f2b8314ad6d39007e09430ac00aa8d023995ce1f2a3e9", size = 20904596, upload-time = "2026-06-22T17:40:40.423Z" }, - { url = "https://files.pythonhosted.org/packages/05/ea/53c7bcef3ef4de63563d9536e4fe6728996f0fc13e82040b1614ad0e32d9/mujoco-3.10.0-cp313-cp313-win_amd64.whl", hash = "sha256:928dca15b06161b88153df2dc2f7c141d41f39e08e20d1804df8d53f42d9f62c", size = 17865523, upload-time = "2026-06-22T17:40:43.233Z" }, - { url = "https://files.pythonhosted.org/packages/24/69/a55911e462181ec5793cdcd6e4a8bf35dedbe4c8cb8f71f51ad38f724f55/mujoco-3.10.0-cp314-cp314-macosx_10_16_x86_64.whl", hash = "sha256:d8c9a865b04030933de15842823856ce0ef20a12bf5c972a3782e27e78158e41", size = 7835852, upload-time = "2026-06-22T17:40:46.062Z" }, - { url = "https://files.pythonhosted.org/packages/3c/6d/e96037c529e3639f86ac7a62252f464bea2683ef534833bc76658a44f8f6/mujoco-3.10.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1cdc8f3487e5d73fc330c446fd6e521e81fb28b39b4f735e1cc934c09044ec5b", size = 19400276, upload-time = "2026-06-22T17:40:48.199Z" }, - { url = "https://files.pythonhosted.org/packages/4f/c5/f5937fc94d6922d85c750434642a0c02be361de06e5ae35b3b5b4426907a/mujoco-3.10.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0f4ebc3f494cb2dabcdab499154ba7e02b2d2e98f83612961a4fb6365abb79ba", size = 19719062, upload-time = "2026-06-22T17:40:51.418Z" }, - { url = "https://files.pythonhosted.org/packages/ff/37/1df28d466b09f57f414a5c165075789e123b25b3127c9faf2ded5deca616/mujoco-3.10.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:04b57f3f9a58b35b99d5966f8be12f68158ad0c7393b219378af0686f3856dbe", size = 20905473, upload-time = "2026-06-22T17:40:54.665Z" }, - { url = "https://files.pythonhosted.org/packages/51/d2/14e60c0d3ea248782e8b5ce4844f8970a4d812078b2536aff61385876e94/mujoco-3.10.0-cp314-cp314-win_amd64.whl", hash = "sha256:cb48d042682d227188ba22b51c31b72975bf7ea7d89f0cafed3d40634337f88e", size = 18572894, upload-time = "2026-06-22T17:40:57.73Z" }, + { name = "websockets", version = "16.1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, + { name = "websockets", version = "17.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/9d/17/5ad265178d0b0f2c40e35b841f2f0d11fe32eed299ba0aafc91317603a67/mujoco-3.16.0.tar.gz", hash = "sha256:76a5e87f89c68e6616519914cd8ac06dc0b60cd9108ef4aef92e3e506f59dc53", size = 7101357, upload-time = "2026-10-14T10:32:54.956Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4c/cc/1bb35dd90d4e7fbe89026e589be17da100774f805bcb8f9fff30815f3462/mujoco-3.16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4d54f37eceaac86ad2ec31b629fdffa19f4e30674d47557379759a831a0ba176", size = 28289248, upload-time = "2026-10-14T10:30:57.691Z" }, + { url = "https://files.pythonhosted.org/packages/c6/7c/f0ac0715963b9638707553139e3ed6218b03de0aabd006b625b5694a253e/mujoco-3.16.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f05efa7e56aaf0235571ad32f13de37bb446f1894a1d4705e9d0953f0e1aff09", size = 28755498, upload-time = "2026-10-14T10:31:01.464Z" }, + { url = "https://files.pythonhosted.org/packages/84/e6/6bc56ec90167a4c739ecf97501525a2221ffae043ac70426f6a3d7ca793e/mujoco-3.16.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e0c9802e1da90f5337e78b99f9660bc4d220c284988ae1d9308f633dac51bc40", size = 30412533, upload-time = "2026-10-14T10:31:05.069Z" }, + { url = "https://files.pythonhosted.org/packages/72/c1/522495b67f00ce78a7649facadf7e1f7975eb7c03bef794196e27f42eed8/mujoco-3.16.0-cp310-cp310-win_amd64.whl", hash = "sha256:36ee17e9842849f5e34102b3bd399ca2d58e41d6bf72bfdb519b484a86df84ec", size = 18687867, upload-time = "2026-10-14T10:31:08.353Z" }, + { url = "https://files.pythonhosted.org/packages/ad/09/de44bd03a80864450491986e847f0d613be7b03d98bfbe2c26ce5e8aa057/mujoco-3.16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d340707d68ef7aa048a6b752cece41ac980494b45e1415c385cf2290e56b2986", size = 28316752, upload-time = "2026-10-14T10:31:11.783Z" }, + { url = "https://files.pythonhosted.org/packages/84/bd/eea33e5de1c2ad42da0906eb350ad2a2c570eb0cebfc217f2f9ea693d6d5/mujoco-3.16.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9ce1c8fcb2b6f797452d6388305287458f3c9727dfebc74a45748735e0649e60", size = 28783997, upload-time = "2026-10-14T10:31:14.921Z" }, + { url = "https://files.pythonhosted.org/packages/fa/54/9d5d12a5cf979e4cbb164fc00879dc9e5dbd9811186a0846be22243f973d/mujoco-3.16.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9990aecfe442a516d0595e5762f89da83431ed46fd353bee1e135e3a7140a551", size = 30443776, upload-time = "2026-10-14T10:31:19.055Z" }, + { url = "https://files.pythonhosted.org/packages/67/96/fb9f64e6bbaede0e09fc12efd1950735ae7350b2507b63e66f29ea488e9b/mujoco-3.16.0-cp311-cp311-win_amd64.whl", hash = "sha256:f29b366fb488e032fdf0c0f96c3468c76fb8ab45c4ab3729cd4737a2c2f129e6", size = 18729244, upload-time = "2026-10-14T10:31:22.542Z" }, + { url = "https://files.pythonhosted.org/packages/be/43/b06b8ea8b77aff18206e14d63c98a37c6120d1b39bb79ee03258fa932793/mujoco-3.16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:5d6a543ad67c083040d6413643422d54c65d62d8c5a3edf51e3da4dbb48436e4", size = 28368889, upload-time = "2026-10-14T10:31:26.032Z" }, + { url = "https://files.pythonhosted.org/packages/38/cc/5ca888601354a038cd217e743fa9d37cc93a7e2a2116c8f93a6d6e0e3103/mujoco-3.16.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:012d242ea832d15ab6a6b2db02cf4d24347ba4928bb8d335c420fc453ffd5a7f", size = 28847679, upload-time = "2026-10-14T10:31:29.535Z" }, + { url = "https://files.pythonhosted.org/packages/d1/8d/02517dee6ae29fa22c4c739a07c6f295db9faa2a23028f9e48b28c2f697f/mujoco-3.16.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a9ea38656fc75d9a6575b5fa7350882dc39461cb655e4ae8027ec58fda6245e1", size = 30611543, upload-time = "2026-10-14T10:31:32.912Z" }, + { url = "https://files.pythonhosted.org/packages/cc/77/91ab3cd465bc5da789464d9ce7c6d47942717d5803950b1432653bb2137c/mujoco-3.16.0-cp312-cp312-win_amd64.whl", hash = "sha256:24938c6d414b598abe791826ea52ba83fe83b0b86a151038cc4fcef6cc911d38", size = 18861496, upload-time = "2026-10-14T10:31:35.933Z" }, + { url = "https://files.pythonhosted.org/packages/e0/bb/9dd29134c2047eb630878b8127240d7c61ee256ed32bb8030393ad405e85/mujoco-3.16.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7b5b556d377fe563e916f981e1af486ba74b6d7bc48f8ce5121847a6a6509c18", size = 28368911, upload-time = "2026-10-14T10:31:39.219Z" }, + { url = "https://files.pythonhosted.org/packages/2e/80/5f36f87477e4d6aeca3f2e1fc9dab74e298dabdce9461093a6ed92b71a31/mujoco-3.16.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b50d05e36576577c352dc0585087d086735651e1ac04d19f77e242b63b632e3d", size = 28847752, upload-time = "2026-10-14T10:31:43.481Z" }, + { url = "https://files.pythonhosted.org/packages/1a/5b/277790f59cd9ae428389f33dba818a04d12e57c68ef219fe36098122349f/mujoco-3.16.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bb8cfcf69cc0f3f2d07d988a3d8ac554bfea9b4a2331d9448a4c66c20722bfe4", size = 30612101, upload-time = "2026-10-14T10:31:47.117Z" }, + { url = "https://files.pythonhosted.org/packages/ce/61/b3d0b41892869578a4668885c1ea4cbde11d799b1d691af63dc439382e84/mujoco-3.16.0-cp313-cp313-win_amd64.whl", hash = "sha256:01bb618a79e3e1fbe7fdf25589d35515fe32979fc58ab0eb3c4d8d3648b18026", size = 18861882, upload-time = "2026-10-14T10:31:50.646Z" }, + { url = "https://files.pythonhosted.org/packages/86/c1/ff3ed01a05688387e951665458f147411930554010ce15c0662701830962/mujoco-3.16.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:817e4f941d76eaf8d32cf76adcce0aaa4830151539caba6b6aa010c4db211657", size = 28386501, upload-time = "2026-10-14T10:31:53.618Z" }, + { url = "https://files.pythonhosted.org/packages/19/69/242c487fb189cec64c669d7d773dbeaf0534fae4109437ba6f2b737514ff/mujoco-3.16.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5dea0f4acdbefba9d29ed6e488264b40046bc9d568b9350767d90240371d0cf0", size = 28867954, upload-time = "2026-10-14T10:31:57.107Z" }, + { url = "https://files.pythonhosted.org/packages/8f/b3/4ce31cf2ab6d2550010d0998e111b54ea401cc6b16376815dcdda72fc4e1/mujoco-3.16.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fd5e9bafa8076998205632dfae019a761ff3c989fe59c53a5346ed8d75891df7", size = 30618276, upload-time = "2026-10-14T10:32:00.499Z" }, + { url = "https://files.pythonhosted.org/packages/02/fc/3ba174abd6f8166440475e82f968202863a27ff1938f0d94d8ff00af2054/mujoco-3.16.0-cp314-cp314-win_amd64.whl", hash = "sha256:3e61f5af1b771e399b6c79f8f929361f0741881179decbf43ccdd6043c9cc74f", size = 19702683, upload-time = "2026-10-14T10:32:04.048Z" }, + { url = "https://files.pythonhosted.org/packages/ff/52/72adf317c77d5625d77b7743afcc6ecdf38dafd461d8286fbebc4a6530b6/mujoco-3.16.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:8419c9f713d95ff4c4856fa9694838cdd6621e4f16e6fca892445a9479ba6da9", size = 28715587, upload-time = "2026-10-14T10:32:07.036Z" }, + { url = "https://files.pythonhosted.org/packages/80/87/c2e9970bd29a73c0409e8ebcb98ac1a71e8ede822595c39ea25dbb772b59/mujoco-3.16.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:db0c705412a2313b1c315bfe9dc7ca71f74fabb31096b9db0626902d729d7e51", size = 29209226, upload-time = "2026-10-14T10:32:10.936Z" }, + { url = "https://files.pythonhosted.org/packages/39/6e/d4198d3a1c8ce06f4f880a122974648f3ca3e6bc86ce3f752157510d4e2c/mujoco-3.16.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:17f84984920357d32bc0d0b5c2cb1b0d6343578462a7a2dc9c8cfca736e839dd", size = 30627942, upload-time = "2026-10-14T10:32:14.274Z" }, + { url = "https://files.pythonhosted.org/packages/91/e9/82e773e765fd3d1a3c6b4c8e1c75172e8a7d28eac56cc6763d07d370906f/mujoco-3.16.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d8d9e45aa1ca43818472856396e23686215504d6e65c3798f8f06268c29af97c", size = 20056811, upload-time = "2026-10-14T10:32:18.024Z" }, + { url = "https://files.pythonhosted.org/packages/b5/1b/4a2fbf3f7894eba4f3805b73abb445d12b559ccbd6ce6535230b833a1149/mujoco-3.16.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:33cd3c26bd2f9f18cbc8058a41abb1ec4a2e4db2e7a1c6504b8efaf6db1a6a89", size = 28386579, upload-time = "2026-10-14T10:32:21.899Z" }, + { url = "https://files.pythonhosted.org/packages/58/c6/877815b646a326bb711aba97f415a3f3a17e95eef87aad6505507450b3bd/mujoco-3.16.0-cp315-cp315-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:077ecbee96cfcb27759830e2105f5f327c3266d0920058c8455ed7af6ad21d70", size = 28868003, upload-time = "2026-10-14T10:32:26.063Z" }, + { url = "https://files.pythonhosted.org/packages/c1/9c/89a150a67083048e5c314725e34a4b42e121c1c56ec57a3d007f2aa8a481/mujoco-3.16.0-cp315-cp315-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7432c8c273fd6372a6d6fd39c3d4294e93c4b2c0e4171c702091b0b45e53105b", size = 30618239, upload-time = "2026-10-14T10:32:29.639Z" }, + { url = "https://files.pythonhosted.org/packages/fa/e5/5f198059ef7f72c6802a8b3c8082ebe6429e751ac1c039bd24affad43472/mujoco-3.16.0-cp315-cp315-win_amd64.whl", hash = "sha256:cffa15cd171949bb76f97e998cee78894d74c88a80ed75f3ee1e14f1b0339f49", size = 19702638, upload-time = "2026-10-14T10:32:32.688Z" }, + { url = "https://files.pythonhosted.org/packages/a6/41/9b0504cf39eefa43f4086d3a984f2e2b567747a18b584ae3b09a2d6e0772/mujoco-3.16.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:45751fd70c66b14a639c60422d896da2483e35c65718ab6650e24ac2359490aa", size = 28714434, upload-time = "2026-10-14T10:32:35.807Z" }, + { url = "https://files.pythonhosted.org/packages/a7/ae/26fd51e8f30b06171cba2572a216705bfe90464844976069797b669825c3/mujoco-3.16.0-cp315-cp315t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:113c753de0c8966c602244252f04b6916cdee193fafa9a58a077daafd7c725fc", size = 29207920, upload-time = "2026-10-14T10:32:44.194Z" }, + { url = "https://files.pythonhosted.org/packages/f2/12/1b4f3bf9407e409932404317c1b2f2c7517319a45f65ecf2675ca4a5ad01/mujoco-3.16.0-cp315-cp315t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4b8cbce67f18a00c23f310ac24e45454e745c3b41d4801c2bcc9be7c1ea5bf0e", size = 30627152, upload-time = "2026-10-14T10:32:47.799Z" }, + { url = "https://files.pythonhosted.org/packages/25/f6/5658de04844be364c805c5928a4a208d8cb7ee63cff5f7c65ebad1bed088/mujoco-3.16.0-cp315-cp315t-win_amd64.whl", hash = "sha256:e254521c9ad197cdf939bca11d483371f2ea30cc628f57e49378260f8ba69048", size = 20055511, upload-time = "2026-10-14T10:32:51.025Z" }, ] [[package]] name = "mujoco-warp" -version = "3.10.0.3" +version = "3.16.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "absl-py" }, @@ -2336,9 +2477,9 @@ dependencies = [ { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "warp-lang" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/4f/02/1687ee928ea468345546af79dcfd65da9cd5840e16d1e71a244223494e54/mujoco_warp-3.10.0.3.tar.gz", hash = "sha256:f22196465cb1350677f66d8b65aa23bf37d95e150ce3ba3c68ea934ba35e3070", size = 2074757, upload-time = "2026-07-22T15:28:01.367Z" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/d8/00a4917ffc224692c5f5bd556df840bccd7160bb67ac345f2f4c2be51bc0/mujoco_warp-3.16.0.tar.gz", hash = "sha256:0852a1facaa97ddc9697e9818cf0e16cf4bbc893f95dab7b61b01882b1c79ee0", size = 2213907, upload-time = "2026-10-14T10:30:10.439Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/9c/a1/a8e616daafb219fccc2d23367894d305e442e2e18bc5e0dd855d9986d979/mujoco_warp-3.10.0.3-py3-none-any.whl", hash = "sha256:9435e5d6a7061af32aecc8da38124bfccceea27fc85176b33b66b7c4b76b4c1a", size = 2152650, upload-time = "2026-07-22T15:27:59.463Z" }, + { url = "https://files.pythonhosted.org/packages/37/0c/db020cd3c790d538b7cce3791982013497c51b26cc29ea048365b601ca5e/mujoco_warp-3.16.0-py3-none-any.whl", hash = "sha256:00708e267fc2b2723c151fa4acf9f96f39765e43b845c28f5c81fb32eb534097", size = 2294634, upload-time = "2026-10-14T10:30:08.554Z" }, ] [[package]] @@ -2493,10 +2634,10 @@ name = "nbformat" version = "5.11.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "fastjsonschema", marker = "python_full_version < '3.14'" }, - { name = "jsonschema", marker = "python_full_version < '3.14'" }, - { name = "jupyter-core", marker = "python_full_version < '3.14'" }, - { name = "traitlets", marker = "python_full_version < '3.14'" }, + { name = "fastjsonschema" }, + { name = "jsonschema" }, + { name = "jupyter-core" }, + { name = "traitlets" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b2/fd/80f407a9525bc5bd9865e5c37db3b78867fa43217f8aac5eab22b5f028b3/nbformat-5.11.0.tar.gz", hash = "sha256:7dbaed4a69cae28c2b4d44ab7430a6af4544fb89455023f6f21550be757b60c8", size = 151822, upload-time = "2026-08-06T12:29:55.597Z" } wheels = [ @@ -2540,23 +2681,21 @@ wheels = [ [[package]] name = "newton" -version = "1.4.0" -source = { registry = "https://pypi.org/simple" } +version = "1.8.0.dev0" +source = { git = "https://github.com/skulkar22/newton.git?rev=1e5036c48ec92d44782dfe0f448dc25d64984b58#1e5036c48ec92d44782dfe0f448dc25d64984b58" } dependencies = [ { name = "warp-lang" }, ] -wheels = [ - { url = "https://files.pythonhosted.org/packages/bf/67/28a76c50304d62dc9a9ec9a142e14f1a3156c77c0df778fc3918d0e47d8f/newton-1.4.0-py3-none-any.whl", hash = "sha256:0e11343cc51b86647d9afcd191a21ca4d0d5e410d84072a60ef84af908c72577", size = 5124026, upload-time = "2026-07-16T15:54:10.484Z" }, -] [package.optional-dependencies] importers = [ { name = "alphashape" }, - { name = "coacd", marker = "python_full_version < '3.14'" }, + { name = "coacd" }, { name = "fast-simplification" }, { name = "meshio" }, { name = "newton-usd-schemas" }, - { name = "open3d", marker = "(python_full_version < '3.13' and platform_machine != 'aarch64') or (python_full_version < '3.13' and sys_platform != 'linux')" }, + { name = "open3d", marker = "platform_machine == 'arm64' or sys_platform != 'darwin'" }, + { name = "pillow" }, { name = "pycollada" }, { name = "requests" }, { name = "resolve-robotics-uri-py" }, @@ -2565,7 +2704,8 @@ importers = [ { name = "scipy", version = "1.18.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, { name = "trimesh" }, { name = "usd-core", version = "26.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.14' and platform_machine != 'aarch64'" }, - { name = "usd-exchange", marker = "python_full_version < '3.13' and platform_machine == 'aarch64'" }, + { name = "usd-core", version = "26.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.14.*' and platform_machine != 'aarch64'" }, + { name = "usd-exchange", marker = "python_full_version < '3.14' and platform_machine == 'aarch64'" }, ] sim = [ { name = "mujoco" }, @@ -2574,11 +2714,11 @@ sim = [ [[package]] name = "newton-usd-schemas" -version = "0.4.1" +version = "0.6.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/98/5f/aad1672263880d7e0ee3a7ce9b877ef16e99dba45fb5eb8084181eb7ee1e/newton_usd_schemas-0.4.1.tar.gz", hash = "sha256:1f6946ce2741d7a86ca8e3e84d7b64328c88b42a3b29160a7607b2ce0c837bf4", size = 69561, upload-time = "2026-07-30T17:40:41.505Z" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/cd/bf5b510998ab765ae907901e88b2fec20ffbd5b82689e651eb1aa36d5fb5/newton_usd_schemas-0.6.0.tar.gz", hash = "sha256:024aac16c00be5857e0cc332b6b1ee454500154225c4094d61db74760e17ae45", size = 77182, upload-time = "2026-10-15T19:12:58.536Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/9b/24/d1d44f682dbd28392ef0b6f9e6f9e40374c6009af06e494fa6a9308f79e2/newton_usd_schemas-0.4.1-py3-none-any.whl", hash = "sha256:8911e846c65448426609a2945db6d1135d33e84bf4107efd888a62287b1aa93d", size = 19424, upload-time = "2026-07-30T17:40:40.076Z" }, + { url = "https://files.pythonhosted.org/packages/df/8d/e1b41c9cac77a3b8fa945a4f29311516e8b433f0e9d902b4ca872951bc3d/newton_usd_schemas-0.6.0-py3-none-any.whl", hash = "sha256:05e027d2bd1f1b1ed07909a1efb865a24cbba3fd94716a77cc637ea93859217b", size = 22688, upload-time = "2026-10-15T19:12:57.069Z" }, ] [[package]] @@ -2946,38 +3086,40 @@ wheels = [ [[package]] name = "open3d" -version = "0.19.0" +version = "0.20.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "addict", marker = "python_full_version < '3.14'" }, - { name = "configargparse", marker = "python_full_version < '3.14'" }, - { name = "dash", marker = "python_full_version < '3.14'" }, - { name = "flask", marker = "python_full_version < '3.14'" }, - { name = "matplotlib", version = "3.10.9", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "matplotlib", version = "3.11.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11' and python_full_version < '3.14'" }, - { name = "nbformat", marker = "python_full_version < '3.14'" }, + { name = "configargparse" }, + { name = "dash" }, + { name = "flask" }, + { name = "ipywidgets" }, + { name = "nbformat" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" }, - { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and python_full_version < '3.14'" }, - { name = "pandas", marker = "python_full_version < '3.14'" }, - { name = "pillow", marker = "python_full_version < '3.14'" }, - { name = "pyquaternion", marker = "python_full_version < '3.14'" }, - { name = "pyyaml", marker = "python_full_version < '3.14'" }, - { name = "scikit-learn", version = "1.7.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "scikit-learn", version = "1.9.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11' and python_full_version < '3.14'" }, - { name = "tqdm", marker = "python_full_version < '3.14'" }, - { name = "werkzeug", marker = "python_full_version < '3.14'" }, + { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, + { name = "werkzeug" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/5c/4b/91e8a4100adf0ccd2f7ad21dd24c2e3d8f12925396528d0462cfb1735e5a/open3d-0.19.0-cp310-cp310-macosx_10_15_universal2.whl", hash = "sha256:f7128ded206e07987cc29d0917195fb64033dea31e0d60dead3629b33d3c175f", size = 103086005, upload-time = "2025-01-08T07:25:56.755Z" }, - { url = "https://files.pythonhosted.org/packages/c7/45/13bc9414ee9db611cba90b9efa69f66f246560e8ade575f1ee5b7f7b5d31/open3d-0.19.0-cp310-cp310-manylinux_2_31_x86_64.whl", hash = "sha256:5b60234fa6a56a20caf1560cad4e914133c8c198d74d7b839631c90e8592762e", size = 447678387, upload-time = "2025-01-08T07:21:55.27Z" }, - { url = "https://files.pythonhosted.org/packages/bc/1c/0219416429f88ebc94fcb269fb186b153affe5b91dffe8f9062330d7776d/open3d-0.19.0-cp310-cp310-win_amd64.whl", hash = "sha256:18bb8b86e5fa9e582ed11b9651ff6e4a782e6778c9b8bfc344fc866dc8b5f49c", size = 69150378, upload-time = "2025-01-08T07:27:10.462Z" }, - { url = "https://files.pythonhosted.org/packages/a7/37/8d1746fcb58c37a9bd868fdca9a36c25b3c277bd764b7146419d11d2a58d/open3d-0.19.0-cp311-cp311-macosx_10_15_universal2.whl", hash = "sha256:117702467bfb1602e9ae0ee5e2c7bcf573ebcd227b36a26f9f08425b52c89929", size = 103098641, upload-time = "2025-01-08T07:26:12.371Z" }, - { url = "https://files.pythonhosted.org/packages/bc/50/339bae21d0078cc3d3735e8eaf493a353a17dcc95d76bcefaa8edcf723d3/open3d-0.19.0-cp311-cp311-manylinux_2_31_x86_64.whl", hash = "sha256:678017392f6cc64a19d83afeb5329ffe8196893de2432f4c258eaaa819421bb5", size = 447683616, upload-time = "2025-01-08T07:22:48.098Z" }, - { url = "https://files.pythonhosted.org/packages/a3/3c/358f1cc5b034dc6a785408b7aa7643e503229d890bcbc830cda9fce778b1/open3d-0.19.0-cp311-cp311-win_amd64.whl", hash = "sha256:02091c309708f09da1167d2ea475e05d19f5e81dff025145f3afd9373cbba61f", size = 69151111, upload-time = "2025-01-08T07:27:22.662Z" }, - { url = "https://files.pythonhosted.org/packages/37/c5/286c605e087e72ad83eab130451ce13b768caa4374d926dc735edc20da5a/open3d-0.19.0-cp312-cp312-macosx_10_15_universal2.whl", hash = "sha256:9e4a8d29443ba4c83010d199d56c96bf553dd970d3351692ab271759cbe2d7ac", size = 103202754, upload-time = "2025-01-08T07:26:27.169Z" }, - { url = "https://files.pythonhosted.org/packages/2b/95/3723e5ade77c234a1650db11cbe59fe25c4f5af6c224f8ea22ff088bb36a/open3d-0.19.0-cp312-cp312-manylinux_2_31_x86_64.whl", hash = "sha256:01e4590dc2209040292ebe509542fbf2bf869ea60bcd9be7a3fe77b65bad3192", size = 447665185, upload-time = "2025-01-08T07:23:39.769Z" }, - { url = "https://files.pythonhosted.org/packages/9f/c4/35a6e0a35aa72420e75dc28d54b24beaff79bcad150423e47c67d2ad8773/open3d-0.19.0-cp312-cp312-win_amd64.whl", hash = "sha256:665839837e1d3a62524804c31031462c3b548a2b6ed55214e6deb91522844f97", size = 69169961, upload-time = "2025-01-08T07:27:35.392Z" }, + { url = "https://files.pythonhosted.org/packages/a1/0b/d96a37fc2ca1452c03266c4a28bc9e34622dd05691f0f870eff48c13f041/open3d-0.20.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:025340a95094c49b7896e8881cd5b2f9a5f8fee44eddcc2331c4064333a50896", size = 54532481, upload-time = "2026-09-16T21:08:26.823Z" }, + { url = "https://files.pythonhosted.org/packages/c7/ee/f0b559ce72493224666664c0ac1ecbc619b5a9ec760384443a6946dbbee6/open3d-0.20.0-cp310-cp310-manylinux_2_35_aarch64.whl", hash = "sha256:04a11b9e6044af94e44246fa29dd7a789bba298fb8ed172fbf6ca2ae55ee6cf7", size = 48460627, upload-time = "2026-09-16T21:19:23.273Z" }, + { url = "https://files.pythonhosted.org/packages/93/a3/f6b37d3f036cc33add33cd4d01f3497a7ebcbf56b2e59a0fd57e5d387071/open3d-0.20.0-cp310-cp310-manylinux_2_35_x86_64.whl", hash = "sha256:7a5999a0bf23f277678de3e3e690a14171e697e81a2a65c2d84e40977b9523a9", size = 400802528, upload-time = "2026-09-16T21:14:29.393Z" }, + { url = "https://files.pythonhosted.org/packages/3a/54/4d8a92221e271269ee1015b767cc8d7243faa09644f8179cb1873fce6f3d/open3d-0.20.0-cp310-cp310-win_amd64.whl", hash = "sha256:9574270e1ae85162435e5f14d6c6bcc012c3dd815fe963fadc7ad6d4de23814b", size = 77477821, upload-time = "2026-09-16T21:25:31.144Z" }, + { url = "https://files.pythonhosted.org/packages/b8/84/e1d93354352c59a3d6699110ce98a6a571489404695677fef04d8ad22b6c/open3d-0.20.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5d2e32afb99b1fb826a3a3428aa6d331212cd956620ab9f659e37a0189d3f3c6", size = 54534442, upload-time = "2026-09-16T21:08:09.409Z" }, + { url = "https://files.pythonhosted.org/packages/08/dd/c47242b068cc7f16fe72b6e42bd7fb48abdcb36042b4a03e50e32b16aadc/open3d-0.20.0-cp311-cp311-manylinux_2_35_aarch64.whl", hash = "sha256:0c46c90fe5c071ca2d541df0a8f8e1c77c9f5f209ccff2ce38d48ecf56835509", size = 48461815, upload-time = "2026-09-16T21:12:57.648Z" }, + { url = "https://files.pythonhosted.org/packages/1a/74/5364df64573016c45eb648a432253c2e50fed2c6c64be87dc928a46fc2e0/open3d-0.20.0-cp311-cp311-manylinux_2_35_x86_64.whl", hash = "sha256:18ae25cbc9f8fcabc06bad71e00cca3cd0ff0a762ce0fbec093f2e2a4d05eddf", size = 400803434, upload-time = "2026-09-16T21:16:44.877Z" }, + { url = "https://files.pythonhosted.org/packages/9d/9b/d4138598ab720b1594f9ab6371d52ee0cb413e6b4406d7cb0a7c4994a9b9/open3d-0.20.0-cp311-cp311-win_amd64.whl", hash = "sha256:bb3633fef10b1024cbf10a98f0457de26498b40f93c91b7029865d53e3e7a114", size = 77478508, upload-time = "2026-09-16T21:24:23.12Z" }, + { url = "https://files.pythonhosted.org/packages/9b/2d/7c732b4729150b385189248ec475e0abb0c33eb14f08eae9f63b47a7a2f4/open3d-0.20.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4732b5ae90a5183792c8c45280c1dd6299cb2a87726a21e0cd2ec3408bd54bb9", size = 54405972, upload-time = "2026-09-16T21:07:49.733Z" }, + { url = "https://files.pythonhosted.org/packages/fb/3d/00ad8495560dbaca74e3fddf2c5187a799578387bc08a387641af3c6455a/open3d-0.20.0-cp312-cp312-manylinux_2_35_aarch64.whl", hash = "sha256:4acfb34e2841dfac9f5a8681eca01abe4c219da5657e8cac4e2d0d88c70135b8", size = 48462058, upload-time = "2026-09-16T21:17:06.764Z" }, + { url = "https://files.pythonhosted.org/packages/23/ad/493d28bcdf6093d9b6090d3ca4eefe060db06b257a708e57586119845338/open3d-0.20.0-cp312-cp312-manylinux_2_35_x86_64.whl", hash = "sha256:f5cc6106d9c0c41beb8160aa99c2b663e7f08588a598ec7d464391a4cfe684d6", size = 400788891, upload-time = "2026-09-16T21:20:55.395Z" }, + { url = "https://files.pythonhosted.org/packages/e9/b8/b3091989d7f928eb19d1b961544da70b0bf10dedcfc91a53410f8f86ad6f/open3d-0.20.0-cp312-cp312-win_amd64.whl", hash = "sha256:60010f21d44f13557ba007893bc13a69827faa4dc49eedd923d1397096c20d92", size = 77497277, upload-time = "2026-09-16T21:23:35.565Z" }, + { url = "https://files.pythonhosted.org/packages/5f/a2/7a0f647fc752ecdaee6d6ecf1d79060a099736feb016d31520eaac87616f/open3d-0.20.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9d4827f1757ccc6e019417fc7f187d62d049d00c1b15a9928e47b50c57cabf6a", size = 54566682, upload-time = "2026-09-16T21:09:01.255Z" }, + { url = "https://files.pythonhosted.org/packages/46/0e/76806d75a2e71251cba07747797bffd882eb14f655d4d3d05609c8e8046f/open3d-0.20.0-cp313-cp313-manylinux_2_35_aarch64.whl", hash = "sha256:101b65d35dd2ee2057879694c2f1470d335c52bace3482e549b4b4642a4060f7", size = 48462764, upload-time = "2026-09-16T21:14:47.042Z" }, + { url = "https://files.pythonhosted.org/packages/f2/13/787f1594b422492c367a55789718e4c77e1f9a588701310b9e383b5c2de8/open3d-0.20.0-cp313-cp313-manylinux_2_35_x86_64.whl", hash = "sha256:fd67667543fb1a0e2c05200f0ae3433038562cf93050965ac8e8fdda5964a1ab", size = 400787766, upload-time = "2026-09-16T21:19:02.908Z" }, + { url = "https://files.pythonhosted.org/packages/cf/53/829c9a24135fad4576e31bed756eade26b1e904d7e01740b520c4ba739d1/open3d-0.20.0-cp313-cp313-win_amd64.whl", hash = "sha256:689fd4fb3579b2312439b9bceaf92cbb147586b6afc95bdbf6c16e98f5ea15c5", size = 77497479, upload-time = "2026-09-16T21:25:53.971Z" }, + { url = "https://files.pythonhosted.org/packages/6f/85/a0e3dbc275e76bee12bd96f9166c39ecf2e463f976a95bc3a875273e7cdf/open3d-0.20.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:b6667a96ccefbbc6c18fce55996bf3d875505ff7cd828fbb0502117ded0c7274", size = 52647812, upload-time = "2026-09-16T21:08:42.927Z" }, + { url = "https://files.pythonhosted.org/packages/50/d8/0e649c93a9743456deb6a03926538b600f7182e04ac1ce494dbcecc396a2/open3d-0.20.0-cp314-cp314-manylinux_2_35_aarch64.whl", hash = "sha256:d49c254377c643472ce579154fce19f143527e26577ad2c292ae8d5cd28cd8c6", size = 48461355, upload-time = "2026-09-16T21:11:44.444Z" }, + { url = "https://files.pythonhosted.org/packages/8f/1a/819a16215a5844ea9aa9922009f9b4147b38d8c40e169af7052e743fbaa9/open3d-0.20.0-cp314-cp314-manylinux_2_35_x86_64.whl", hash = "sha256:14e0928af6f83555e58dde934af85fe61f6f9f5160f883e6e720d6205c38c68a", size = 392022146, upload-time = "2026-09-16T21:10:30.242Z" }, + { url = "https://files.pythonhosted.org/packages/60/2c/859c2285cd74f013b37a48cd35d56d0b7c0fdd4a8d7e550f85ef202408a9/open3d-0.20.0-cp314-cp314-win_amd64.whl", hash = "sha256:3aaace08405330b3506962af04ae05eb759f0bf5f02842d69609d824cd407bfb", size = 79326708, upload-time = "2026-09-16T21:26:40.71Z" }, ] [[package]] @@ -3123,6 +3265,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/70/44/5191d2e4026f86a2a109053e194d3ba7a31a2d10a9c2348368c63ed4e85a/pandas-2.3.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3869faf4bd07b3b66a9f462417d0ca3a9df29a9f6abd5d0d0dbab15dac7abe87", size = 13202175, upload-time = "2025-09-29T23:31:59.173Z" }, ] +[[package]] +name = "parso" +version = "0.8.7" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/30/4b/90c937815137d43ce71ba043cd3566221e9df6b9c805f24b5d138c9d40a7/parso-0.8.7.tar.gz", hash = "sha256:eaaac4c9fdd5e9e8852dc778d2d7405897ec510f2a298071453e5e3a07914bb1", size = 401824, upload-time = "2026-05-01T23:13:02.138Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/99/5d/8268b644392ee874ee82a635cd0df1773de230bde356c38de28e298392cc/parso-0.8.7-py2.py3-none-any.whl", hash = "sha256:a8926eb2a1b915486941fdbd31e86a4baf88fe8c210f25f2f35ecec5b574ca1c", size = 107025, upload-time = "2026-05-01T23:12:58.867Z" }, +] + +[[package]] +name = "pexpect" +version = "4.9.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "ptyprocess" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/42/92/cc564bf6381ff43ce1f4d06852fc19a2f11d180f23dc32d9588bee2f149d/pexpect-4.9.0.tar.gz", hash = "sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f", size = 166450, upload-time = "2023-11-25T09:07:26.339Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9e/c3/059298687310d527a58bb01f3b1965787ee3b40dce76752eda8b44e9a2c5/pexpect-4.9.0-py2.py3-none-any.whl", hash = "sha256:7236d1e080e4936be2dc3e326cec0af72acf9212a7e1d060210e70a47e253523", size = 63772, upload-time = "2023-11-25T06:56:14.81Z" }, +] + [[package]] name = "pillow" version = "12.3.0" @@ -3231,8 +3394,8 @@ name = "plotly" version = "6.9.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "narwhals", marker = "python_full_version < '3.14'" }, - { name = "packaging", marker = "python_full_version < '3.14'" }, + { name = "narwhals" }, + { name = "packaging" }, ] sdist = { url = "https://files.pythonhosted.org/packages/96/07/795c79dbce40c39bece88e69d049babbd23ffa95b5d117f248db8ea03abb/plotly-6.9.0.tar.gz", hash = "sha256:967ad33e8c704fed051800d11d985eb206a9c795c14206b30a6f463ed9c67d0d", size = 6919903, upload-time = "2026-07-09T14:55:59.982Z" } wheels = [ @@ -3260,6 +3423,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fe/be/2e6798ace5cc036f5d05d36b7b2fd85346f1a708c87060890b070d0ec607/prettytable-3.18.0-py3-none-any.whl", hash = "sha256:b3346e0e6f79180833aebaac088ae926340586cf6d7d991b9eb125b65f72313a", size = 37357, upload-time = "2026-06-22T16:07:48.595Z" }, ] +[[package]] +name = "prompt-toolkit" +version = "3.0.53" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "wcwidth" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/7d/ea/39b988c938f75cb75d7045b5c69f8bfed47ee2152c8837fb403de29d6fb8/prompt_toolkit-3.0.53.tar.gz", hash = "sha256:9ec8a0ad96d5c56148b3f914aa79c1564c3fde5d2e6b876e7bc327e353cf8fa6", size = 435492, upload-time = "2026-07-26T20:56:14.758Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/6f/84908cad2d6aa5144abcf7b42709fe4fdb459bc640ec7ac5786e7693dabc/prompt_toolkit-3.0.53-py3-none-any.whl", hash = "sha256:01c0891d7f9237d5e339f7d3e42cdae80b7534abb1c7c0e3352efba6231492f2", size = 392288, upload-time = "2026-07-26T20:56:12.512Z" }, +] + [[package]] name = "propcache" version = "0.5.2" @@ -3403,6 +3578,49 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/01/c3/629999e78d46c1115c11886d51c6bd68c17ce4a944f1ea3e153a91316a33/protobuf-7.36.0-py3-none-any.whl", hash = "sha256:53374d53fc29a67f7dbbf0ade47d7526a0f0137bf0f9c90e48d8a60790ef748c", size = 177024, upload-time = "2026-08-20T16:34:00.053Z" }, ] +[[package]] +name = "psutil" +version = "7.2.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/aa/c6/d1ddf4abb55e93cebc4f2ed8b5d6dbad109ecb8d63748dd2b20ab5e57ebe/psutil-7.2.2.tar.gz", hash = "sha256:0746f5f8d406af344fd547f1c8daa5f5c33dbc293bb8d6a16d80b4bb88f59372", size = 493740, upload-time = "2026-01-28T18:14:54.428Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d6/f5/97baea3fe7a5a9af7436301f85490905379b1c6f2dd51fe3ecf24b4c5fbf/psutil-7.2.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e78c8603dcd9a04c7364f1a3e670cea95d51ee865e4efb3556a3a63adef958ea", size = 131082, upload-time = "2026-01-28T18:14:59.732Z" }, + { url = "https://files.pythonhosted.org/packages/37/d6/246513fbf9fa174af531f28412297dd05241d97a75911ac8febefa1a53c6/psutil-7.2.2-cp313-cp313t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1a571f2330c966c62aeda00dd24620425d4b0cc86881c89861fbc04549e5dc63", size = 181476, upload-time = "2026-01-28T18:15:01.884Z" }, + { url = "https://files.pythonhosted.org/packages/b8/b5/9182c9af3836cca61696dabe4fd1304e17bc56cb62f17439e1154f225dd3/psutil-7.2.2-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:917e891983ca3c1887b4ef36447b1e0873e70c933afc831c6b6da078ba474312", size = 184062, upload-time = "2026-01-28T18:15:04.436Z" }, + { url = "https://files.pythonhosted.org/packages/16/ba/0756dca669f5a9300d0cbcbfae9a4c30e446dfc7440ffe43ded5724bfd93/psutil-7.2.2-cp313-cp313t-win_amd64.whl", hash = "sha256:ab486563df44c17f5173621c7b198955bd6b613fb87c71c161f827d3fb149a9b", size = 139893, upload-time = "2026-01-28T18:15:06.378Z" }, + { url = "https://files.pythonhosted.org/packages/1c/61/8fa0e26f33623b49949346de05ec1ddaad02ed8ba64af45f40a147dbfa97/psutil-7.2.2-cp313-cp313t-win_arm64.whl", hash = "sha256:ae0aefdd8796a7737eccea863f80f81e468a1e4cf14d926bd9b6f5f2d5f90ca9", size = 135589, upload-time = "2026-01-28T18:15:08.03Z" }, + { url = "https://files.pythonhosted.org/packages/7b/64/665248b557a236d3fa9efc378d60d95ef56dd0a490c2cd37dafc7660d4a9/psutil-7.2.2-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7b6d09433a10592ce39b13d7be5a54fbac1d1228ed29abc880fb23df7cb694c9", size = 131087, upload-time = "2026-01-28T18:15:11.724Z" }, + { url = "https://files.pythonhosted.org/packages/d5/2e/e6782744700d6759ebce3043dcfa661fb61e2fb752b91cdeae9af12c2178/psutil-7.2.2-cp314-cp314t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1fa4ecf83bcdf6e6c8f4449aff98eefb5d0604bf88cb883d7da3d8d2d909546a", size = 182383, upload-time = "2026-01-28T18:15:13.445Z" }, + { url = "https://files.pythonhosted.org/packages/57/49/0a41cefd10cb7505cdc04dab3eacf24c0c2cb158a998b8c7b1d27ee2c1f5/psutil-7.2.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e452c464a02e7dc7822a05d25db4cde564444a67e58539a00f929c51eddda0cf", size = 185210, upload-time = "2026-01-28T18:15:16.002Z" }, + { url = "https://files.pythonhosted.org/packages/dd/2c/ff9bfb544f283ba5f83ba725a3c5fec6d6b10b8f27ac1dc641c473dc390d/psutil-7.2.2-cp314-cp314t-win_amd64.whl", hash = "sha256:c7663d4e37f13e884d13994247449e9f8f574bc4655d509c3b95e9ec9e2b9dc1", size = 141228, upload-time = "2026-01-28T18:15:18.385Z" }, + { url = "https://files.pythonhosted.org/packages/f2/fc/f8d9c31db14fcec13748d373e668bc3bed94d9077dbc17fb0eebc073233c/psutil-7.2.2-cp314-cp314t-win_arm64.whl", hash = "sha256:11fe5a4f613759764e79c65cf11ebdf26e33d6dd34336f8a337aa2996d71c841", size = 136284, upload-time = "2026-01-28T18:15:19.912Z" }, + { url = "https://files.pythonhosted.org/packages/80/c4/f5af4c1ca8c1eeb2e92ccca14ce8effdeec651d5ab6053c589b074eda6e1/psutil-7.2.2-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:1a7b04c10f32cc88ab39cbf606e117fd74721c831c98a27dc04578deb0c16979", size = 129859, upload-time = "2026-01-28T18:15:23.795Z" }, + { url = "https://files.pythonhosted.org/packages/b5/70/5d8df3b09e25bce090399cf48e452d25c935ab72dad19406c77f4e828045/psutil-7.2.2-cp36-abi3-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:076a2d2f923fd4821644f5ba89f059523da90dc9014e85f8e45a5774ca5bc6f9", size = 155560, upload-time = "2026-01-28T18:15:25.976Z" }, + { url = "https://files.pythonhosted.org/packages/63/65/37648c0c158dc222aba51c089eb3bdfa238e621674dc42d48706e639204f/psutil-7.2.2-cp36-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b0726cecd84f9474419d67252add4ac0cd9811b04d61123054b9fb6f57df6e9e", size = 156997, upload-time = "2026-01-28T18:15:27.794Z" }, + { url = "https://files.pythonhosted.org/packages/8e/13/125093eadae863ce03c6ffdbae9929430d116a246ef69866dad94da3bfbc/psutil-7.2.2-cp36-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:fd04ef36b4a6d599bbdb225dd1d3f51e00105f6d48a28f006da7f9822f2606d8", size = 148972, upload-time = "2026-01-28T18:15:29.342Z" }, + { url = "https://files.pythonhosted.org/packages/04/78/0acd37ca84ce3ddffaa92ef0f571e073faa6d8ff1f0559ab1272188ea2be/psutil-7.2.2-cp36-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:b58fabe35e80b264a4e3bb23e6b96f9e45a3df7fb7eed419ac0e5947c61e47cc", size = 148266, upload-time = "2026-01-28T18:15:31.597Z" }, + { url = "https://files.pythonhosted.org/packages/b4/90/e2159492b5426be0c1fef7acba807a03511f97c5f86b3caeda6ad92351a7/psutil-7.2.2-cp37-abi3-win_amd64.whl", hash = "sha256:eb7e81434c8d223ec4a219b5fc1c47d0417b12be7ea866e24fb5ad6e84b3d988", size = 137737, upload-time = "2026-01-28T18:15:33.849Z" }, + { url = "https://files.pythonhosted.org/packages/8c/c7/7bb2e321574b10df20cbde462a94e2b71d05f9bbda251ef27d104668306a/psutil-7.2.2-cp37-abi3-win_arm64.whl", hash = "sha256:8c233660f575a5a89e6d4cb65d9f938126312bca76d8fe087b947b3a1aaac9ee", size = 134617, upload-time = "2026-01-28T18:15:36.514Z" }, +] + +[[package]] +name = "ptyprocess" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/20/e5/16ff212c1e452235a90aeb09066144d0c5a6a8c0834397e03f5224495c4e/ptyprocess-0.7.0.tar.gz", hash = "sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220", size = 70762, upload-time = "2020-12-28T15:15:30.155Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/22/a6/858897256d0deac81a172289110f31629fc4cee19b6f01283303e18c8db3/ptyprocess-0.7.0-py2.py3-none-any.whl", hash = "sha256:4b41f3967fce3af57cc7e94b888626c18bf37a083e3651ca8feeb66d492fef35", size = 13993, upload-time = "2020-12-28T15:15:28.35Z" }, +] + +[[package]] +name = "pure-eval" +version = "0.2.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/da/9f/abfd2959e9261dd5217ca8551d4de211ca6ab26fe9b72cf44731ff6c4442/pure_eval-0.2.4.tar.gz", hash = "sha256:260c2774686e651b79f8b8e7fc9d80b3599ea6a66334b47d5f4abb69fc2c0ea1", size = 20563, upload-time = "2026-09-10T21:41:22.836Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6d/18/83376915176eb058cb86470eb7396388a13350b09a8f233a79303bbcbc5b/pure_eval-0.2.4-py3-none-any.whl", hash = "sha256:96cae060a313cfaad51bb761278bfb0e62dc0248d9315a81173752dc546cd37a", size = 11893, upload-time = "2026-09-10T21:41:21.532Z" }, +] + [[package]] name = "pyarrow" version = "25.0.0" @@ -3656,20 +3874,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/10/bd/c038d7cc38edc1aa5bf91ab8068b63d4308c66c4c8bb3cbba7dfbc049f9c/pyparsing-3.3.2-py3-none-any.whl", hash = "sha256:850ba148bd908d7e2411587e247a1e4f0327839c40e2e5e6d05a007ecc69911d", size = 122781, upload-time = "2026-01-21T03:57:55.912Z" }, ] -[[package]] -name = "pyquaternion" -version = "0.9.9" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" }, - { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12' and python_full_version < '3.14'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/7d/0d/3d092aa20efaedacb89c3221a92c6491be5b28f618a2c36b52b53e7446c2/pyquaternion-0.9.9.tar.gz", hash = "sha256:b1f61af219cb2fe966b5fb79a192124f2e63a3f7a777ac3cadf2957b1a81bea8", size = 15530, upload-time = "2020-10-05T01:31:30.327Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/49/b3/d8482e8cacc8ea15a356efea13d22ce1c5914a9ee36622ba250523240bf2/pyquaternion-0.9.9-py3-none-any.whl", hash = "sha256:e65f6e3f7b1fdf1a9e23f82434334a1ae84f14223eee835190cd2e841f8172ec", size = 14361, upload-time = "2020-10-05T01:31:37.575Z" }, -] - [[package]] name = "pyright" version = "1.1.411" @@ -3839,9 +4043,9 @@ name = "referencing" version = "0.37.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "attrs", marker = "python_full_version < '3.14'" }, + { name = "attrs" }, { name = "rpds-py", version = "0.30.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, - { name = "rpds-py", version = "2026.6.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11' and python_full_version < '3.14'" }, + { name = "rpds-py", version = "2026.6.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" }, { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" } @@ -3904,7 +4108,6 @@ resolution-markers = [ ] sdist = { url = "https://files.pythonhosted.org/packages/20/af/3f2f423103f1113b36230496629986e0ef7e199d2aa8392452b484b38ced/rpds_py-0.30.0.tar.gz", hash = "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84", size = 69469, upload-time = "2025-11-30T20:24:38.837Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/06/0c/0c411a0ec64ccb6d104dcabe0e713e05e153a9a2c3c2bd2b32ce412166fe/rpds_py-0.30.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:679ae98e00c0e8d68a7fda324e16b90fd5260945b45d3b824c892cec9eea3288", size = 370490, upload-time = "2025-11-30T20:21:33.256Z" }, { url = "https://files.pythonhosted.org/packages/19/6a/4ba3d0fb7297ebae71171822554abe48d7cab29c28b8f9f2c04b79988c05/rpds_py-0.30.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4cc2206b76b4f576934f0ed374b10d7ca5f457858b157ca52064bdfc26b9fc00", size = 359751, upload-time = "2025-11-30T20:21:34.591Z" }, { url = "https://files.pythonhosted.org/packages/cd/7c/e4933565ef7f7a0818985d87c15d9d273f1a649afa6a52ea35ad011195ea/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:389a2d49eded1896c3d48b0136ead37c48e221b391c052fba3f4055c367f60a6", size = 389696, upload-time = "2025-11-30T20:21:36.122Z" }, { url = "https://files.pythonhosted.org/packages/5e/01/6271a2511ad0815f00f7ed4390cf2567bec1d4b1da39e2c27a41e6e3b4de/rpds_py-0.30.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:32c8528634e1bf7121f3de08fa85b138f4e0dc47657866630611b03967f041d7", size = 403136, upload-time = "2025-11-30T20:21:37.728Z" }, @@ -3918,7 +4121,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/48/ac/f01fc22efec3f37d8a914fc1b2fb9bcafd56a299edbe96406f3053edea5a/rpds_py-0.30.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7c64d38fb49b6cdeda16ab49e35fe0da2e1e9b34bc38bd78386530f218b37139", size = 560792, upload-time = "2025-11-30T20:21:50.024Z" }, { url = "https://files.pythonhosted.org/packages/e2/da/4e2b19d0f131f35b6146425f846563d0ce036763e38913d917187307a671/rpds_py-0.30.0-cp310-cp310-win32.whl", hash = "sha256:6de2a32a1665b93233cde140ff8b3467bdb9e2af2b91079f0333a0974d12d464", size = 221901, upload-time = "2025-11-30T20:21:51.32Z" }, { url = "https://files.pythonhosted.org/packages/96/cb/156d7a5cf4f78a7cc571465d8aec7a3c447c94f6749c5123f08438bcf7bc/rpds_py-0.30.0-cp310-cp310-win_amd64.whl", hash = "sha256:1726859cd0de969f88dc8673bdd954185b9104e05806be64bcd87badbe313169", size = 235823, upload-time = "2025-11-30T20:21:52.505Z" }, - { url = "https://files.pythonhosted.org/packages/4d/6e/f964e88b3d2abee2a82c1ac8366da848fce1c6d834dc2132c3fda3970290/rpds_py-0.30.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a2bffea6a4ca9f01b3f8e548302470306689684e61602aa3d141e34da06cf425", size = 370157, upload-time = "2025-11-30T20:21:53.789Z" }, { url = "https://files.pythonhosted.org/packages/94/ba/24e5ebb7c1c82e74c4e4f33b2112a5573ddc703915b13a073737b59b86e0/rpds_py-0.30.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dc4f992dfe1e2bc3ebc7444f6c7051b4bc13cd8e33e43511e8ffd13bf407010d", size = 359676, upload-time = "2025-11-30T20:21:55.475Z" }, { url = "https://files.pythonhosted.org/packages/84/86/04dbba1b087227747d64d80c3b74df946b986c57af0a9f0c98726d4d7a3b/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:422c3cb9856d80b09d30d2eb255d0754b23e090034e1deb4083f8004bd0761e4", size = 389938, upload-time = "2025-11-30T20:21:57.079Z" }, { url = "https://files.pythonhosted.org/packages/42/bb/1463f0b1722b7f45431bdd468301991d1328b16cffe0b1c2918eba2c4eee/rpds_py-0.30.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:07ae8a593e1c3c6b82ca3292efbe73c30b61332fd612e05abee07c79359f292f", size = 402932, upload-time = "2025-11-30T20:21:58.47Z" }, @@ -3933,7 +4135,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/22/16/cd3027c7e279d22e5eb431dd3c0fbc677bed58797fe7581e148f3f68818b/rpds_py-0.30.0-cp311-cp311-win32.whl", hash = "sha256:55f66022632205940f1827effeff17c4fa7ae1953d2b74a8581baaefb7d16f8c", size = 221406, upload-time = "2025-11-30T20:22:13.101Z" }, { url = "https://files.pythonhosted.org/packages/fa/5b/e7b7aa136f28462b344e652ee010d4de26ee9fd16f1bfd5811f5153ccf89/rpds_py-0.30.0-cp311-cp311-win_amd64.whl", hash = "sha256:a51033ff701fca756439d641c0ad09a41d9242fa69121c7d8769604a0a629825", size = 236024, upload-time = "2025-11-30T20:22:14.853Z" }, { url = "https://files.pythonhosted.org/packages/14/a6/364bba985e4c13658edb156640608f2c9e1d3ea3c81b27aa9d889fff0e31/rpds_py-0.30.0-cp311-cp311-win_arm64.whl", hash = "sha256:47b0ef6231c58f506ef0b74d44e330405caa8428e770fec25329ed2cb971a229", size = 229069, upload-time = "2025-11-30T20:22:16.577Z" }, - { url = "https://files.pythonhosted.org/packages/03/e7/98a2f4ac921d82f33e03f3835f5bf3a4a40aa1bfdc57975e74a97b2b4bdd/rpds_py-0.30.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a161f20d9a43006833cd7068375a94d035714d73a172b681d8881820600abfad", size = 375086, upload-time = "2025-11-30T20:22:17.93Z" }, { url = "https://files.pythonhosted.org/packages/4d/a1/bca7fd3d452b272e13335db8d6b0b3ecde0f90ad6f16f3328c6fb150c889/rpds_py-0.30.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6abc8880d9d036ecaafe709079969f56e876fcf107f7a8e9920ba6d5a3878d05", size = 359053, upload-time = "2025-11-30T20:22:19.297Z" }, { url = "https://files.pythonhosted.org/packages/65/1c/ae157e83a6357eceff62ba7e52113e3ec4834a84cfe07fa4b0757a7d105f/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca28829ae5f5d569bb62a79512c842a03a12576375d5ece7d2cadf8abe96ec28", size = 390763, upload-time = "2025-11-30T20:22:21.661Z" }, { url = "https://files.pythonhosted.org/packages/d4/36/eb2eb8515e2ad24c0bd43c3ee9cd74c33f7ca6430755ccdb240fd3144c44/rpds_py-0.30.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1010ed9524c73b94d15919ca4d41d8780980e1765babf85f9a2f90d247153dd", size = 408951, upload-time = "2025-11-30T20:22:23.408Z" }, @@ -3948,7 +4149,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6f/ab/d5d5e3bcedb0a77f4f613706b750e50a5a3ba1c15ccd3665ecc636c968fd/rpds_py-0.30.0-cp312-cp312-win32.whl", hash = "sha256:1ab5b83dbcf55acc8b08fc62b796ef672c457b17dbd7820a11d6c52c06839bdf", size = 223782, upload-time = "2025-11-30T20:22:37.271Z" }, { url = "https://files.pythonhosted.org/packages/39/3b/f786af9957306fdc38a74cef405b7b93180f481fb48453a114bb6465744a/rpds_py-0.30.0-cp312-cp312-win_amd64.whl", hash = "sha256:a090322ca841abd453d43456ac34db46e8b05fd9b3b4ac0c78bcde8b089f959b", size = 240463, upload-time = "2025-11-30T20:22:39.021Z" }, { url = "https://files.pythonhosted.org/packages/f3/d2/b91dc748126c1559042cfe41990deb92c4ee3e2b415f6b5234969ffaf0cc/rpds_py-0.30.0-cp312-cp312-win_arm64.whl", hash = "sha256:669b1805bd639dd2989b281be2cfd951c6121b65e729d9b843e9639ef1fd555e", size = 230868, upload-time = "2025-11-30T20:22:40.493Z" }, - { url = "https://files.pythonhosted.org/packages/ed/dc/d61221eb88ff410de3c49143407f6f3147acf2538c86f2ab7ce65ae7d5f9/rpds_py-0.30.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f83424d738204d9770830d35290ff3273fbb02b41f919870479fab14b9d303b2", size = 374887, upload-time = "2025-11-30T20:22:41.812Z" }, { url = "https://files.pythonhosted.org/packages/fd/32/55fb50ae104061dbc564ef15cc43c013dc4a9f4527a1f4d99baddf56fe5f/rpds_py-0.30.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e7536cd91353c5273434b4e003cbda89034d67e7710eab8761fd918ec6c69cf8", size = 358904, upload-time = "2025-11-30T20:22:43.479Z" }, { url = "https://files.pythonhosted.org/packages/58/70/faed8186300e3b9bdd138d0273109784eea2396c68458ed580f885dfe7ad/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2771c6c15973347f50fece41fc447c054b7ac2ae0502388ce3b6738cd366e3d4", size = 389945, upload-time = "2025-11-30T20:22:44.819Z" }, { url = "https://files.pythonhosted.org/packages/bd/a8/073cac3ed2c6387df38f71296d002ab43496a96b92c823e76f46b8af0543/rpds_py-0.30.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0a59119fc6e3f460315fe9d08149f8102aa322299deaa5cab5b40092345c2136", size = 407783, upload-time = "2025-11-30T20:22:46.103Z" }, @@ -3963,7 +4163,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/0b/5d/47c4655e9bcd5ca907148535c10e7d489044243cc9941c16ed7cd53be91d/rpds_py-0.30.0-cp313-cp313-win32.whl", hash = "sha256:b40fb160a2db369a194cb27943582b38f79fc4887291417685f3ad693c5a1d5d", size = 223139, upload-time = "2025-11-30T20:23:00.209Z" }, { url = "https://files.pythonhosted.org/packages/f2/e1/485132437d20aa4d3e1d8b3fb5a5e65aa8139f1e097080c2a8443201742c/rpds_py-0.30.0-cp313-cp313-win_amd64.whl", hash = "sha256:806f36b1b605e2d6a72716f321f20036b9489d29c51c91f4dd29a3e3afb73b15", size = 240224, upload-time = "2025-11-30T20:23:02.008Z" }, { url = "https://files.pythonhosted.org/packages/24/95/ffd128ed1146a153d928617b0ef673960130be0009c77d8fbf0abe306713/rpds_py-0.30.0-cp313-cp313-win_arm64.whl", hash = "sha256:d96c2086587c7c30d44f31f42eae4eac89b60dabbac18c7669be3700f13c3ce1", size = 230645, upload-time = "2025-11-30T20:23:03.43Z" }, - { url = "https://files.pythonhosted.org/packages/ff/1b/b10de890a0def2a319a2626334a7f0ae388215eb60914dbac8a3bae54435/rpds_py-0.30.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:eb0b93f2e5c2189ee831ee43f156ed34e2a89a78a66b98cadad955972548be5a", size = 364443, upload-time = "2025-11-30T20:23:04.878Z" }, { url = "https://files.pythonhosted.org/packages/0d/bf/27e39f5971dc4f305a4fb9c672ca06f290f7c4e261c568f3dea16a410d47/rpds_py-0.30.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:922e10f31f303c7c920da8981051ff6d8c1a56207dbdf330d9047f6d30b70e5e", size = 353375, upload-time = "2025-11-30T20:23:06.342Z" }, { url = "https://files.pythonhosted.org/packages/40/58/442ada3bba6e8e6615fc00483135c14a7538d2ffac30e2d933ccf6852232/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cdc62c8286ba9bf7f47befdcea13ea0e26bf294bda99758fd90535cbaf408000", size = 383850, upload-time = "2025-11-30T20:23:07.825Z" }, { url = "https://files.pythonhosted.org/packages/14/14/f59b0127409a33c6ef6f5c1ebd5ad8e32d7861c9c7adfa9a624fc3889f6c/rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:47f9a91efc418b54fb8190a6b4aa7813a23fb79c51f4bb84e418f5476c38b8db", size = 392812, upload-time = "2025-11-30T20:23:09.228Z" }, @@ -3977,7 +4176,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6d/61/21b8c41f68e60c8cc3b2e25644f0e3681926020f11d06ab0b78e3c6bbff1/rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:4c5f36a861bc4b7da6516dbdf302c55313afa09b81931e8280361a4f6c9a2d27", size = 555806, upload-time = "2025-11-30T20:23:22.488Z" }, { url = "https://files.pythonhosted.org/packages/f9/39/7e067bb06c31de48de3eb200f9fc7c58982a4d3db44b07e73963e10d3be9/rpds_py-0.30.0-cp313-cp313t-win32.whl", hash = "sha256:3d4a69de7a3e50ffc214ae16d79d8fbb0922972da0356dcf4d0fdca2878559c6", size = 211341, upload-time = "2025-11-30T20:23:24.449Z" }, { url = "https://files.pythonhosted.org/packages/0a/4d/222ef0b46443cf4cf46764d9c630f3fe4abaa7245be9417e56e9f52b8f65/rpds_py-0.30.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f14fc5df50a716f7ece6a80b6c78bb35ea2ca47c499e422aa4463455dd96d56d", size = 225768, upload-time = "2025-11-30T20:23:25.908Z" }, - { url = "https://files.pythonhosted.org/packages/86/81/dad16382ebbd3d0e0328776d8fd7ca94220e4fa0798d1dc5e7da48cb3201/rpds_py-0.30.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0", size = 362099, upload-time = "2025-11-30T20:23:27.316Z" }, { url = "https://files.pythonhosted.org/packages/2b/60/19f7884db5d5603edf3c6bce35408f45ad3e97e10007df0e17dd57af18f8/rpds_py-0.30.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be", size = 353192, upload-time = "2025-11-30T20:23:29.151Z" }, { url = "https://files.pythonhosted.org/packages/bf/c4/76eb0e1e72d1a9c4703c69607cec123c29028bff28ce41588792417098ac/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f", size = 384080, upload-time = "2025-11-30T20:23:30.785Z" }, { url = "https://files.pythonhosted.org/packages/72/87/87ea665e92f3298d1b26d78814721dc39ed8d2c74b86e83348d6b48a6f31/rpds_py-0.30.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f", size = 394841, upload-time = "2025-11-30T20:23:32.209Z" }, @@ -3992,7 +4190,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/72/c7/81dadd7b27c8ee391c132a6b192111ca58d866577ce2d9b0ca157552cce0/rpds_py-0.30.0-cp314-cp314-win32.whl", hash = "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed", size = 215298, upload-time = "2025-11-30T20:23:47.696Z" }, { url = "https://files.pythonhosted.org/packages/3e/d2/1aaac33287e8cfb07aab2e6b8ac1deca62f6f65411344f1433c55e6f3eb8/rpds_py-0.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950", size = 228604, upload-time = "2025-11-30T20:23:49.501Z" }, { url = "https://files.pythonhosted.org/packages/e8/95/ab005315818cc519ad074cb7784dae60d939163108bd2b394e60dc7b5461/rpds_py-0.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6", size = 222391, upload-time = "2025-11-30T20:23:50.96Z" }, - { url = "https://files.pythonhosted.org/packages/9e/68/154fe0194d83b973cdedcdcc88947a2752411165930182ae41d983dcefa6/rpds_py-0.30.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb", size = 364868, upload-time = "2025-11-30T20:23:52.494Z" }, { url = "https://files.pythonhosted.org/packages/83/69/8bbc8b07ec854d92a8b75668c24d2abcb1719ebf890f5604c61c9369a16f/rpds_py-0.30.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8", size = 353747, upload-time = "2025-11-30T20:23:54.036Z" }, { url = "https://files.pythonhosted.org/packages/ab/00/ba2e50183dbd9abcce9497fa5149c62b4ff3e22d338a30d690f9af970561/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7", size = 383795, upload-time = "2025-11-30T20:23:55.556Z" }, { url = "https://files.pythonhosted.org/packages/05/6f/86f0272b84926bcb0e4c972262f54223e8ecc556b3224d281e6598fc9268/rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898", size = 393330, upload-time = "2025-11-30T20:23:57.033Z" }, @@ -4006,7 +4203,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/85/70/92482ccffb96f5441aab93e26c4d66489eb599efdcf96fad90c14bbfb976/rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40", size = 556030, upload-time = "2025-11-30T20:24:10.956Z" }, { url = "https://files.pythonhosted.org/packages/20/53/7c7e784abfa500a2b6b583b147ee4bb5a2b3747a9166bab52fec4b5b5e7d/rpds_py-0.30.0-cp314-cp314t-win32.whl", hash = "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0", size = 211570, upload-time = "2025-11-30T20:24:12.735Z" }, { url = "https://files.pythonhosted.org/packages/d0/02/fa464cdfbe6b26e0600b62c528b72d8608f5cc49f96b8d6e38c95d60c676/rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3", size = 226532, upload-time = "2025-11-30T20:24:14.634Z" }, - { url = "https://files.pythonhosted.org/packages/69/71/3f34339ee70521864411f8b6992e7ab13ac30d8e4e3309e07c7361767d91/rpds_py-0.30.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:c2262bdba0ad4fc6fb5545660673925c2d2a5d9e2e0fb603aad545427be0fc58", size = 372292, upload-time = "2025-11-30T20:24:16.537Z" }, { url = "https://files.pythonhosted.org/packages/57/09/f183df9b8f2d66720d2ef71075c59f7e1b336bec7ee4c48f0a2b06857653/rpds_py-0.30.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:ee6af14263f25eedc3bb918a3c04245106a42dfd4f5c2285ea6f997b1fc3f89a", size = 362128, upload-time = "2025-11-30T20:24:18.086Z" }, { url = "https://files.pythonhosted.org/packages/7a/68/5c2594e937253457342e078f0cc1ded3dd7b2ad59afdbf2d354869110a02/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3adbb8179ce342d235c31ab8ec511e66c73faa27a47e076ccc92421add53e2bb", size = 391542, upload-time = "2025-11-30T20:24:20.092Z" }, { url = "https://files.pythonhosted.org/packages/49/5c/31ef1afd70b4b4fbdb2800249f34c57c64beb687495b10aec0365f53dfc4/rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:250fa00e9543ac9b97ac258bd37367ff5256666122c2d0f2bc97577c60a1818c", size = 404004, upload-time = "2025-11-30T20:24:22.231Z" }, @@ -4025,12 +4221,12 @@ name = "rpds-py" version = "2026.6.3" source = { registry = "https://pypi.org/simple" } resolution-markers = [ + "python_full_version >= '3.14'", "python_full_version >= '3.12' and python_full_version < '3.14'", "python_full_version == '3.11.*'", ] sdist = { url = "https://files.pythonhosted.org/packages/aa/2a/9618a122aeb2a169a28b03889a2995fe297588964333d4a7d67bdf46e147/rpds_py-2026.6.3.tar.gz", hash = "sha256:1cebd1337c242e4ec2293e541f712b2da849b29f48f0c293684b71c0632625d4", size = 64051, upload-time = "2026-06-30T07:17:53.009Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/94/1f/a2dca5ffdbf1d475ffc4e80e4d5d720ff3a00f691795910116960ee12511/rpds_py-2026.6.3-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:7b689145a1485c335569bd056464f3243a29af7ed3871c7be31ad624ba239bc7", size = 342174, upload-time = "2026-06-30T07:14:54.821Z" }, { url = "https://files.pythonhosted.org/packages/4d/dc/323d08583c0832911768663d1944f0107fcd4088704858d84b5e06d105a0/rpds_py-2026.6.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:db08f45aecde626498fb3df07bcf6d2ec040af42e859a4f5040d79c200342911", size = 345513, upload-time = "2026-06-30T07:14:56.515Z" }, { url = "https://files.pythonhosted.org/packages/0b/2a/e31989834d18d2f26ec1d2774c5b1eb3331df4ea8ada525175294c94b48a/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:acc992ab27b15f852c76755eb2ab7dce86585ddadba6fa5946e58556088845b4", size = 373783, upload-time = "2026-06-30T07:14:57.736Z" }, { url = "https://files.pythonhosted.org/packages/87/fe/e80107ee3639585c9941c17d6a42cd65325022f656c023191fce78c324c8/rpds_py-2026.6.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7f88d653e7b3b779d71ae7454e20dcc9b6bae903f33c269db9f2be41bda3f261", size = 378316, upload-time = "2026-06-30T07:14:59.077Z" }, @@ -4045,7 +4241,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c9/e1/90ef639217a5ddb15b7f4f61b1c33911fd044ad03c311bafdd2bcab85582/rpds_py-2026.6.3-cp311-cp311-win32.whl", hash = "sha256:de3eceba0b683bcbb1ab93da016d0270df1f9ae7be716b40214c5dafac6ea45a", size = 204453, upload-time = "2026-06-30T07:15:11.324Z" }, { url = "https://files.pythonhosted.org/packages/f2/b7/b7a1695d7af36f521fb11e80d6d3adbd744f73b921859bd3c2a2c0dc706f/rpds_py-2026.6.3-cp311-cp311-win_amd64.whl", hash = "sha256:2c54a076ca4d370980ab57bc0e31df57bbe8d41340436a90ef8b1219a3cbb127", size = 223219, upload-time = "2026-06-30T07:15:12.476Z" }, { url = "https://files.pythonhosted.org/packages/d7/a2/145afacf796e4506062825941176ad9445c2dcf2b3b6a1f13d3030a15e19/rpds_py-2026.6.3-cp311-cp311-win_arm64.whl", hash = "sha256:168c733a7112e071bb7a66460e667edfcff06c017a3c523f7a8a8e08d0140804", size = 219137, upload-time = "2026-06-30T07:15:13.631Z" }, - { url = "https://files.pythonhosted.org/packages/5c/be/2e8974163072e7bab7df1a5acd54c4498e75e35d6d18b864d3a9d5dadc92/rpds_py-2026.6.3-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a0811d33247c3d6128a3001d763f2aa056bb3425204335400ac54f89eec3a0d0", size = 343691, upload-time = "2026-06-30T07:15:14.96Z" }, { url = "https://files.pythonhosted.org/packages/a4/73/319dfa745dd668efe89309141ded489126461fcecd2b8f3a3cda185129b6/rpds_py-2026.6.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:538949e262e46caa31ac01bdb3c1e8f642622922cacbabbae6a8445d9dc33eaf", size = 338542, upload-time = "2026-06-30T07:15:16.267Z" }, { url = "https://files.pythonhosted.org/packages/21/63/4239893be1c4d09b709b1a8f6be4188f0870084ff547f46606b8a75f1b03/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:55927d532399c2c646100ff7feb48eaa940ad70f42cd68e1328f3ded9f81ca24", size = 368180, upload-time = "2026-06-30T07:15:17.62Z" }, { url = "https://files.pythonhosted.org/packages/1c/ca/9c5de382225234ceb37b1844ebdb140db12b2a278bb9efe2fcd19f6c82ce/rpds_py-2026.6.3-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f56f1695bc5c0871cbc33dc0130fcf503aab0c57dcc5a6700a4f49eba4f2652e", size = 375067, upload-time = "2026-06-30T07:15:18.952Z" }, @@ -4060,7 +4255,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c9/50/22f73127a41f1ce4f87fe39aadfb9a126345801c274aa93ae88456249327/rpds_py-2026.6.3-cp312-cp312-win32.whl", hash = "sha256:501f9f04a588d6a09179368c57071301445191767c64e4b52a6aa9871f1ef5ed", size = 202185, upload-time = "2026-06-30T07:15:32.027Z" }, { url = "https://files.pythonhosted.org/packages/04/3a/f0ee4d4dde9d3b69dedf1b5f74e7a40017046d55052d173e418c6a94f960/rpds_py-2026.6.3-cp312-cp312-win_amd64.whl", hash = "sha256:2c958bf94822e9290a40aaf2a822d4bc5c88099093e3948ad6c571eca9272e5f", size = 220394, upload-time = "2026-06-30T07:15:33.359Z" }, { url = "https://files.pythonhosted.org/packages/f3/83/3382fe37f809b59f02aac04dbc4e765b480b46ee0227ed516e3bdc4d3dfc/rpds_py-2026.6.3-cp312-cp312-win_arm64.whl", hash = "sha256:22bffe6042b9bcb0822bcd1955ec00e245daf17b4344e4ed8e9551b976b63e96", size = 215753, upload-time = "2026-06-30T07:15:34.778Z" }, - { url = "https://files.pythonhosted.org/packages/a4/9e/b818ee580026ec578138e961027a68820c40afeb1ec8f6819b54fb99e196/rpds_py-2026.6.3-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:3cfe765c1da0072636ca06628261e0ea05688e160d5c8a03e0217c3854037223", size = 343012, upload-time = "2026-06-30T07:15:36.005Z" }, { url = "https://files.pythonhosted.org/packages/f3/6b/686d9dc4359a8f163cfbbf89ee0b4e586431de22fe8248edb63a8cf50d49/rpds_py-2026.6.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f4d78253f6996be4901669ad25319f842f740eccf4d58e3c7f3dd39e6dde1d8f", size = 338203, upload-time = "2026-06-30T07:15:37.462Z" }, { url = "https://files.pythonhosted.org/packages/9e/9b/069aa329940f8207615e091f5eedbbd40e1e15eac68a0790fd05ccdf796c/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54f45a148e28767bf343d33a684693c70e451c6f4c0e9904709a723fafbdfc1f", size = 367984, upload-time = "2026-06-30T07:15:39.008Z" }, { url = "https://files.pythonhosted.org/packages/14/db/34c203e4becff3703e4d3bc121842c00b8689197f398161203a880052f4e/rpds_py-2026.6.3-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:842e7b070435622248c7a2c44ae53fa1440e073cc3023bc919fed570884097a7", size = 374815, upload-time = "2026-06-30T07:15:40.253Z" }, @@ -4075,7 +4269,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/85/ed/adab103321c0a6565d5ae1c2998349bc3ee175b82ccc5ae8fc04cc413075/rpds_py-2026.6.3-cp313-cp313-win32.whl", hash = "sha256:8c3d1e9c15b9d51ca0391e13da1a25a0a4df3c58a37c9dc368e0736cf7f69df0", size = 201710, upload-time = "2026-06-30T07:15:53.894Z" }, { url = "https://files.pythonhosted.org/packages/7b/ed/a03b09668e74e5dabbf2e211f6468e1820c0552f7b0500082da31841bf7b/rpds_py-2026.6.3-cp313-cp313-win_amd64.whl", hash = "sha256:9250a9a0a6fd4648b3f868da8d91a4c52b5811a62df58e753d50ae4454a36f80", size = 219454, upload-time = "2026-06-30T07:15:55.25Z" }, { url = "https://files.pythonhosted.org/packages/27/17/b8642c12930b71bc2b25831f6708ccf0f75abcd11883932ec9ce54ba3a78/rpds_py-2026.6.3-cp313-cp313-win_arm64.whl", hash = "sha256:900a67df3fd1660b035a4761c4ce73c382ea6b35f90f9863c36c6fd8bf8b09bb", size = 215063, upload-time = "2026-06-30T07:15:56.573Z" }, - { url = "https://files.pythonhosted.org/packages/b6/36/7fbe9dcdaf857fb3f63c2a2284b62492d95f5e8334e947e5fb6e7f68c9be/rpds_py-2026.6.3-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:931908d9fc855d8f74783377822be318edb6dcb19e47169dc038f9a1bf60b06e", size = 344510, upload-time = "2026-06-30T07:15:57.921Z" }, { url = "https://files.pythonhosted.org/packages/ba/54/f785cc3d3f60839ca57a5af4927a9f347b07b2799c373fc20f7949f87c7e/rpds_py-2026.6.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:d7469697dce35be237db177d42e2a2ee26e6dcc5fc052078a6fefabd288c6edd", size = 339495, upload-time = "2026-06-30T07:15:59.238Z" }, { url = "https://files.pythonhosted.org/packages/63/ef/d4cdaf309e6b095b43597103cf8c0b951d6cca2acce68c474f75ec12e0c7/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bcfbcf66006befb9fd2aeaa9e01feaf881b4dc330a02ba07d2322b1c11be7b5d", size = 369454, upload-time = "2026-06-30T07:16:01.021Z" }, { url = "https://files.pythonhosted.org/packages/96/4a/9559a68b7ee15db09d7981212e8c2e219d2a1d6d4faa0391d813c3496a36/rpds_py-2026.6.3-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:847927daf4cffbd4e90e42bc890069897101edd015f956cb8721b3473372edda", size = 374583, upload-time = "2026-06-30T07:16:02.287Z" }, @@ -4090,7 +4283,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/87/03/2a69ab618a789cf6cf85c86bb844c62d090e700ab1a2aa676b3741b6c516/rpds_py-2026.6.3-cp314-cp314-win32.whl", hash = "sha256:882076c00c0a608b131187055ddc5ae29f2e7eaf870d6168980420d58528a5c8", size = 202504, upload-time = "2026-06-30T07:16:16.893Z" }, { url = "https://files.pythonhosted.org/packages/85/62/a3892ba945f4e24c78f352e5de3c7620d8479f73f211406a97263d13c7d2/rpds_py-2026.6.3-cp314-cp314-win_amd64.whl", hash = "sha256:0be972be84cfcaf46c8c6edf690ca0f154ac17babf1f6a955a51579b34ad2dc5", size = 220380, upload-time = "2026-06-30T07:16:18.108Z" }, { url = "https://files.pythonhosted.org/packages/3d/e7/c2bd44dc831931815ad11ebb5f430b5a0a4d3caa9de837107876c30c3432/rpds_py-2026.6.3-cp314-cp314-win_arm64.whl", hash = "sha256:2a9c6f195058cb45335e8cc3802745c603d716eb96bc9625950c1aac71c0c703", size = 215976, upload-time = "2026-06-30T07:16:19.654Z" }, - { url = "https://files.pythonhosted.org/packages/79/9c/fff7b74bce9a091ec9a012a03f9ff5f69364eaf9451060dfc4486da2ffdd/rpds_py-2026.6.3-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:f90938e92afda60266da758ee7d363447f7f0138c9559f9e1811629580582d90", size = 346840, upload-time = "2026-06-30T07:16:21.268Z" }, { url = "https://files.pythonhosted.org/packages/e9/44/77bcb1168b33704908295533d27f10eb811e9e3e193e8993dc99572211d3/rpds_py-2026.6.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ec829541c45bca16e61c7ae50c20501f213605beb75d1aba91a6ee37fbbb56a4", size = 340282, upload-time = "2026-06-30T07:16:22.875Z" }, { url = "https://files.pythonhosted.org/packages/87/3c/7a9081c7c9e645b39efe19e4ffbeccd80add246327cd9b888aecffd72317/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afd70d95892096cdb26f15a00c45907b17817577aa8d1c76b2dcc2788391f9e9", size = 370403, upload-time = "2026-06-30T07:16:24.415Z" }, { url = "https://files.pythonhosted.org/packages/f7/69/af47021eb7dad6ff3396cb001c08f0f3c4d06c20253f75be6421a59fe6b7/rpds_py-2026.6.3-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:29dfa0533a5d4c94d4dfa1b694fcb56c9c63aad8330ffdd816fd225d0a7a162f", size = 376055, upload-time = "2026-06-30T07:16:26.111Z" }, @@ -4104,7 +4296,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/5b/de/e0674bdbc3ef7634989b3f854c3f34bc1f587d36e5bfdc5c378d57034619/rpds_py-2026.6.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ea7bb13b7c9a29791f87a0387ba7d3ad3a6d783d827e4d3f27b40a0ff44495e2", size = 576486, upload-time = "2026-06-30T07:16:39.797Z" }, { url = "https://files.pythonhosted.org/packages/f2/f6/21101359743cd136ada781e8210a85769578422ba460672eea0e29739200/rpds_py-2026.6.3-cp314-cp314t-win32.whl", hash = "sha256:6de4744d05bd1aa1be4ed7ea1189e3979196808008113bbbf899a460966b925e", size = 201068, upload-time = "2026-06-30T07:16:41.316Z" }, { url = "https://files.pythonhosted.org/packages/a6/b2/9574d4d44f7760c2aa32d92a0a4f41698e33f5b204a0bf5c9758f52c79d5/rpds_py-2026.6.3-cp314-cp314t-win_amd64.whl", hash = "sha256:c7b9a2f8f4d8e90af72571d3d495deebdd7e3c75451f5b41719aee166e940fc2", size = 220600, upload-time = "2026-06-30T07:16:43.091Z" }, - { url = "https://files.pythonhosted.org/packages/08/ae/f23a2697e6ee6340a578b0f136be6483657bef0c6f9497b752bb5c0964bb/rpds_py-2026.6.3-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:e059c5dde6452b44424bd1834557556c226b57781dee1227af23518459722b13", size = 344726, upload-time = "2026-06-30T07:16:44.5Z" }, { url = "https://files.pythonhosted.org/packages/c3/63/e7b3a1a5358dd32c930a1062d8e15b67fd6e8922e81df9e91706d66ee5c8/rpds_py-2026.6.3-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:2f7c26fbc5acd2522b95d4177fe4710ffd8e9b20529e703ffbf8db4d93903f05", size = 339587, upload-time = "2026-06-30T07:16:46.255Z" }, { url = "https://files.pythonhosted.org/packages/ec/64/10a85681916ca55fffb91b0a211f84e34297c109243484dd6394660a8a7c/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3086b538543802f84c843911242db20447de00d8752dd0efc936dbcf02218ba", size = 369585, upload-time = "2026-06-30T07:16:48.101Z" }, { url = "https://files.pythonhosted.org/packages/76/c2/baf95c7c38823e12ba34407c5f5767a89e5cf2233895e56f608167ae9493/rpds_py-2026.6.3-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8f2e5c5ee828d42cb11760761c0af6507927bec42d0ad5458f97c9203b054617", size = 375479, upload-time = "2026-06-30T07:16:49.93Z" }, @@ -4119,7 +4310,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/29/71/4d8fcf700931815594bce892255bbd973b94efaf0fc1932b0590df18d886/rpds_py-2026.6.3-cp315-cp315-win32.whl", hash = "sha256:d483fe17f01ad64b7bf7cc38fcefff1ca9fb83f8c2b2542b68f97ffe0611b369", size = 202864, upload-time = "2026-06-30T07:17:05.746Z" }, { url = "https://files.pythonhosted.org/packages/eb/62/b577562de0edbb55b2be85ce5fd09c33e386b9b13eee09833af4240fd5c4/rpds_py-2026.6.3-cp315-cp315-win_amd64.whl", hash = "sha256:67e3a721ffc5d8d2210d3671872298c4a84e4b8035cfe42ffd7cde35d772b146", size = 220430, upload-time = "2026-06-30T07:17:07.471Z" }, { url = "https://files.pythonhosted.org/packages/c8/95/d6d0b2509825141eef60669a5739eec88dbc6a48053d6c92993a5704defe/rpds_py-2026.6.3-cp315-cp315-win_arm64.whl", hash = "sha256:6e84adbcf4bf841aed8116a8264b9f50b4cb3e7bd89b516122e616ac56ca269e", size = 215877, upload-time = "2026-06-30T07:17:09.008Z" }, - { url = "https://files.pythonhosted.org/packages/b7/bf/f3ea278f0afd615c1d0f19cb69043a41526e2bb600c2b536eb192218eb27/rpds_py-2026.6.3-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:ae6dd8f10bd17aad820876d24caec9efdafd80a318d16c0a48edb5e136902c6b", size = 346933, upload-time = "2026-06-30T07:17:10.762Z" }, { url = "https://files.pythonhosted.org/packages/9d/29/9907bdf1c5346763cf10b7f6852aad86652168c259def904cbe0082c5864/rpds_py-2026.6.3-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:bdbd97738551fca3917c1bd7188bec1920bb520104f28e7e1007f9ceb17b7690", size = 340274, upload-time = "2026-06-30T07:17:12.266Z" }, { url = "https://files.pythonhosted.org/packages/6f/2c/8e03767b5778ef25cebf74a7a91a2c3806f8eced4c92cb7406bbe060756d/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b95977e7211527ab0ba576e286d023389fbeeb32a6b7b771665d333c60e5342", size = 370763, upload-time = "2026-06-30T07:17:14.107Z" }, { url = "https://files.pythonhosted.org/packages/2e/e1/df2a7e1ba2efd796af26194250b8d42c821b46592311595162af9ef0528d/rpds_py-2026.6.3-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d15fde0e6fb0d88a60d221204873743e5d9f0b7d29165e62cd86d0413ad74ba6", size = 376467, upload-time = "2026-06-30T07:17:15.76Z" }, @@ -4133,7 +4323,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8b/71/14edf065f04630b1a8472f7653cad03f6c478bcf95ea0e6aed55451e33ea/rpds_py-2026.6.3-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:23a439f31ccbeff1574e24889128821d1f7917470e830cf6544dced1c662262a", size = 576533, upload-time = "2026-06-30T07:17:28.546Z" }, { url = "https://files.pythonhosted.org/packages/ba/76/65002b08596c389105720a8c0d22298b8dc25a4baf89b2ce431343c8b1de/rpds_py-2026.6.3-cp315-cp315t-win32.whl", hash = "sha256:913ca42ccad3f8cc6e292b587ae8ae49c8c823e5dce51a736252fc7c7cdfa577", size = 201204, upload-time = "2026-06-30T07:17:30.193Z" }, { url = "https://files.pythonhosted.org/packages/8c/97/d855d6b3c322d1f27e26f5241c42016b56cf01377ea8ed348285f54652f0/rpds_py-2026.6.3-cp315-cp315t-win_amd64.whl", hash = "sha256:ae3d4fe8c0b9213624fdce7279d70e3b148b682ca20719ebd193a23ebfa47324", size = 220719, upload-time = "2026-06-30T07:17:31.788Z" }, - { url = "https://files.pythonhosted.org/packages/b4/9c/f0d19ac587fd0e4ab6b72cda355e9c5a6166b01ef7e064e437aef8eb9fef/rpds_py-2026.6.3-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:4cf2d36a2357e4d07bb5a4f98801265327b48256867816cfd2ceb001e9754a8f", size = 349791, upload-time = "2026-06-30T07:17:33.315Z" }, { url = "https://files.pythonhosted.org/packages/38/c7/1d49d204c9fd2ee6c537601dc4c1ba921e03363ca576bfab94a00254ac9a/rpds_py-2026.6.3-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:30c6dc199b24a5e3e81d50da0f00858c5bbdb2617a750395687f4339c5818171", size = 352842, upload-time = "2026-06-30T07:17:34.897Z" }, { url = "https://files.pythonhosted.org/packages/ac/e5/c0b5dc93cd0d4c06ce1f438907649514e2ea077bcd911e3154a51e96c38e/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9891e594296ab9dada6551c8e7b387b2721f27a67eecd528412e8906247a7b90", size = 382094, upload-time = "2026-06-30T07:17:36.514Z" }, { url = "https://files.pythonhosted.org/packages/0d/54/ec0e907b4ca8d541112db352409bd15f871c9b243e0c92c9b5a46ae96f01/rpds_py-2026.6.3-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b5c2dc92304aa48a4a60443b548bb12f12e119d4b72f314015e67b9e1be97fca", size = 388662, upload-time = "2026-06-30T07:17:38.235Z" }, @@ -4656,6 +4845,20 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d9/50/f00935da0ec7cbf325f8dc4f772ae46fbc7b672dd62876e73f0a94adda57/sqlparse-0.6.0-py3-none-any.whl", hash = "sha256:b861c0288ce2fa56209a9a6412d2e066ac664b3873b89c26c9d8415e8e32996f", size = 50070, upload-time = "2026-08-13T19:16:04.062Z" }, ] +[[package]] +name = "stack-data" +version = "0.6.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "asttokens" }, + { name = "executing" }, + { name = "pure-eval" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/28/e3/55dcc2cfbc3ca9c29519eb6884dd1415ecb53b0e934862d3559ddcb7e20b/stack_data-0.6.3.tar.gz", hash = "sha256:836a778de4fec4dcd1dcd89ed8abff8a221f58308462e1c4aa2a3cf30148f0b9", size = 44707, upload-time = "2023-09-30T13:58:05.479Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f1/7b/ce1eafaf1a76852e2ec9b22edecf1daa58175c090266e9f6c64afcd81d91/stack_data-0.6.3-py3-none-any.whl", hash = "sha256:d5558e0c25a4cb0853cddad3d77da9891a08cb85dd9f9f91b9f8cd66e511e695", size = 24521, upload-time = "2023-09-30T13:58:03.53Z" }, +] + [[package]] name = "starlette" version = "1.4.1" @@ -4969,18 +5172,18 @@ wheels = [ [[package]] name = "warp-lang" -version = "1.16.0" -source = { registry = "https://pypi.org/simple" } +version = "1.18.0" +source = { registry = "https://pypi.nvidia.com/" } dependencies = [ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" }, { name = "numpy", version = "2.5.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/73/8a/8be711f3b5431a6e0bdb97117d681b03cf2bb95d6fcf8869861900898d88/warp_lang-1.16.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:19a7590c4484e8250ab19165311d2a1774138663b361c41e8be2865c7515c4ae", size = 25221601, upload-time = "2026-08-03T02:26:38.389Z" }, - { url = "https://files.pythonhosted.org/packages/1d/3d/47feef2eee4739437e19d6949ea231ca4181c9eacbaa39144761e6130d94/warp_lang-1.16.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:96449fc1e3b354185e2f09434fb794b5953ab2e8673b104d7e7f48d5d418bb35", size = 163074225, upload-time = "2026-08-03T02:27:03.632Z" }, - { url = "https://files.pythonhosted.org/packages/db/96/0c2b070b3101c669955cafd36262548b2e8b00dfdeda3aeb7afbc0f9d65c/warp_lang-1.16.0-py3-none-manylinux_2_34_aarch64.whl", hash = "sha256:d4715171bd6821436b82293d774c9a082ace08215c189572b4348d1e48fb8ee8", size = 167563789, upload-time = "2026-08-03T02:27:37.512Z" }, - { url = "https://files.pythonhosted.org/packages/7e/17/c98fab81156f0d25f17200f52f69210b94a9abba101066736df8cc493522/warp_lang-1.16.0-py3-none-win_amd64.whl", hash = "sha256:8690c9096e0a271985339d4aa4b37675e7d62852620ca861ac032dc85b124542", size = 146387135, upload-time = "2026-08-03T02:28:17.956Z" }, + { url = "https://pypi.nvidia.com/warp-lang/warp_lang-1.18.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:3d0a12f411555c08015f84060187a0466800d2c837eb8800977b9604be438c21" }, + { url = "https://pypi.nvidia.com/warp-lang/warp_lang-1.18.0-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:090962bfae7dd22ade0d8e0258f41635e0e58980f15bcc9e7a7d312819dfe440" }, + { url = "https://pypi.nvidia.com/warp-lang/warp_lang-1.18.0-py3-none-manylinux_2_34_aarch64.whl", hash = "sha256:d76ab8c7d4f4897405fa0a744d38812fc44cfc8162c40e658dc9ca7790b6a645" }, + { url = "https://pypi.nvidia.com/warp-lang/warp_lang-1.18.0-py3-none-win_amd64.whl", hash = "sha256:1769e55746739f2e244a2b412123003c462ec3d977dfb5f420f924a8553d30aa" }, ] [[package]] @@ -4992,6 +5195,291 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/96/42/3e5985a0a7e57de470b320c6d6a1a67c844f6737a587f3d44dd13d1819e7/wcwidth-0.8.2-py3-none-any.whl", hash = "sha256:d63947694a0539a1d51e01eda7caf800c291020e6cdd7e28ad7b14dd33ad4f85", size = 323166, upload-time = "2026-06-29T18:11:09.888Z" }, ] +[[package]] +name = "websockets" +version = "16.1.1" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version < '3.11'", +] +sdist = { url = "https://files.pythonhosted.org/packages/21/f7/bc3a25c5ec26ce62ce487690becc2f3710bbc7b33338f005ad390db0b986/websockets-16.1.1.tar.gz", hash = "sha256:db234eda965dcce15df96bb9709f587cd87d4d52aaf0e80e2f34ec04c7670c57", size = 182204, upload-time = "2026-07-17T22:51:05.858Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/08/e7/d1671fb984f9dd844e1da5288070c7c23c9eaba3082d3871aae19c3ab8b9/websockets-16.1.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:49ae99bdfcae803a885c926bf14f886196e84925395bb3f568fef5c0f0979d7d", size = 179570, upload-time = "2026-07-17T22:48:24.032Z" }, + { url = "https://files.pythonhosted.org/packages/99/f5/70df723bf571f5e0b1b845e0a4ff1c966eeb84f667599fc251caa37d15a3/websockets-16.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:5bfd1ac19b1b9986a9c95a82d5e23a391ebb09e12c34d7be6094b86efcc35731", size = 177252, upload-time = "2026-07-17T22:48:25.775Z" }, + { url = "https://files.pythonhosted.org/packages/90/72/2f14b2e167170b8bf1c8bb7f9b0d78000f470d41a2085a91f33e3917b6c9/websockets-16.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9246a0d063cfcbcc85f2359dd6876d681213f4790832272aa16641b4ed5d64d4", size = 177530, upload-time = "2026-07-17T22:48:27.337Z" }, + { url = "https://files.pythonhosted.org/packages/f3/18/a17e2f0cde02dc10154c808deed7e1d8528afff93612f70d3f0a5b19b011/websockets-16.1.1-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1214e673c404684b9bf7154f5cf43b45025b1a6160fac3a9e438e9c1a97e22cb", size = 186038, upload-time = "2026-07-17T22:48:28.756Z" }, + { url = "https://files.pythonhosted.org/packages/d5/b0/41de283899cf5929d637b72a508cdbc9aa40dc0f317c6b77613fd1000488/websockets-16.1.1-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:90001d893bc368e302ef168d82130b4e4fdd27b85fa094682df9b667c2d48838", size = 187278, upload-time = "2026-07-17T22:48:30.328Z" }, + { url = "https://files.pythonhosted.org/packages/50/61/874aab5257e027f9f61b5004cec65e592babca7942b1bc09f38e72b7f1fd/websockets-16.1.1-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:130937b167a52af203c8d58e78d67705874e82759862e3b9671a452fec4abc87", size = 189936, upload-time = "2026-07-17T22:48:31.896Z" }, + { url = "https://files.pythonhosted.org/packages/a6/1a/42173913ac5519607220849ed417c864d77384e4119f06dbba964a50f096/websockets-16.1.1-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9c9f23004a3d40e89c01a7955d186a6cc83418d93b749701944ce2de3e95a1f3", size = 187796, upload-time = "2026-07-17T22:48:33.344Z" }, + { url = "https://files.pythonhosted.org/packages/1b/f4/37c1840bd89b529479aec41470b97b7c683b107ca90b6399ac5afb99dedf/websockets-16.1.1-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f55f0b01956a094c8587146d9558c91937e78789c333860ffaf35931a6e5dbc4", size = 186481, upload-time = "2026-07-17T22:48:34.843Z" }, + { url = "https://files.pythonhosted.org/packages/9e/70/652d9b964adcfbeb056f42e0ca6bece34d108fe75534e74df20643cae199/websockets-16.1.1-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6aaface73b9c71974c6497366d8b9628357f6c9749e09c4ea3610176c63f2ae3", size = 184351, upload-time = "2026-07-17T22:48:36.307Z" }, + { url = "https://files.pythonhosted.org/packages/13/f1/af3850e5d48d482921985be72ebcb169c6180b3a77b57bd612deebcee23b/websockets-16.1.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:dc0fad4933f427acd5b1cec210f3ea6dce7089e1724e4b9ec6ef47c6c04d1b3b", size = 186791, upload-time = "2026-07-17T22:48:37.762Z" }, + { url = "https://files.pythonhosted.org/packages/1d/40/1a4e3ed4969ec378dcad337e5f1472c5e292cb3e733bc392f0dc2e230abd/websockets-16.1.1-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:f2769a0344a09e9ccf5b3cce538bc75a51b53eff3275d3896310c8552049195d", size = 185413, upload-time = "2026-07-17T22:48:39.127Z" }, + { url = "https://files.pythonhosted.org/packages/aa/3e/4e3fa1afe8f1a6a780434cd9ba8eb422632b044eff3dd73f6af67523c147/websockets-16.1.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:f70541f3104339f59f830522d94ebadb1bf47426287381623443d8bb1cdbf33d", size = 187178, upload-time = "2026-07-17T22:48:40.676Z" }, + { url = "https://files.pythonhosted.org/packages/71/ab/dd742766aa5dda7f349be0de49e4d565b84cf6f7f7fa02e07692f0f2bdd9/websockets-16.1.1-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:dc385593a42e31cd6fb60c19f0ecb015b386603818fc2c6c274fb42bd2bb4165", size = 185051, upload-time = "2026-07-17T22:48:42.098Z" }, + { url = "https://files.pythonhosted.org/packages/ae/f5/76438c6560f416f1c0a7f587679fb97cc6e99ed336011d43ce2002dd27c1/websockets-16.1.1-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:387e8e4aa5df2f90b198fa3cad3478822a89cf905b6a6d6c97dc3664689640cc", size = 185846, upload-time = "2026-07-17T22:48:43.472Z" }, + { url = "https://files.pythonhosted.org/packages/62/12/5c0320f2127823d27b2d56d611d31b0b284ad4edcb41364d66bf4c92b537/websockets-16.1.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:fd46fff7eb62c24804d234f0051c7a8ea81285ad63e0337d3dcf33ca82aee58a", size = 186066, upload-time = "2026-07-17T22:48:44.884Z" }, + { url = "https://files.pythonhosted.org/packages/a2/97/875986b857b955c3f9dd192cb8a1af81254dfb2ea22cc9590f0a1e020b8b/websockets-16.1.1-cp310-cp310-win32.whl", hash = "sha256:7883388947767080f094950b342b30d35a2a06b849cd967c422fa0db72b40ea9", size = 179940, upload-time = "2026-07-17T22:48:46.481Z" }, + { url = "https://files.pythonhosted.org/packages/54/82/1013a5fe7ddae8e102bc3b4b39db81d8d28fd02100a324ce6ede8cd832b1/websockets-16.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:d57685547e0060cc6fd90ee6a28405d6bd395e525545f13c8d7cd99c78afd79f", size = 180239, upload-time = "2026-07-17T22:48:48.043Z" }, + { url = "https://files.pythonhosted.org/packages/2b/03/47debfe28e9d6d354be5d777b67fd44c359b9eb299a5d103500bd7cc3e37/websockets-16.1.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d0fcf657e9f13ff4b177960ab2200237b12994232dfb6df16f1cfe1d4339f93c", size = 179566, upload-time = "2026-07-17T22:48:49.596Z" }, + { url = "https://files.pythonhosted.org/packages/72/93/31efa1ed78c17e5cfc229fd449e3966e1b9cc15753204cd585cc8dd01f4a/websockets-16.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b852788aa51764e2d8e4cf5493d559326bcae5e38d16ba25ffa322b034df272a", size = 177250, upload-time = "2026-07-17T22:48:50.942Z" }, + { url = "https://files.pythonhosted.org/packages/01/4a/542378ab3972b0c1cf1df3df3eff9591cea0d30c58c3aa3c4ddbc244e787/websockets-16.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1427fb4cf0d72f66333e2cacc3ff5f575bf2d7008166ce991a4a470b21d51a22", size = 177528, upload-time = "2026-07-17T22:48:52.59Z" }, + { url = "https://files.pythonhosted.org/packages/33/d9/162321f63c7eed558e9e1798ed7a1e34a4f6dab51f35419e4ed7a4907979/websockets-16.1.1-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:da4ca1a9d72f9030b3146b8d7022719a9f3d478f61efe6f7dd51d243f61c51b2", size = 186859, upload-time = "2026-07-17T22:48:53.915Z" }, + { url = "https://files.pythonhosted.org/packages/de/09/87df740f7430ce564bd52402e9c9458d4d0459cc7d2ee29e530c8204851b/websockets-16.1.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:86d7f0f8bdb25d2c632b72527325e4776430fd5bc61b9118de4e2b8ddb5f5b01", size = 188095, upload-time = "2026-07-17T22:48:55.384Z" }, + { url = "https://files.pythonhosted.org/packages/d2/12/3d2703af7cc095f3c81904c92208cc1ae79affbc67376944b50ee9301f73/websockets-16.1.1-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7dfcad78ea1492ee3a9ec765cb7f51bbc17d477107aaf6b22abf7b2558d1c5a0", size = 191385, upload-time = "2026-07-17T22:48:56.742Z" }, + { url = "https://files.pythonhosted.org/packages/1d/69/986aa0234a964a00f5149cfc46e136e96c8faad1c783474550f40d31aef4/websockets-16.1.1-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:fb9a0a6dc3d1b3986cb88091b6899f0396651e0f74e2c9766ab8d6ffc3842e29", size = 188653, upload-time = "2026-07-17T22:48:58.134Z" }, + { url = "https://files.pythonhosted.org/packages/35/6b/10f9d03e3970a69ba67bd3b46b87a929b586d0300fadbfe14f57c1f85490/websockets-16.1.1-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:29dfa8114c4a620c69591c5973860f768eac29d3fd6904f37f34266cb219c512", size = 187426, upload-time = "2026-07-17T22:48:59.515Z" }, + { url = "https://files.pythonhosted.org/packages/56/db/bb3aad62bf63d8bb3f0634b2eabffcfb3677a34bd19492110ff6869cf703/websockets-16.1.1-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:6ff9417c0ada4d0f7d212f928303e5579bdf3ace4c802fa4afabb30995da58c3", size = 184882, upload-time = "2026-07-17T22:49:00.916Z" }, + { url = "https://files.pythonhosted.org/packages/6c/4c/c09a2ea9bfbeccce52fdc383e5f28af4bc8843338aabac28c81489af6120/websockets-16.1.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8fe0b50da2d84535fb4f7b4bfa951280f97ce3d558a0443b541166d609e67b57", size = 187584, upload-time = "2026-07-17T22:49:02.283Z" }, + { url = "https://files.pythonhosted.org/packages/c7/8b/31bb4eb4d9eaacf1fdd39d115772a8aeaedfc19b5dc262e57ffbc8a9d42c/websockets-16.1.1-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:34420aaa64440ebd51ac72ca8a45ef4626429438c9b02e633ae412ed43f925d3", size = 186174, upload-time = "2026-07-17T22:49:03.973Z" }, + { url = "https://files.pythonhosted.org/packages/2f/e4/dc02d725610a1ad49e193ef91a548194d71bdc6cdf27da83067dd1f73995/websockets-16.1.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:a6a61aff018180c9c50b7b0da33bfd29d378af3497429c95006c589a23a11648", size = 187986, upload-time = "2026-07-17T22:49:05.553Z" }, + { url = "https://files.pythonhosted.org/packages/e0/73/30ed84c8bfd14c73d4af29d5ed9323c3073b48e0b7b23b67070f4e7fd59b/websockets-16.1.1-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:04fd29a0e2fe9414a95b00e92c67ae51bf900c50c0f8a4b2dafdad621f49ea1d", size = 185565, upload-time = "2026-07-17T22:49:06.959Z" }, + { url = "https://files.pythonhosted.org/packages/7d/d3/4be8d4959f51e31b4f8fc0ece12b45bd3b6c0d15ea23b9990d9c11fc805f/websockets-16.1.1-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:5c31aa7e39ee3e8a358573257f1c0bb5c52430d1b637030dd9c8cc2c282926be", size = 186598, upload-time = "2026-07-17T22:49:08.293Z" }, + { url = "https://files.pythonhosted.org/packages/26/fa/abb38597a52d84ed9cfacadc7a0c6f2db282c0ab23cdf72b58a666a21227/websockets-16.1.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:d14bfb217eb4701e850f1525c9d29d79c44794cdf1c299ead25f39f8c78dea81", size = 186834, upload-time = "2026-07-17T22:49:09.766Z" }, + { url = "https://files.pythonhosted.org/packages/59/80/1119ad08a228b90c4eb77fbe48df7836731a605f5f881ba701ca826a4a65/websockets-16.1.1-cp311-cp311-win32.whl", hash = "sha256:2e28e602bb13da44fbe518c1781a88e3b9d4c3d48d02c9bad83e546164336f57", size = 179940, upload-time = "2026-07-17T22:49:11.196Z" }, + { url = "https://files.pythonhosted.org/packages/71/b2/e511c1c6f64a95c2f3fc54bffda0e14eaa7e9442be605c29270f7589b918/websockets-16.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:7421fad442de870a8cbf2287d1cad7e706ece0dbfeba5e911df132cbdc1cb56a", size = 180239, upload-time = "2026-07-17T22:49:12.519Z" }, + { url = "https://files.pythonhosted.org/packages/17/9d/681cda21c9eee743203a6cb79b9d3d05adad9aa60ec660c6c9bf4dd619ca/websockets-16.1.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:cc97814dfb786a83b6e2dc2e79351e1b83e6d715647d6887fcabd83026417a00", size = 179600, upload-time = "2026-07-17T22:49:13.92Z" }, + { url = "https://files.pythonhosted.org/packages/fb/8d/6195a88b45e8d2a8f745fc2046e36f885a3c9763e6767d2c46229bf9510c/websockets-16.1.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e047dc87ef7ca50f4d309bf775ad4a71711c58556d75d7bd0604b2317f43e94b", size = 177272, upload-time = "2026-07-17T22:49:15.453Z" }, + { url = "https://files.pythonhosted.org/packages/73/e3/fe2d498c64dea0095c9a9f9a351af4cd6eef31b618395582bc1f38ba45ff/websockets-16.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:01fbdcbac298efe19360b94bc0039c8f746f0220ba570f327577bfee81059175", size = 177542, upload-time = "2026-07-17T22:49:16.875Z" }, + { url = "https://files.pythonhosted.org/packages/fe/ed/f1831681fce0e3242346e5458486003c5f124ed69e5e0b847fd029db4973/websockets-16.1.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:0f62863e8a00a6d33c3d6566ec0b89f23787b747ffe0c3bc71ec0e76b82c94b1", size = 187137, upload-time = "2026-07-17T22:49:18.323Z" }, + { url = "https://files.pythonhosted.org/packages/6f/79/4ff9dcc1bb46f6b4c536936dde1fd60f9b564f3304307274db97f4c9496d/websockets-16.1.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8087e82f842609734c9b5a1330464f8e94e346ba0e18c832c08bafa4b0d63c15", size = 188374, upload-time = "2026-07-17T22:49:19.65Z" }, + { url = "https://files.pythonhosted.org/packages/62/c3/5c49b6efb36cab733d23773f6de575e1dba65736ead17d5d2b2a1daef779/websockets-16.1.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2bb5d041a8307d2e18782e7ce777f6fdb1e8c2f5d09291484b18c294b789d9aa", size = 191155, upload-time = "2026-07-17T22:49:21.331Z" }, + { url = "https://files.pythonhosted.org/packages/6e/f6/56ccceda3a4838d18f1d40821480da4775397e8b1eecf4031e20c50e2e90/websockets-16.1.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1db4de4a0e95673f7545d393c49eeb0c2f18ac1ef93073218c79d5cdb2ee75ab", size = 189011, upload-time = "2026-07-17T22:49:22.889Z" }, + { url = "https://files.pythonhosted.org/packages/86/d6/ad5286241a2bce1107e2798d3bfbd62cf79aee167bdb654f8cb1e9dbf949/websockets-16.1.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f17dbe07eb3ea7f99e4df9b7e0efefe80fbf30d37a8cc4d561a0aed310bc8847", size = 187766, upload-time = "2026-07-17T22:49:24.339Z" }, + { url = "https://files.pythonhosted.org/packages/bc/67/d65c970b7e347fdca69479beb7811c2060529956730a7a4e3ae7c66b0e31/websockets-16.1.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4b57693728576d84ede0a77987ab16881b783d2cd9f1dc180a8fbbc3f79c4428", size = 185173, upload-time = "2026-07-17T22:49:25.743Z" }, + { url = "https://files.pythonhosted.org/packages/1d/5b/14af3cd4ee69d8ea9baca58f3dc3cfb1ba78332a347fd478cb096549d60e/websockets-16.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2a636ff1e7a5c4edf71ef0e79adae7f25dba93b4fcbe3dc958733477ffeb0eaf", size = 187809, upload-time = "2026-07-17T22:49:27.147Z" }, + { url = "https://files.pythonhosted.org/packages/7b/11/be301710d70de97e3e7b3586e6d492c9c06d6a61bf1c2202c36cf0c75607/websockets-16.1.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:d6bec75c290fe484a8ba4cacdf838501e17c06ecfbbf31eede81a9e431bd7751", size = 186412, upload-time = "2026-07-17T22:49:28.611Z" }, + { url = "https://files.pythonhosted.org/packages/db/07/fe1435bf6fe738a3d3b54dbe0c18dabf12cba4d909ac8b58b539ce27c1f4/websockets-16.1.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:54509b8e92fee4453e152b7558ddef37ce9705a044922f2095a6105e3f80c96f", size = 188290, upload-time = "2026-07-17T22:49:29.965Z" }, + { url = "https://files.pythonhosted.org/packages/8a/0a/81f394aff8efcbb01208c1ced77df0a3c7fcce584a88c7273663697946c2/websockets-16.1.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:f0aa4aad3b1b69ad3fd85a0fd0952ec64331c762bd77ec51cc814170873890b2", size = 185844, upload-time = "2026-07-17T22:49:31.447Z" }, + { url = "https://files.pythonhosted.org/packages/39/5c/dd485b995473f415510251fe9bd708f2d24458f439fce958daf8d66dc7c6/websockets-16.1.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:42290eb6db4ccaca7012656738214f8514082fb6fa40cdeb61bb9a471b52e383", size = 186823, upload-time = "2026-07-17T22:49:33.104Z" }, + { url = "https://files.pythonhosted.org/packages/9d/0b/f78de76ff446f1e66af12b43c48a35f31744de93cfdec2f4ea67d5d7bbf1/websockets-16.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:53260c8930da5771cec89439bff99c20c8cb03ddb9588b980697355a83cd4bd3", size = 187102, upload-time = "2026-07-17T22:49:34.616Z" }, + { url = "https://files.pythonhosted.org/packages/37/a1/4cf892007778eaf84ad162bfc98046e0ed89b63ac55949e3236626b2a23f/websockets-16.1.1-cp312-cp312-win32.whl", hash = "sha256:1d27fa8462ad6a1cb36206a3d0640b2333340def181fae11ed7f9adeaa5c0747", size = 179943, upload-time = "2026-07-17T22:49:36.213Z" }, + { url = "https://files.pythonhosted.org/packages/d9/de/6abe251d28c3a3f217096575400b27750b18e0b1d2fff3a2a239960fea07/websockets-16.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:b436f6ec4fc3a6b4237c84d3f83170ed2b40bb584222f0ac47a0c8a5921980c7", size = 180243, upload-time = "2026-07-17T22:49:37.626Z" }, + { url = "https://files.pythonhosted.org/packages/ce/fd/6ec6c6d2850aea25b1b2aa9901a016980bb87d01e89b3eb00470b1b5d471/websockets-16.1.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ab59169ace05dcb49a1d4118f0bde139557adf45091bd85747e36bf5de984dd1", size = 179587, upload-time = "2026-07-17T22:49:38.959Z" }, + { url = "https://files.pythonhosted.org/packages/5f/d8/1d299d2dd34087db39831a34cc645ef8a6f89d78efada6983093513cd81c/websockets-16.1.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5e3b7d601f6f84156b08cc4a5e541c2b50ad7b36cfc302b657a12477c904a5df", size = 177272, upload-time = "2026-07-17T22:49:40.293Z" }, + { url = "https://files.pythonhosted.org/packages/3d/86/0a70d3ae2f0f2256bb41302d9804dbca65d4360281e7feb3e1f94102ac46/websockets-16.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:cd2ca96a082a36964aca83e992f72abeb61b7306c1a6cba4c7d06a7b93750cac", size = 177530, upload-time = "2026-07-17T22:49:41.786Z" }, + { url = "https://files.pythonhosted.org/packages/b5/c2/c676c69444d9db448b3f0a55a98dcc534affce0bce961d9d2f0b8499b10a/websockets-16.1.1-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f5d497865f05bb222cab7016c6034542e84e5f29f49c6fd3f4939cda7197b5b8", size = 187197, upload-time = "2026-07-17T22:49:43.658Z" }, + { url = "https://files.pythonhosted.org/packages/0b/13/88137fbaf726ebe29d62c1117fa11fa2bbb6209dc79d4ad738efbe36a2aa/websockets-16.1.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bae954c382e013d5ea5b190d2830526bfa45ad121c326da0049b8c769f185db6", size = 188433, upload-time = "2026-07-17T22:49:45.147Z" }, + { url = "https://files.pythonhosted.org/packages/01/6d/46c2f2ce6751cb26f39293e1ecbf8544cb01321397cd476c2756b98c216d/websockets-16.1.1-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:e09f753a169951eb4f28c2c774f71069304f66e7277e0f5a2892423599cfa854", size = 189868, upload-time = "2026-07-17T22:49:46.581Z" }, + { url = "https://files.pythonhosted.org/packages/29/2b/170a9e8097636cfde4dc3c592b6e00b18a44a2f5407606d96ca542dd5838/websockets-16.1.1-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:024193f8551a2b0eafbdd160911012c4e6c228c28430c84433253299a9e42d6a", size = 189059, upload-time = "2026-07-17T22:49:47.972Z" }, + { url = "https://files.pythonhosted.org/packages/a7/48/f0d4ebc9ab4b473b8861b9e20fdb663d515d42f7befdf62cdb60fee7a1ec/websockets-16.1.1-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:aabe464bfd13bd25f4821faf111da6fefdc389f870265a53105580e45b0a2e49", size = 187814, upload-time = "2026-07-17T22:49:49.344Z" }, + { url = "https://files.pythonhosted.org/packages/d5/ba/39a41d3ae8e72696a9492581900611c5a91e2b07563b0bcd2523adea9854/websockets-16.1.1-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a28fcbc9b6baf54a2e23f8655f308e4ccc6afdd7266f8fe7954f320dcda0f785", size = 185229, upload-time = "2026-07-17T22:49:50.787Z" }, + { url = "https://files.pythonhosted.org/packages/3c/36/ac15b604f850d1907f0a85ed721cefe47cd45034b3620069b829746cccbe/websockets-16.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:79eace538c6a97e96d0d03d4f9d314f9677f5ed85a8a984992ffd90b13cb8a56", size = 187874, upload-time = "2026-07-17T22:49:52.228Z" }, + { url = "https://files.pythonhosted.org/packages/a8/f3/3fbd5d71d59299c3770faa5884d4f45070236ca5a35ab3a61830812c409a/websockets-16.1.1-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:496af849a472b531f758dbd4d61338f5000538cb1a7b3d20d9d32a264517f509", size = 186469, upload-time = "2026-07-17T22:49:53.776Z" }, + { url = "https://files.pythonhosted.org/packages/b4/fc/dd90349bba58af2a53ef2ddd9c32716c81eb6d59a0687939fff561860878/websockets-16.1.1-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:5283810d2646741a0d8da2aa733d6aefa0545809afccb2a5d105a26bc45125f1", size = 188347, upload-time = "2026-07-17T22:49:55.202Z" }, + { url = "https://files.pythonhosted.org/packages/4c/f3/f73ba86427682da59b78c11d77ba56d5b801c32e84afe79b274bbd6a9bb2/websockets-16.1.1-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:4e3b680b1e0a27457e727a0d572fd81dffa87b6dbf8b228ab57da64f7d85aead", size = 185903, upload-time = "2026-07-17T22:49:56.75Z" }, + { url = "https://files.pythonhosted.org/packages/34/7c/f95eb20e80104173b3a0a092291f89ea4047ef6e608e0a57ca06eb14eecb/websockets-16.1.1-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:69159730a823dde3ea8d08783e8d47ef135a6d7e8d44eb127e32b321c9db8e3e", size = 186855, upload-time = "2026-07-17T22:49:58.467Z" }, + { url = "https://files.pythonhosted.org/packages/b0/35/dd875b3e050ff232d60fa377707f890e369f74d134f1be32e8f68879747c/websockets-16.1.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ed5bb271084b46530ee2ddc0410537a9961152c5ccba2fc98c5276d992ccba87", size = 187140, upload-time = "2026-07-17T22:50:00.016Z" }, + { url = "https://files.pythonhosted.org/packages/e8/dc/5cbfcb41824502f6af93b8f3943a4d06c67c23c7d2e31eb18748c4a5b2a7/websockets-16.1.1-cp313-cp313-win32.whl", hash = "sha256:cfb70b4eb56cac4da0a83588f3ad50d46beb0690391082f3d4e2d488c70b68ea", size = 179928, upload-time = "2026-07-17T22:50:01.685Z" }, + { url = "https://files.pythonhosted.org/packages/b0/c1/71e5deb5b7f8f226997ab64908c184ac3105c0155ce2d486f318e5dd08a8/websockets-16.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:d9531d9cbeac99af6f038fb1bc351403531f7d634a2c2e10e2f7c854c6ed5b68", size = 180242, upload-time = "2026-07-17T22:50:03.117Z" }, + { url = "https://files.pythonhosted.org/packages/73/a2/ba78a164eeea4620df4a4df4bd2ed6017438c4655cc0f36f2c0bc0432355/websockets-16.1.1-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:443aefe96b7fdb132e2a70806cca1f2af49bb3f28e47abcd7c2e9dcf4d8fa1b8", size = 179635, upload-time = "2026-07-17T22:50:05.001Z" }, + { url = "https://files.pythonhosted.org/packages/b9/08/d26d7a7628cd4ac34cbbdb63ac80914ca842ed8e42938c40a53567806df3/websockets-16.1.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:6456ff333092d509127d75a638cb411afae8ff17f092635015d1902efec8a293", size = 177320, upload-time = "2026-07-17T22:50:06.427Z" }, + { url = "https://files.pythonhosted.org/packages/0f/45/ebec83e6269536aa5932533c67b0af5c781f3e73fdbcd68672dcf43f4f44/websockets-16.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:fce6c48559c86d1ac3632ccb1bebc7d5442fbe79bd9bb0e40379ee54be2a4051", size = 177544, upload-time = "2026-07-17T22:50:07.834Z" }, + { url = "https://files.pythonhosted.org/packages/c9/d5/abc614d2297f6c1c3e01e61260364457a47c25cc1cf6a879038902bc6aa8/websockets-16.1.1-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:92b820d345f7a3fc7b8163949ee92df910f290c3fc517b3d5301c78065adafe1", size = 187270, upload-time = "2026-07-17T22:50:09.275Z" }, + { url = "https://files.pythonhosted.org/packages/52/71/4c99af3b87dff1b2927981f6876607d4acb45338c665242168d3982f7758/websockets-16.1.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2a606d9c24035242a3e256e9d5b77ed9cd6bccfcb7cf993e5ca3c0f6f68fb6a7", size = 188509, upload-time = "2026-07-17T22:50:10.722Z" }, + { url = "https://files.pythonhosted.org/packages/9b/b4/5c8ca14b0df7eb84ed0524165c5359150210140817a3312aee57bf62a1cf/websockets-16.1.1-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:414e596c75f74e0994084694189d7dc9229fb278e33064d6784b73ffbba3ca31", size = 189882, upload-time = "2026-07-17T22:50:12.293Z" }, + { url = "https://files.pythonhosted.org/packages/25/c1/bedfba9e70557129cb8083748d167bdcc01483dedf0f0df143676df05cbe/websockets-16.1.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:536676848fc5961aca9d20389951f59169508f765637a172403dc5434d722fa0", size = 189114, upload-time = "2026-07-17T22:50:13.789Z" }, + { url = "https://files.pythonhosted.org/packages/df/09/aa835b2787835aebd839114be5de51b797cb480b63ba42b26d34dfe147cb/websockets-16.1.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:97fd3a0e8b53efa41970ac1dff3d8cf0d2884cadeb4caaf95db7ad1526926ee3", size = 187861, upload-time = "2026-07-17T22:50:15.179Z" }, + { url = "https://files.pythonhosted.org/packages/20/26/f6408330694dbc9830857d9d23bc14ac4f6875127a480cfdda8d5ca21198/websockets-16.1.1-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:7b1b19636af86a3c7995d4d028dbe376f39b4bf31541146f9c123582a6c94562", size = 185286, upload-time = "2026-07-17T22:50:16.741Z" }, + { url = "https://files.pythonhosted.org/packages/17/9a/e0675e70dd8a80762cf35bb18799d3f290a4890ffe6439bc51d222796083/websockets-16.1.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:41c8e77f17294c0ac18008a7309b99b34ee72247ef10b6dff4c3f8b5ac29896b", size = 187935, upload-time = "2026-07-17T22:50:18.213Z" }, + { url = "https://files.pythonhosted.org/packages/33/c1/3234cfb86afde01b81e9bddcc6e534c440975d60a13991259e833069ab3e/websockets-16.1.1-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:9f63bcef7f4b02b06b35fc01c93b96c43b5e88e1e8868676caacf493d5a31f3a", size = 186444, upload-time = "2026-07-17T22:50:19.67Z" }, + { url = "https://files.pythonhosted.org/packages/89/87/9c15206e1d778923d8daa9657de07aa62ea815e13448319c98458c37b281/websockets-16.1.1-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:dab9eb87869da2d6ed3af3f3adf28414baae6ec9d4df355ffc18889132f3436c", size = 188409, upload-time = "2026-07-17T22:50:21.28Z" }, + { url = "https://files.pythonhosted.org/packages/f2/00/cf5de5c67676de2d3eef8b2a518f168f6796595447a5b7161ba0d012915c/websockets-16.1.1-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:43e3a9fdd7cbf7ba6040c31fae0faf84ca1474fef777c4e37912f1540f854499", size = 185958, upload-time = "2026-07-17T22:50:22.719Z" }, + { url = "https://files.pythonhosted.org/packages/62/c0/731b6ddede2e4136912ec4cff2cffbda35af73546be4762c3d7bd3bd79af/websockets-16.1.1-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:056ae37939ed7e9974f364f5864e76e49182622d8f9751ac1903c0d09b013985", size = 186911, upload-time = "2026-07-17T22:50:24.108Z" }, + { url = "https://files.pythonhosted.org/packages/8c/7f/39c634472c4469a24a7c09cecddffb08fac6d0e74f73881a94ee8a40a196/websockets-16.1.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a0eadbbf2c30f01efa58e1f110eb6fa293261f6b0b1aa38f7f48707107690af9", size = 187204, upload-time = "2026-07-17T22:50:25.548Z" }, + { url = "https://files.pythonhosted.org/packages/26/89/9667c256c256dafcc62d21328ce7a40067da857969b68ee9af375b0aaf72/websockets-16.1.1-cp314-cp314-win32.whl", hash = "sha256:195c978b065fa40910582464f99d6b15c8b314c68e0546549a55ed83f4735328", size = 179603, upload-time = "2026-07-17T22:50:27.086Z" }, + { url = "https://files.pythonhosted.org/packages/bd/dd/1c099d6c0fc5deb6b46ccdbb6981fdb4b12c917869cb3952408409dc18db/websockets-16.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:4e8d01cc3bcae7bbf8167f944aeafefed590fae5693552bba9794a9df68371cc", size = 179948, upload-time = "2026-07-17T22:50:28.521Z" }, + { url = "https://files.pythonhosted.org/packages/35/25/9956b2d5e0529d5d23924f21bba1440d4c5c88a562e4f08550871ffa97a7/websockets-16.1.1-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:0ffd3031ea8bda8d61762e84220186105ba3b748b3c8da2ae4f7816fac03e573", size = 179963, upload-time = "2026-07-17T22:50:29.982Z" }, + { url = "https://files.pythonhosted.org/packages/17/06/55ffc976c488b6aee9ea05761ff7c4e88e7c1fd82818c8ca7b556ad2f90c/websockets-16.1.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:84a2cef8deffbd9ab8ee0ea546a2a6a7030c28f44e6cdd4547dbfeb489eb8999", size = 177497, upload-time = "2026-07-17T22:50:31.396Z" }, + { url = "https://files.pythonhosted.org/packages/0c/e8/f7dac2e980bacc92bdc26cebae4ae4d50cae5380732c50980598fc0bbae4/websockets-16.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3df13f73af9b3b38ab1195eb299ecb67a4330c911c97ae04043ff74085728abe", size = 177698, upload-time = "2026-07-17T22:50:32.829Z" }, + { url = "https://files.pythonhosted.org/packages/b2/39/26762f734113e22da2b942c3aca85798e0c0405d64c256549540ff31e5a1/websockets-16.1.1-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:23253dd5bcae3f9aaee0a1d30967a8dbd52e5d3cff93a2e5b84df57b77d4750d", size = 187561, upload-time = "2026-07-17T22:50:34.24Z" }, + { url = "https://files.pythonhosted.org/packages/11/94/c3f330851806b9b02138b774d593478323e73c99238681b4b93efe64e02d/websockets-16.1.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c1c5705e314449e3308872fe084b8571ce078ee4fc55a98a769bdefe5917392", size = 188732, upload-time = "2026-07-17T22:50:36.088Z" }, + { url = "https://files.pythonhosted.org/packages/d1/f2/eb2c450f052de334ae33cf200ece6e87b0e14d186807074e4eb1cd2cdea2/websockets-16.1.1-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:69e52d175a0a7d1e13b4b67ad41c560b7d98e8c6f6126eb0bda496c784faf8c7", size = 190872, upload-time = "2026-07-17T22:50:38.008Z" }, + { url = "https://files.pythonhosted.org/packages/70/31/2ac8cecf3a74f7fed9132129fc3d90b3998a1554570c11a69b2a8c20332d/websockets-16.1.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:1f79c89b5eb034d1722938a891916582f8f7f503f58ca22518a63c3f2cd18499", size = 189305, upload-time = "2026-07-17T22:50:39.53Z" }, + { url = "https://files.pythonhosted.org/packages/6a/cf/8ab19650d3c0d4562c92e70ab47c257c4aa5c6a713ed87fe63766b31fefc/websockets-16.1.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:39f2a024af5c345ffe8fcf1ee18c049c024c94df393bb09b044a6917c77bde43", size = 188033, upload-time = "2026-07-17T22:50:40.912Z" }, + { url = "https://files.pythonhosted.org/packages/66/d7/a49a38a6127a4acb134fb1912b215d900cc657605cff32445bf519f3acc4/websockets-16.1.1-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:952303a7318d4cbe1011400839bb2051c9f84fa0a35923267f5daba34b15d458", size = 185748, upload-time = "2026-07-17T22:50:42.559Z" }, + { url = "https://files.pythonhosted.org/packages/95/3e/ad1fa40388c7f2e0bb2c7930d0090b6c5498594bd1cdaec18864df3d9e97/websockets-16.1.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:249116b4a76063d930a46391ad56e135c286e4562a18309029fc2c73f4ed4c62", size = 188285, upload-time = "2026-07-17T22:50:43.974Z" }, + { url = "https://files.pythonhosted.org/packages/35/b8/d5db28ca264b9104f82196f92dc8843e35fd391f763d42e4ad358f5bc97e/websockets-16.1.1-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:61922544a0587a13fd3f53e4c0e5e606510c7b0d9d22c8444e5fae22a06b38cb", size = 186777, upload-time = "2026-07-17T22:50:45.474Z" }, + { url = "https://files.pythonhosted.org/packages/42/9c/726cb39d0cc43ae848dce4aa2acb04eecc6738b1264ec6d700bf6bcfb9f8/websockets-16.1.1-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:46dcaa042cd1de6c59e7d9269fa63ff7572b6df40510600b678f0826b3c7af51", size = 188682, upload-time = "2026-07-17T22:50:46.973Z" }, + { url = "https://files.pythonhosted.org/packages/be/c7/1168704de8c2dd483edabe4a22cbe4465dd8be8dd95561d214f9fe092871/websockets-16.1.1-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:38565aca3e01ea8734e578fb2118dade0ecb0250533f29e22b8d1a7a196cf4d0", size = 186377, upload-time = "2026-07-17T22:50:48.413Z" }, + { url = "https://files.pythonhosted.org/packages/ca/40/f9ff2d630ffce4e7dfea0b2288e1caf9ebbf9ff8a9ec9396136ce8b94935/websockets-16.1.1-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:42f599f4d48c7e1a3338fdaac3acd075be3b3cf02d4b274f3bf2767aedd3d217", size = 187148, upload-time = "2026-07-17T22:50:49.845Z" }, + { url = "https://files.pythonhosted.org/packages/b5/71/e177c8299f78d7cbe2d14df228643c10c70c0e86e108e092056bbcc16e46/websockets-16.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dcc04fedf83effaeb9cce98abc9469bb1b42ef85f03e01c8c1f4438ef7555737", size = 187578, upload-time = "2026-07-17T22:50:51.619Z" }, + { url = "https://files.pythonhosted.org/packages/49/b2/b6987faf330f5af5c787a2610124c2e8403d51724f9001ec4fff6311fe7a/websockets-16.1.1-cp314-cp314t-win32.whl", hash = "sha256:8483c2096363120eea8b07c06ae7304d520f686665fffd4811fad423930a65d7", size = 179729, upload-time = "2026-07-17T22:50:53.269Z" }, + { url = "https://files.pythonhosted.org/packages/a2/6e/fbac6ed878dd362fbad7d415fa4f84d38e3e33fed8cde45c64e783acf826/websockets-16.1.1-cp314-cp314t-win_amd64.whl", hash = "sha256:bcce07e23e5769375158f5efdcdafa8d5cd014b93c6683865b840ed65b96f231", size = 180072, upload-time = "2026-07-17T22:50:54.969Z" }, + { url = "https://files.pythonhosted.org/packages/e1/ed/71fea6e141590cafc40b14dc5943b0845606bee87bdb52a21b6a73eb4311/websockets-16.1.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:820fb8450edddae3812fd58cbc08e2bf22812cb248ecb5f06dbb82119a56e869", size = 177185, upload-time = "2026-07-17T22:50:56.665Z" }, + { url = "https://files.pythonhosted.org/packages/01/ec/00e7eeca200facf9266a83e4cbbf1bed0e67fba1d4d45031d3e5b3d81b5c/websockets-16.1.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:125f22dbefaf1554fea66fc83851490edb284ce4f501d37ffed2752f418332d9", size = 177459, upload-time = "2026-07-17T22:50:58.197Z" }, + { url = "https://files.pythonhosted.org/packages/75/fd/5774c4b33f7c0d8f0c51809c8b3a93456c48e3543579262cfa64eb5f522e/websockets-16.1.1-pp311-pypy311_pp73-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:30bbe120437b5648a77d3519b7024ea09530e0b5b18d3698c5a0ae536fe0cc2e", size = 178294, upload-time = "2026-07-17T22:50:59.641Z" }, + { url = "https://files.pythonhosted.org/packages/37/c3/48e2c03d2bd79bb45948841c592d24156312dd5f58cdf8f549febe652fb6/websockets-16.1.1-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b6b9dadbef0cccd9f4c4ee96b08898afa73e26803bbe0f6aeb5bb12b0074206d", size = 179190, upload-time = "2026-07-17T22:51:01.129Z" }, + { url = "https://files.pythonhosted.org/packages/2d/3f/73e511ecf2496ceac57dd4ed8388efe2bcf0769338a2dbf242c8366ae87e/websockets-16.1.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:56cd5fc4f10a9ea8aa0804bddb7b42506cf9e136046f3b4c27de8fec9e2ecba5", size = 180330, upload-time = "2026-07-17T22:51:02.603Z" }, + { url = "https://files.pythonhosted.org/packages/be/4d/2d0d67834092e354d2b0498f014a41249a89556bc406cf86f3e1557bb463/websockets-16.1.1-py3-none-any.whl", hash = "sha256:6abbd3e82c731c8e531714466acd5d87b5e88ac3243465337ba71d68e23ae7e3", size = 173814, upload-time = "2026-07-17T22:51:04.184Z" }, +] + +[[package]] +name = "websockets" +version = "17.3" +source = { registry = "https://pypi.org/simple" } +resolution-markers = [ + "python_full_version >= '3.14'", + "python_full_version >= '3.12' and python_full_version < '3.14'", + "python_full_version == '3.11.*'", +] +sdist = { url = "https://files.pythonhosted.org/packages/30/4b/4692be6d5bf739ed049b3813901c42091f8c054df89d5c089343823dea0d/websockets-17.3.tar.gz", hash = "sha256:1c7dd93a1c9f89297471493674b1fc1d9467cafd45374f2172213046bdb3a329", size = 188878, upload-time = "2026-10-19T16:58:05.813Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/b8/282f114a67886fccde02a77ff296501ad7fea25f4d696b2b1b337cbd27da/websockets-17.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:45cc1ccb12ced6d242335159e8221733c8696da5ad0b6ceef6debb0f5ce89110", size = 218223, upload-time = "2026-10-19T16:54:25.998Z" }, + { url = "https://files.pythonhosted.org/packages/8b/ba/8043c303aa60af053e092c1d667165f46d6729217ce2af795a23a3cd700a/websockets-17.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:46ae05aa1aecd47d4d7de0f05ce2d1d2eb418f8de614964d754cc3b9a409c400", size = 215908, upload-time = "2026-10-19T16:54:27.785Z" }, + { url = "https://files.pythonhosted.org/packages/21/3d/5d0eaa9b29db6c999a2cf749605141796cff21a5e235b2488bd39dcdcac9/websockets-17.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:43f270a5f21e12db08c73d83849a877c02ab7b7d0fb6e2718b5101d9c810212f", size = 216181, upload-time = "2026-10-19T16:54:29.267Z" }, + { url = "https://files.pythonhosted.org/packages/43/fb/33080a7b2d8427b343056eab32ba78235a4bfbbdc79b5593688c7b7c62ef/websockets-17.3-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:2d875224bac1a05a20acade268a7a0e3498e7f8cf890acb7c2b23bacd2bd3659", size = 225246, upload-time = "2026-10-19T16:54:30.807Z" }, + { url = "https://files.pythonhosted.org/packages/61/8c/d4220455cee00adb553c602ba4f1f6a47cd882d86dd9e5124679c0c95c75/websockets-17.3-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:5ad409b7ea102339041281117cf2dadfe71edbb653dc48037cc55d516fb7f448", size = 225517, upload-time = "2026-10-19T16:54:32.182Z" }, + { url = "https://files.pythonhosted.org/packages/75/a3/0ff8e4f0195884ae446844185e81bf7619673d816424b8a58bb5812dd4b8/websockets-17.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:56d43c311f3519fb1057b6114dc24e9060bc3fb6aedf4aa11160484154b66b63", size = 226751, upload-time = "2026-10-19T16:54:33.52Z" }, + { url = "https://files.pythonhosted.org/packages/06/cf/82c88e3fbb6a75a62b2997932664bccfe68256661c69144bd48020160cf1/websockets-17.3-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a9eacb382f400bb5865e7e6d24bbe709a84510291e707f169dd4a24ee4a5ac6a", size = 230063, upload-time = "2026-10-19T16:54:34.855Z" }, + { url = "https://files.pythonhosted.org/packages/4a/e4/9131d3b73504902a83d10b1e1244319377ca72755351998ac9c408ba6ddb/websockets-17.3-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f09f145b89ea292cf6c25fd7c8c0d90207fd6a9e54c7828499669996a1e5bdcc", size = 227310, upload-time = "2026-10-19T16:54:36.248Z" }, + { url = "https://files.pythonhosted.org/packages/ca/b2/2208506afb45d181b0d6ccf377d9d79985fbcbf871af02ef4f7f3d405f5b/websockets-17.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:49fb5b4960ebe1bc557b435da8687deef1302a08f030a33c5606fa6fb11b773b", size = 226087, upload-time = "2026-10-19T16:54:37.583Z" }, + { url = "https://files.pythonhosted.org/packages/39/53/da73e3809f1d4e8c3346ca89a4bed7995de5708f2cb14c9359172a85f5a5/websockets-17.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:13cffaedde6e06183860fc92d88fe1d190abda73837fe4c14f5d4803c472f5dd", size = 223360, upload-time = "2026-10-19T16:54:38.91Z" }, + { url = "https://files.pythonhosted.org/packages/9a/7b/eaf828fd414401672e615570b9f2bfd84342b49c86ffb2ae735e4aada32f/websockets-17.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:ef2950896673a9809e8e5ab857525924fbcacfc98b858b0509ccf50d341f80f4", size = 226240, upload-time = "2026-10-19T16:54:40.294Z" }, + { url = "https://files.pythonhosted.org/packages/79/bd/4b6aa6e761c8d89aa6defdd83e40a6b2d9aa21bd01520c8e8470fe8d8681/websockets-17.3-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:2d08ca4bf5a9cdb6fd81b86b51bd5cfb10527d3a1199888f2b02cc6c6a3d5f80", size = 224833, upload-time = "2026-10-19T16:54:41.939Z" }, + { url = "https://files.pythonhosted.org/packages/37/a8/0a6aea08cad7db2c1aa53dbd3ece3ebc09e420e8301cb02f2b812a728a5b/websockets-17.3-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:5e0c0ed37472c4729f3001066510a656486f08f149dda1ebfd3dfe4450c9756e", size = 225599, upload-time = "2026-10-19T16:54:43.54Z" }, + { url = "https://files.pythonhosted.org/packages/1d/82/3998ea56beb079f43fc39dd5935ef8dc150f915bf2de8bd6ddcd50c0fae6/websockets-17.3-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:62059d739af7fc035ed6e63c5390118a60a5e9aa5a5541cd0486a83e741842c7", size = 226643, upload-time = "2026-10-19T16:54:44.914Z" }, + { url = "https://files.pythonhosted.org/packages/c1/a5/6568add8d0a2f37c5780c6de62b5b8ee191ca9d2d0b8ff2123b8277c41b7/websockets-17.3-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:bc6f87d03e3691154673aaa8f08991723d6e3394c83ef2875c7a9049eac9595c", size = 224223, upload-time = "2026-10-19T16:54:46.429Z" }, + { url = "https://files.pythonhosted.org/packages/72/79/b11bc05b0f64d8b14901443a4b01ea80d039cc68b260250b4cb488070aca/websockets-17.3-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:3d78d93846eddc990551c1c31914d90d71957ca3af468969826f7ed0d7d1d51c", size = 225255, upload-time = "2026-10-19T16:54:47.82Z" }, + { url = "https://files.pythonhosted.org/packages/71/f9/9a8902074db7044b64a05feff349e4f44144a961310d3419bab612f00dd1/websockets-17.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:2a377c7132b1e69be7a50d7434d7f26f69e93c70166ebb6d8f8cabf802ac4506", size = 225494, upload-time = "2026-10-19T16:54:49.171Z" }, + { url = "https://files.pythonhosted.org/packages/99/ba/7b873060ce6764207a24c10e81294739abffe2a90dc67c7f7db5042c596c/websockets-17.3-cp311-cp311-win32.whl", hash = "sha256:29b01520c39ef2f23c88b002f11e6ef4165675f6c92f5f3578fd587d69b5a5fc", size = 218720, upload-time = "2026-10-19T16:54:50.501Z" }, + { url = "https://files.pythonhosted.org/packages/28/11/7469f3f28513ec0d43f10b1c88bf970b0b6f0aa8190c42731954297e824c/websockets-17.3-cp311-cp311-win_amd64.whl", hash = "sha256:d338813a440bf6d2f0df55140d3f3080284410b1ebfe9df50e3847bcdb1a17bb", size = 219017, upload-time = "2026-10-19T16:54:51.843Z" }, + { url = "https://files.pythonhosted.org/packages/bc/fd/4724610baabbba94a44c5d1cf1b1a33ff77031e94a51addb0387c7f56b10/websockets-17.3-cp311-cp311-win_arm64.whl", hash = "sha256:6a8248b1ba8861e48e4c7ced3895a1264d2a3b617de72ec94172ce6e64bf16c7", size = 218950, upload-time = "2026-10-19T16:54:53.37Z" }, + { url = "https://files.pythonhosted.org/packages/0d/29/902ffe19c0d35603102f31490dea342f083bc77d8f8bcdc7d8b16f5810f9/websockets-17.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:41665c7ea01d3ae497a0c61fd22d3424230d18782a5fceb79f04db9ccb2042c9", size = 218250, upload-time = "2026-10-19T16:54:54.718Z" }, + { url = "https://files.pythonhosted.org/packages/f0/66/f56a2637b1aac263205b0e3cd7b2ff2e2f8b404b8118c991f4d122fd381f/websockets-17.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:8f7469408740cf06a79b01605f2ae0b2acc8839c03fcbbf05da49baee12d3302", size = 215927, upload-time = "2026-10-19T16:54:56.124Z" }, + { url = "https://files.pythonhosted.org/packages/22/7d/a27f25451c4cc62141992b51005688481210f3d3e63de3dc66f9e882ba59/websockets-17.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d68da281ac208b6236ffa8beef23fe7c7c956d8bf09b421d447232fd94441b35", size = 216196, upload-time = "2026-10-19T16:54:57.538Z" }, + { url = "https://files.pythonhosted.org/packages/9f/77/40bbc1a5c016cf9f598dea21d1250a93245c995eafaec6401d0e4eb4e647/websockets-17.3-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:078d1d41f45ee34eed5a4f3bbe7c588caecbdd6e12dfca73e8c1b0e803773793", size = 225516, upload-time = "2026-10-19T16:54:59.104Z" }, + { url = "https://files.pythonhosted.org/packages/3d/9c/91889c8c62fb7d16cd58e3074473a259303d6229bf0ce496aec87e66f3dc/websockets-17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a7f391838e8adcf1f2fe71561d9e5a9f74ea7ffa5052eb2db329aac677383136", size = 225795, upload-time = "2026-10-19T16:55:00.438Z" }, + { url = "https://files.pythonhosted.org/packages/b8/29/2e5e2158e9920f806cd45f3cbc81cf5f3eef2b9e5a74b9ef049e2a3578e3/websockets-17.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c15a165673bb3fb57facbf040edf5c0556d20ccd2e0ccc5f23ebb69fb715fdc1", size = 227034, upload-time = "2026-10-19T16:55:02.065Z" }, + { url = "https://files.pythonhosted.org/packages/b6/af/fbab5c4098b26026b877bfc139b1ea0d7c6eaf7a86b84544933b4c445f82/websockets-17.3-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:28d1935c16782a1e3650c9baa79069b016fff739e292e4cb14bbb830d6930491", size = 229863, upload-time = "2026-10-19T16:55:03.415Z" }, + { url = "https://files.pythonhosted.org/packages/ac/72/d6e460a991607794072fe3fdfcb3221a0342af61586f5bd7ea40bddcfd21/websockets-17.3-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c534c9524a2acd0b97b7022074bec3784ac273c683cf9535087e437672ea8531", size = 227669, upload-time = "2026-10-19T16:55:04.763Z" }, + { url = "https://files.pythonhosted.org/packages/ec/8f/1c7da1cfb632e141e019cf2e0bbbd4e6dc8c198c8cc29544e4acf1a89f56/websockets-17.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b459d29c8b82a420a98fa0ce8e9cf787ce0062d98cc90604ef9574fb3cc26ff8", size = 226429, upload-time = "2026-10-19T16:55:06.112Z" }, + { url = "https://files.pythonhosted.org/packages/3e/63/c48ef8bbfbd982f2cfae1cfcf9e63f5bfbb8468fd37ca700507efc0b0007/websockets-17.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:53209dffd91b0aefed9ea630fa6ad5c2944d6210ba3a8a3a8664dc1575289b14", size = 223653, upload-time = "2026-10-19T16:55:07.473Z" }, + { url = "https://files.pythonhosted.org/packages/cb/37/7bedaad48ae8e89eaa4f3942c11be0c41de77ce2118a475f3ba05e9b5a0f/websockets-17.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:9662a9fe457820c60365b3209e03cbd8e4a817195d55de65a80fa680b4bea136", size = 226465, upload-time = "2026-10-19T16:55:08.791Z" }, + { url = "https://files.pythonhosted.org/packages/33/cf/ab9a8a0de4769ca1dce392021b6a922e21b4d3687fe9e1ab4db585a088f8/websockets-17.3-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5670a762c7ae388bf8aa04199fd436180a4d28318dca9c1eae7b38604676dbfd", size = 225071, upload-time = "2026-10-19T16:55:10.127Z" }, + { url = "https://files.pythonhosted.org/packages/89/96/64d8460cec95f873c61c6d13a09b435915150640525ae56d5871400aec09/websockets-17.3-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:ed59cb4ee258674a6ed9b8515e42079db02cb3be94f133fdd3f200183a40c49d", size = 225841, upload-time = "2026-10-19T16:55:11.519Z" }, + { url = "https://files.pythonhosted.org/packages/a6/98/2b83211ee3087db4ae66533782664c0e283cf4a08cbb14036018d0803e09/websockets-17.3-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:0f78bb2e82fe88912c9d7b25c98e57a9b08655579af89f164fd4c0657a075d62", size = 226945, upload-time = "2026-10-19T16:55:12.85Z" }, + { url = "https://files.pythonhosted.org/packages/9f/fe/6b2a37d422d7f4dfc0c92c95a14649d9bd662243ed8b0774523ed2703604/websockets-17.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:71250e010eede33c1d638e2c7a98288520d67f782fd5eceecaeca3129233a09a", size = 224502, upload-time = "2026-10-19T16:55:14.48Z" }, + { url = "https://files.pythonhosted.org/packages/0c/c5/364015c9311c89ea6085d54c70d654c5d27ba05014d44ef9fd9daa09462b/websockets-17.3-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:729989759feb81ff6493879a0d60a0bd7d2eee41001bbec0381a080318439382", size = 225483, upload-time = "2026-10-19T16:55:15.899Z" }, + { url = "https://files.pythonhosted.org/packages/c2/b3/75d0cae8398816ed34a16a78252bfc8651f2f883cc5a568e1198395f15df/websockets-17.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:90d8c4fa5ba293cf92de351fbc292cdaadb1a1d58d031a1a97ff9b8fb6250ec7", size = 225761, upload-time = "2026-10-19T16:55:17.28Z" }, + { url = "https://files.pythonhosted.org/packages/f0/af/9a7c4b2e87f47a2a6a066acdc2157e9b7cb6222a224b95a432f54ae786ce/websockets-17.3-cp312-cp312-win32.whl", hash = "sha256:0824e6ecee838cc28e6481062574c7fde49f9a2cedfacd36f0e91cb4b37fd6fe", size = 218722, upload-time = "2026-10-19T16:55:18.658Z" }, + { url = "https://files.pythonhosted.org/packages/f7/e8/e52953a8280a1e51cb9307218443f68c8f4dc4b9952db6021d5c12d03c0f/websockets-17.3-cp312-cp312-win_amd64.whl", hash = "sha256:6644eecd99c4e8cdf72e646e17b391bb70b054f44becde37dcdc48cbec7e1527", size = 219024, upload-time = "2026-10-19T16:55:19.987Z" }, + { url = "https://files.pythonhosted.org/packages/85/a4/005eb7c1f5c1a249c1231a6ed83a54ada0b6b8ffab33a608ca20e3034ea0/websockets-17.3-cp312-cp312-win_arm64.whl", hash = "sha256:4a9133dbaedc6f1af358127275676171d9a1bb3e61f47ee62b2ff9acb78af3d0", size = 218950, upload-time = "2026-10-19T16:55:22.161Z" }, + { url = "https://files.pythonhosted.org/packages/ee/1d/c1f4a1c45c5ca2c35ae9fd7cac0e491f8a014c9a86933a5da7b04ff825cf/websockets-17.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:52a2ca6f401fb49a8d5d9e0e48ade5f58f1bdda33132907b0e4e3b702628fa4e", size = 218243, upload-time = "2026-10-19T16:55:23.851Z" }, + { url = "https://files.pythonhosted.org/packages/4e/e8/f1b47d0ced4964ae748931a54347fd27b06b62e8ea7837a9de3aee0c5999/websockets-17.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:80578e91764bfca297ddca322c00a3136d993b829e9839e7fa378a19c1fcc25d", size = 215927, upload-time = "2026-10-19T16:55:25.317Z" }, + { url = "https://files.pythonhosted.org/packages/16/df/ab0ed0445d8d81a133c8fed760f3b4f743a2f563804fdbecb2c32fe05d94/websockets-17.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:fe7a168d805c8a7bf1c2de55b7ab2bc958586bfd88d0e87235a92cac66b590a7", size = 216185, upload-time = "2026-10-19T16:55:26.678Z" }, + { url = "https://files.pythonhosted.org/packages/9f/51/b30fd6c5a33dac76a78083be125e3f9804f3d735da494ff03a46834f31f4/websockets-17.3-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:54fcd24944e6d127d198c28dc363967b7131ff0c97833962c2ef2048018de02d", size = 225574, upload-time = "2026-10-19T16:55:28.097Z" }, + { url = "https://files.pythonhosted.org/packages/1c/8a/8ede659919c0805d1fcc79c2ed16588d3419f1687c5117ba46f0217750ec/websockets-17.3-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:de2c12555bf05546f3ee75733f2c81de70aab7f530e86d0d2162b0ddcb3c39ae", size = 225854, upload-time = "2026-10-19T16:55:29.491Z" }, + { url = "https://files.pythonhosted.org/packages/a6/6a/e75d10e3896edc61320062890f71cdc0767dc4a54e2a26a943b703042d13/websockets-17.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c95d25b5382ee0e6191ecafdeabefdc1f7bff8dfee29239b9b79e760ef3b04bd", size = 227091, upload-time = "2026-10-19T16:55:31.146Z" }, + { url = "https://files.pythonhosted.org/packages/dc/d3/658f1e153566e5edae02812122d9f020c30785d8b53c4bda61b8e976f77f/websockets-17.3-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:8f244dfee05ea29b8064701880865eb1684f3a704a5665bd10b64694444dbbd4", size = 228526, upload-time = "2026-10-19T16:55:32.524Z" }, + { url = "https://files.pythonhosted.org/packages/28/00/002f95a02d721d8c6ec2676c5aee904a823838a9c205fc0b31eedd882a7b/websockets-17.3-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:2e99440ef446c7833690c1754e23b0188d440f3cb89812b0764c697a7880cb33", size = 227718, upload-time = "2026-10-19T16:55:34.085Z" }, + { url = "https://files.pythonhosted.org/packages/fa/9c/d36ec9499a62ec4e2a4eb570f93c6fcedd80ad5685e0f9d6866e8cfbbb84/websockets-17.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:26838e2d95d7004c52e8c7b6b51676c872093a3b55a497824f899116a15a8a55", size = 226472, upload-time = "2026-10-19T16:55:35.484Z" }, + { url = "https://files.pythonhosted.org/packages/36/5d/3a6d74e409f24ae4e8661a9d74d6645f71b3e91425a527c0e3f2e78bb15b/websockets-17.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:508775efa11d26aec186d10154359f52276e2baf9ca201b52356330883276dfd", size = 223710, upload-time = "2026-10-19T16:55:36.853Z" }, + { url = "https://files.pythonhosted.org/packages/e1/90/e08eb5d69b73cf5babf80922a8c964019b48339ce5c694a5d0c0f083c5a8/websockets-17.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:2789d203babb6ceb2770aadc2394c1f99263ec37fba57a93064f9a8ad899e8ff", size = 226532, upload-time = "2026-10-19T16:55:38.191Z" }, + { url = "https://files.pythonhosted.org/packages/c2/45/b1916efa1dad5af33beafe5c536810e1c80856b7e913f671c35031c57745/websockets-17.3-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:cfef7f7aa434a1e632e0ebda14b39f4f1d7975e0fce5c77ea7b43156fabf9bd8", size = 225129, upload-time = "2026-10-19T16:55:39.635Z" }, + { url = "https://files.pythonhosted.org/packages/04/c1/d427abb3f11e92f102f70f8e73addb767fc62c614565c0ee3f5657fa3551/websockets-17.3-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:39f532fa0d9026de4b9315a175998646112776baad54d55348435c11b05d034e", size = 225900, upload-time = "2026-10-19T16:55:41.033Z" }, + { url = "https://files.pythonhosted.org/packages/07/2b/462fab8e4b09eaa4eac2f40fcff8ee30f851aa40fb518efb0177262f6590/websockets-17.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:85d6daa3a7ca404570ae130babbeb347ef9d3faca5300fb13cfa4bb48c3d30d1", size = 227007, upload-time = "2026-10-19T16:55:42.314Z" }, + { url = "https://files.pythonhosted.org/packages/71/36/7404a4376021a0cc7ae9fcbdb1196c0c8aa48df4fd370c185f4f5b677bff/websockets-17.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:ce39283ef08b0f28478e920d4d89a1fc169176e568e8a6a821332673145522eb", size = 224565, upload-time = "2026-10-19T16:55:43.93Z" }, + { url = "https://files.pythonhosted.org/packages/c9/5f/b8ada5787d11e6edbf58e2d680235fb3b2fb3298991cc310566f4d6c2fbf/websockets-17.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:23046098ebf844753cfd211033624a8247520e5bf2194c24cb1a8c222917acff", size = 225516, upload-time = "2026-10-19T16:55:45.398Z" }, + { url = "https://files.pythonhosted.org/packages/23/1c/0533f760237ac6604efd0bf98c18ea4c1381f2cadd8c8d0b05faecb07a80/websockets-17.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:724224d4c457207271239114bf43afafc3eca4a1b4661ccdd428d11869a03bbd", size = 225797, upload-time = "2026-10-19T16:55:46.989Z" }, + { url = "https://files.pythonhosted.org/packages/97/b4/0e580e8f96197130ebdb32b727e9c891594c930be30d8a9de9aa0bbb7e2c/websockets-17.3-cp313-cp313-win32.whl", hash = "sha256:5af7070d80d278832cbca9c3c3dd44b30a26dcfa3ae1e0f6f19ff34edc27b689", size = 218712, upload-time = "2026-10-19T16:55:48.379Z" }, + { url = "https://files.pythonhosted.org/packages/7d/6c/db5c907d1cbea84444bc759ff63db97fc586988d11a34d5565e8b50080fa/websockets-17.3-cp313-cp313-win_amd64.whl", hash = "sha256:66027e401c70d0cf55021b91b8a7ec2cd5810e20602f945b4fe6ae8b37ed232b", size = 219026, upload-time = "2026-10-19T16:55:50.688Z" }, + { url = "https://files.pythonhosted.org/packages/f1/d3/30f04bec5b9cf0c00c98c038494b210ece923a0b05b6df38a162b759e5ed/websockets-17.3-cp313-cp313-win_arm64.whl", hash = "sha256:6b14914e67044724c31a9360c7b89e9d070117c630746eefdc1620d967545acd", size = 218958, upload-time = "2026-10-19T16:55:52.085Z" }, + { url = "https://files.pythonhosted.org/packages/27/ad/f65e365bbf38d61164b0c2f64776fc7714bfa59ac51e492b038a35f4ab1b/websockets-17.3-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:bc8fd230ef013951900c1fda100eebe4a4b1b407dde2a44186995042dda2c628", size = 218288, upload-time = "2026-10-19T16:55:53.387Z" }, + { url = "https://files.pythonhosted.org/packages/48/1c/33271eba53b4927a1b91d99d838a6d7b888e6f708425262c911450d73696/websockets-17.3-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:cdb8e4b0f6a41b857c74c03116e8ffbef59ef8e533e934b532843178990d01d5", size = 215977, upload-time = "2026-10-19T16:55:55.063Z" }, + { url = "https://files.pythonhosted.org/packages/3d/f3/6d982c60f6c7c95e5faed53d39263df273ecfda904c7d6920c37eee58dd1/websockets-17.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:018fab26140ce221c3853454a608e4e7004f4f10641cb97819dcd5b917bb2e99", size = 216193, upload-time = "2026-10-19T16:55:56.424Z" }, + { url = "https://files.pythonhosted.org/packages/ff/c6/4ff6b8d2a4b32719d4658bbd791ee9d19939a47a69b961c961fd9dc3a64c/websockets-17.3-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:dd0f3037d501178a761fd2814370aca547f79e99a200a61a1f6e7b79ec3d78b9", size = 225573, upload-time = "2026-10-19T16:55:58.252Z" }, + { url = "https://files.pythonhosted.org/packages/eb/8f/46e4030947f5590cb61832901f44a3edb07ef8d1e27f6c06b42c5f1c4d33/websockets-17.3-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:8dbb3862aa649de95660b6337d97101977f160b5b354d07b82fe309874d2c8bc", size = 225927, upload-time = "2026-10-19T16:55:59.561Z" }, + { url = "https://files.pythonhosted.org/packages/f0/1b/3db30fdf4fbefa4ac463060d3f87e2d444f960aa1234028468c09b88bffc/websockets-17.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:af37a1e6b6bd506b597d5fb4cf111fb527d1b2223608a5d441d4738827cfd166", size = 227169, upload-time = "2026-10-19T16:56:01.029Z" }, + { url = "https://files.pythonhosted.org/packages/02/ed/849799cfc0e3e359b75ca1d50605376da52dc9ef0b2a53931e3f5991f96e/websockets-17.3-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:740bba4223fa5216d4d6c5dcd29e697f37229b8a61b69e1a50527b0ea993ab2c", size = 228542, upload-time = "2026-10-19T16:56:02.377Z" }, + { url = "https://files.pythonhosted.org/packages/19/53/dcc397e20ce792fffd9a8f79b6333275748ee7a23f807e576166a0b16edd/websockets-17.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4170556762c6fd2913d99dfdd8dbb4c927584899df7facb1034627e355263c45", size = 227772, upload-time = "2026-10-19T16:56:03.768Z" }, + { url = "https://files.pythonhosted.org/packages/c9/36/e5935782f71e9e22247b2a2e562da05e18d8945c49f2692ca1bdaceec178/websockets-17.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d355b22270be8062360b9df2ee0b10277590789a1059257916fb9e256a0cff80", size = 226518, upload-time = "2026-10-19T16:56:05.332Z" }, + { url = "https://files.pythonhosted.org/packages/27/76/bd5978a1e403fc646230cf35cf7c06b40b3a232d440881b9e89ede229b18/websockets-17.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4aa85b34c21cf97b3470793d0bf0763d32bfd1e67b83067a0a3ba8dc3474dacf", size = 223766, upload-time = "2026-10-19T16:56:06.703Z" }, + { url = "https://files.pythonhosted.org/packages/da/87/c66eb39bd851d5c14d9eb75aa64d03cfcf2ded77927ca067b5917291d19d/websockets-17.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:a0e2e7c2c1a4f25db7b6596738d810c10732e77f852247300a1bc49e364d6dc9", size = 226644, upload-time = "2026-10-19T16:56:08.198Z" }, + { url = "https://files.pythonhosted.org/packages/fe/ae/b9a31d5497fa0b73629a097b173a26123da2ed656b562114644bc623414b/websockets-17.3-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:7fa69212ea60ea24e2d8aff23fe102b1f87f1b27a320f92d2e7b3468997a496a", size = 225107, upload-time = "2026-10-19T16:56:09.627Z" }, + { url = "https://files.pythonhosted.org/packages/61/0c/b773a102f84b60b2052b2cfde773d2f3cd3e8eaa93a145f54450460549cf/websockets-17.3-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:80a6e37e235780f189558ab804f3cbc01c18f5c578995739b49613d544d34ebf", size = 225891, upload-time = "2026-10-19T16:56:10.973Z" }, + { url = "https://files.pythonhosted.org/packages/b2/fa/e7e538575dd4912dea9ea4c9ae86519aa1420969d9cb5cf02fd10fd20ba7/websockets-17.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:628efe13630ac3397e7d1278b6be6f22f37a86d638a324334b4cd43c1daf9928", size = 227064, upload-time = "2026-10-19T16:56:12.295Z" }, + { url = "https://files.pythonhosted.org/packages/28/87/bf2b928c156deefd0c50285a48fc985e2ca85d284e7d9981cc5b79b0e696/websockets-17.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:443fa28652682d2a3ec3eca49af1b87cb2523561257683e62e03a98967b22138", size = 224618, upload-time = "2026-10-19T16:56:13.73Z" }, + { url = "https://files.pythonhosted.org/packages/8c/9a/d59817ba3535f787c1cf8990a01b3d2896a7d9d8f3b5d55bed22fce595a6/websockets-17.3-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:6705af9d1005127302c04d9f1533ba56e289336c465923ef878430e99295a0b9", size = 225571, upload-time = "2026-10-19T16:56:15.199Z" }, + { url = "https://files.pythonhosted.org/packages/a6/96/8210379dac889e16c75099aefffa200dc55dc8cb030010f309a7eb9c75c1/websockets-17.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9bde5d82d7ac4859e0cb3a35e148f537a8d4e56aa43f42582b5f263982f095ae", size = 225869, upload-time = "2026-10-19T16:56:16.569Z" }, + { url = "https://files.pythonhosted.org/packages/97/0b/d4741c977fec9e6482beffece572d544d42d230f56fc3ef504f96521063a/websockets-17.3-cp314-cp314-win32.whl", hash = "sha256:be7be57097a65a8fab3d0f0a10d12931deb626a7d8082eb732b1ae41f3a202e3", size = 218232, upload-time = "2026-10-19T16:56:18.028Z" }, + { url = "https://files.pythonhosted.org/packages/33/69/2f9ce899776d0c522f7f44080cad4228a1c14ec13b0125a2efc12ebe41c9/websockets-17.3-cp314-cp314-win_amd64.whl", hash = "sha256:2b06213c8e1ce93b18d0476d7a5e647436c8f23d099888c9065e930e80f4bed5", size = 218582, upload-time = "2026-10-19T16:56:19.399Z" }, + { url = "https://files.pythonhosted.org/packages/4e/e9/11b885666d72add674440a3435c059bea325616959cec8be42605948714c/websockets-17.3-cp314-cp314-win_arm64.whl", hash = "sha256:6b7b540bb321f7f0a7b8f5d107f941bb361e3a154c0b594dae0394997b91b743", size = 218465, upload-time = "2026-10-19T16:56:21.005Z" }, + { url = "https://files.pythonhosted.org/packages/c4/0e/0c0f40ab8eefe9d5a6c78b4e267d8e37d70d3db8dd195574e0ab867e4f81/websockets-17.3-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:c9d06edfd974e918b40e0662a7e76dac13125529ee5ec9fbe42dc0d6faa209c3", size = 218614, upload-time = "2026-10-19T16:56:22.457Z" }, + { url = "https://files.pythonhosted.org/packages/1f/93/d22b3d63aa439bc01a9477880070d05e0b257b0548294786a33be3e842ec/websockets-17.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:0a0bcf66289b9d017c175562c35c5304b5cc3ed56aded994ae30b0a9654ba405", size = 216151, upload-time = "2026-10-19T16:56:23.95Z" }, + { url = "https://files.pythonhosted.org/packages/b9/92/f60a9672cdeb8cb4f7156e6e83c76d59fdc586737a97ac77129e9fc188a2/websockets-17.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f3ed747b7651668131029c720fbc32c7ee2d129bdad200e6c8f4037b20f7913a", size = 216354, upload-time = "2026-10-19T16:56:25.251Z" }, + { url = "https://files.pythonhosted.org/packages/9d/da/2be8c5f3c6612d4523f95b074e2352bc11bd090cf121d32bc11af1d52e70/websockets-17.3-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:5868a02c4f6d698ddd19b4c9742748c03dec045289915806845189d96bc3d314", size = 225937, upload-time = "2026-10-19T16:56:26.726Z" }, + { url = "https://files.pythonhosted.org/packages/85/1c/cb84aec871840acd66dfa84520bf7b8e48ce70bdb3f4baa4efd097fbe6b1/websockets-17.3-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:fa87ea2ad64e59fe5622c1dc5716106b6d6e7e4b26b848cb5f5710a75c292ef5", size = 226215, upload-time = "2026-10-19T16:56:28.1Z" }, + { url = "https://files.pythonhosted.org/packages/9b/7b/cfb65557accec2eda2c80288e13eca6f1c797c579375906eb73f4053cfd1/websockets-17.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:65e937576141ac50fac32fa9736dbb3e0e4a7769f91be004011a09216c6ab05f", size = 227389, upload-time = "2026-10-19T16:56:29.518Z" }, + { url = "https://files.pythonhosted.org/packages/70/a3/7e08ec4b23e376ed228831aa44b2f2a3f2e7025cc66dda4b2e53dcc2619e/websockets-17.3-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:35381b575f70a08d4241e73c0cde4672bb9b2a9aae8767ca6b7fb61305a052c8", size = 229534, upload-time = "2026-10-19T16:56:31.072Z" }, + { url = "https://files.pythonhosted.org/packages/4b/7d/8a813e3e53956f876cfaad4f6358625bbd94168aa8046c44e2f3561f12af/websockets-17.3-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:5142798871a248b422f353e0684d51dfa119de3403a6fa0904b7cb806d9790ce", size = 227959, upload-time = "2026-10-19T16:56:32.656Z" }, + { url = "https://files.pythonhosted.org/packages/41/23/5f3dab6ab44f2f30042db83a658a57129d5e3c0425c798b3c3e727bc060a/websockets-17.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e164c4a6868d11988c7f2386e3278ccff21c665cd7d08279b62709dd37a3167c", size = 226691, upload-time = "2026-10-19T16:56:34.101Z" }, + { url = "https://files.pythonhosted.org/packages/5b/49/99a3fb5a2e94d677fbd0d014a6f9a56a3d2b8e8007b7175727bc4fc4ae94/websockets-17.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:10b24e836ee0233ca078e1244f6ba40343a22127a9a736f46a7e7b18de2cc711", size = 224225, upload-time = "2026-10-19T16:56:35.452Z" }, + { url = "https://files.pythonhosted.org/packages/6f/e5/f503a4d757858d083c90ea85dd1fd636ae9eb63c9552c75a4c38514ee7ed/websockets-17.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:56a76556ab04ab54a675acce2cac8b4e74ea2cec558a7c9ed37e0367b04b5d50", size = 226984, upload-time = "2026-10-19T16:56:36.887Z" }, + { url = "https://files.pythonhosted.org/packages/4a/a6/8586844ad4b21988837624e1f4b331bc71919c85a6eb1ee3c8bd29893f27/websockets-17.3-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:33221e49be79d7bfe6d12bc52ef9458b256ab74fa8ac5660acfa3065de1c7870", size = 225436, upload-time = "2026-10-19T16:56:38.213Z" }, + { url = "https://files.pythonhosted.org/packages/a7/b9/f419506494d6ffd205a9c3258f56ff5aeae6976de26361057de74f4ab659/websockets-17.3-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:2fa79b9a48ae59744316c71a34cb9f76f30c93e117338522c5135cb7eac10351", size = 226325, upload-time = "2026-10-19T16:56:39.606Z" }, + { url = "https://files.pythonhosted.org/packages/28/c5/55a58faa67149e84cb98b33f9d8fda95242677ea07b78f3ecaf2e77877d6/websockets-17.3-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:f87f02afe05c1c246012e3de100a77cfbabd17db709fe93cf074271ab239b312", size = 227342, upload-time = "2026-10-19T16:56:41.041Z" }, + { url = "https://files.pythonhosted.org/packages/35/e0/fbe561dff24b6ef1b2034877f37b56eb9b81b3c103e2a8b03819bf2b3b6d/websockets-17.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:8135a549e27e9941a70e2d2156676ef2ffeff4b06e9d564dbaaae963482afdef", size = 225036, upload-time = "2026-10-19T16:56:42.433Z" }, + { url = "https://files.pythonhosted.org/packages/0d/37/d80753064f8370a24d3bec74807c3928d7b0ebef5381956e2a0108b365c2/websockets-17.3-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:ace8dd1efa5f44c482d091aa38322e20e3ffe5adcdba6b67ad9f4e7da58f3f68", size = 225807, upload-time = "2026-10-19T16:56:43.774Z" }, + { url = "https://files.pythonhosted.org/packages/f1/9d/a11d3168522a2959c4a5661728744d62b9eee344abdba5f9fbc1d359742f/websockets-17.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:2129c9a5fc05a230ce088745a790af073e582b584badc7b05db067ee326f56d7", size = 226241, upload-time = "2026-10-19T16:56:45.088Z" }, + { url = "https://files.pythonhosted.org/packages/06/28/16107b3b83fd2b5024bfecf8d000140f555204a0191202f9c4c981137810/websockets-17.3-cp314-cp314t-win32.whl", hash = "sha256:af7c474f0d8f4d2a196370e85033873c7b063a0b5da9a4f143aa023e3bd25407", size = 218365, upload-time = "2026-10-19T16:56:46.41Z" }, + { url = "https://files.pythonhosted.org/packages/77/dd/8b00e1dd552788d8c7762d7ef61de8f2f238d7357b1a02d4c4650b112196/websockets-17.3-cp314-cp314t-win_amd64.whl", hash = "sha256:0c63ad657695e8f1a48624754cb6b464118ac50d4c1d477c26461c98390f0a62", size = 218706, upload-time = "2026-10-19T16:56:47.754Z" }, + { url = "https://files.pythonhosted.org/packages/39/eb/5d90d57a5cbe614b2f13433aaf1c0b068c804589379061ba06812a185a89/websockets-17.3-cp314-cp314t-win_arm64.whl", hash = "sha256:3c4f631dc8d00e470cde3ec0a35d4b58a817bea592411956f1cf4099dbb306b3", size = 218622, upload-time = "2026-10-19T16:56:49.07Z" }, + { url = "https://files.pythonhosted.org/packages/6e/41/1efe5ecae1f32495dc75641704f959bd2d8e56cdc825f3acc5e010a51960/websockets-17.3-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:f300f28dff74ff4148c21e6971e4de6ca0c34e0086a3d95c017c5174ebf85ca5", size = 218211, upload-time = "2026-10-19T16:56:50.423Z" }, + { url = "https://files.pythonhosted.org/packages/01/ec/4edb653533241203db3f11522e122338d4fda50a41ce2a542029086f8eda/websockets-17.3-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:32029441af953e980b9940f042b337fe4ad9a97fa8b17a4ed878ec67b5b89ef4", size = 215944, upload-time = "2026-10-19T16:56:51.766Z" }, + { url = "https://files.pythonhosted.org/packages/d5/b9/ec450b9650925dd5cf27c1f36d0464786fe3ac702ed656879c4c0dd5c4df/websockets-17.3-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:09f007b2150eff015b2109f006e2ac2012d376f41486defa88ae78a776b00cff", size = 216164, upload-time = "2026-10-19T16:56:53.125Z" }, + { url = "https://files.pythonhosted.org/packages/15/1e/63f7fbff9f0540a0331f1a62424c9ff24faa6ba8aec264f55e9e31017eea/websockets-17.3-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:7bdc658c9474864893e0b6b94f1390bf6a912952df1870dd93bb7d1a902b5628", size = 225608, upload-time = "2026-10-19T16:56:54.442Z" }, + { url = "https://files.pythonhosted.org/packages/0c/1b/f6679ad61cb8c110033a1b30d561d5c1052983e202157251ff1778f27932/websockets-17.3-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:15decc0fe293d9e3f924bd483f3d76f3d0ff26845112a470e3f8842fec2c82a1", size = 226042, upload-time = "2026-10-19T16:56:55.727Z" }, + { url = "https://files.pythonhosted.org/packages/28/c6/ed993aaef8046cbbb939ae367ee3dd5383dbd055f0500a5b8aed101168b6/websockets-17.3-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:997617dd7856c5dad742bf6893b872319156dd43f47587541a59e4a852d52bbc", size = 227203, upload-time = "2026-10-19T16:56:57.076Z" }, + { url = "https://files.pythonhosted.org/packages/aa/96/7057dc71affe6c8252df8648f5a225642228a6fdd8d046a6b9aa1fb0e9eb/websockets-17.3-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a004c1fe5a72c496f28c6c1d8c2dc5cfe3278d99478e18f8b838c70a912b366f", size = 228900, upload-time = "2026-10-19T16:56:58.633Z" }, + { url = "https://files.pythonhosted.org/packages/43/e3/8b3268bb7e72b465e55172b86d55f58aa277fb6d9bac92aee615345874df/websockets-17.3-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:35fe35d20baa661cef4a12ee7bc42eaf2376d43ef9816ab29dd47ca957f7a73a", size = 227684, upload-time = "2026-10-19T16:56:59.975Z" }, + { url = "https://files.pythonhosted.org/packages/59/15/fa31c0a12240b1225c3712ff080d2f7ede4f695ca90e59fdb58e8affabba/websockets-17.3-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:8b3bede7d583bc9f47d8693a29984882e59077db1a5238ad977fc70ae8169741", size = 226580, upload-time = "2026-10-19T16:57:01.371Z" }, + { url = "https://files.pythonhosted.org/packages/22/b5/75d911c206a3035e2ecfad107878e62c06e574b2437fa2cfb4ecef436fa3/websockets-17.3-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:dafbb58a149d1ebd5767b3f064f911c5ee0897608005e51c3904b0ada2a8d99c", size = 223967, upload-time = "2026-10-19T16:57:02.839Z" }, + { url = "https://files.pythonhosted.org/packages/0e/f8/f98aa36f611acd5770819f6690125c20d55f221fd6db8d00d284b5f78e89/websockets-17.3-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:80326bc571164bbbb6bead2e35d0c943b23b24fde629032197c58151529d24d8", size = 226689, upload-time = "2026-10-19T16:57:04.458Z" }, + { url = "https://files.pythonhosted.org/packages/1a/36/d52f5dff7597de6fbfc26c3d126abd668137915719aebf97abcc3be77eca/websockets-17.3-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:7d53fc4b90ef6e11de639dc18744d9be8cbd70ccb5ce80027aaffe7b1ab0215a", size = 225353, upload-time = "2026-10-19T16:57:05.857Z" }, + { url = "https://files.pythonhosted.org/packages/d4/10/dcd70ad9f9cd20e8af43284ac250af610e8bf9022da25f5b409153d033b4/websockets-17.3-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:fdd00937f15f5f93c8e53d8060a8c4c010431ab595a9b5b50ddd569a04603944", size = 225879, upload-time = "2026-10-19T16:57:07.249Z" }, + { url = "https://files.pythonhosted.org/packages/70/ab/f26c6bfa99d38ca3d1bf23145306d97c5d0c75e133a8d837373e4b3d4629/websockets-17.3-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:1dae5cd6c92d4440b15f20aa2987baa73c47ea14baa0fec8536a542e82e0ab33", size = 227031, upload-time = "2026-10-19T16:57:08.817Z" }, + { url = "https://files.pythonhosted.org/packages/d7/3f/c8fd74cdb526cc65295b7468f2f84ba16678646d8174288822f99f510274/websockets-17.3-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:b225c656efa2dedecc81651d2290170af25887b7de4f38c5efc7c5ae2b9442ab", size = 224842, upload-time = "2026-10-19T16:57:10.298Z" }, + { url = "https://files.pythonhosted.org/packages/c4/c5/b3a07ce1c54fc0f5441642f5352662b90d7e658c966730eaf6d78a5f20bc/websockets-17.3-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:bd645b5d2f810a181c44f4a71135e7c365b44f4be9ed3d1892635be13a857553", size = 225744, upload-time = "2026-10-19T16:57:11.615Z" }, + { url = "https://files.pythonhosted.org/packages/66/37/8321a8a6ab0215d4df0238e49ace5f539364cf337bb122b85c788e8c93ec/websockets-17.3-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:d2605a3b2af8d66f8b75312d223642c065ec773446c04566d9030ad5e2db13c9", size = 226006, upload-time = "2026-10-19T16:57:13.049Z" }, + { url = "https://files.pythonhosted.org/packages/f8/04/8c457a7e6a260b673bf4e6f2f422eb4af5f11c48505748359706f24f1bef/websockets-17.3-cp315-cp315-win32.whl", hash = "sha256:82e60c00cfb8493a5ba27cdf9b3695fdd153f666f73e11f18968f78ead1d8705", size = 218196, upload-time = "2026-10-19T16:57:14.41Z" }, + { url = "https://files.pythonhosted.org/packages/a0/7c/c2df129d9e344b99bb388bcac54fbbdfeec29e6c716c12dc9a3398757940/websockets-17.3-cp315-cp315-win_amd64.whl", hash = "sha256:4d5f2492cb2192aab2d42e57f2caa2159b4fd20fde06f859ec13354f524b176c", size = 218490, upload-time = "2026-10-19T16:57:16.234Z" }, + { url = "https://files.pythonhosted.org/packages/e6/4f/721b778c85559b2949e46246838e31a346dd815b3cdd8460fe517235675a/websockets-17.3-cp315-cp315-win_arm64.whl", hash = "sha256:55494475206113dbaf731dc8c5ffd5e1094175b753b7bbaad09fe3d7df61165c", size = 218403, upload-time = "2026-10-19T16:57:17.631Z" }, + { url = "https://files.pythonhosted.org/packages/b3/28/241d9ebb4dad79346b5a6abf9f14d7685b12ca358d250eea4920cdb1caf3/websockets-17.3-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:23cb6f6d64e3a389bb8ba150f947f9a6c8c0aca383e814ca3c5cffab738d5646", size = 218523, upload-time = "2026-10-19T16:57:18.978Z" }, + { url = "https://files.pythonhosted.org/packages/b0/bb/559fe539992102c66cbca38b488af6c7b184ab7736d819afc0f72268a2b4/websockets-17.3-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:f27e7e8a85512b6a4b490d5756edde8e6772883a5800e1476172e44eda3f7d7c", size = 216103, upload-time = "2026-10-19T16:57:20.412Z" }, + { url = "https://files.pythonhosted.org/packages/34/ee/e8ade4f13a3d0da68636fe44bb8ac1a3e36fc57070512788320dead42067/websockets-17.3-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:6342f79d6f50e680c8aa59e0615d745e867e51ffd59c77093be60b7c433067af", size = 216316, upload-time = "2026-10-19T16:57:21.761Z" }, + { url = "https://files.pythonhosted.org/packages/4d/06/4812b2a7a5e6571d9be425e76cf54ee69aaa15720caa02307785aa5b19a7/websockets-17.3-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fc23e72bd7f8a8e540fed2244524d0a9aeb6ae3325f3d56f04a7a3debe5b04c2", size = 226467, upload-time = "2026-10-19T16:57:23.077Z" }, + { url = "https://files.pythonhosted.org/packages/d3/e8/adfc05d7f9b6b0cce6cc554426c50b7058609119b6b84a39171fe5ed4e50/websockets-17.3-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:722ab747ff5dc28070b1a8c020dba6466f13f2ab56bc251ad301fefa2454aa1e", size = 226736, upload-time = "2026-10-19T16:57:24.419Z" }, + { url = "https://files.pythonhosted.org/packages/96/b2/d5b93dd933552554507edae9e3a4890269a8ea8b46019450ea9c8a30e7cc/websockets-17.3-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0d20d6ea5aabbeba2e054d33e405192ef75dc12947bbd00ec97d23b14969d325", size = 228065, upload-time = "2026-10-19T16:57:25.908Z" }, + { url = "https://files.pythonhosted.org/packages/10/37/642f0f1cf1c4814147a4f0586f796a0b38e42b69e5a296bfc270fb660051/websockets-17.3-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:90cc9973c51811918247a78d9ab2f54871296e4e37e69a98aba4d3c9acedbf62", size = 229692, upload-time = "2026-10-19T16:57:27.63Z" }, + { url = "https://files.pythonhosted.org/packages/5b/33/eac81cf62ac394b61db6a27ccbe8fb9ae382016ef73ede1edf9242a6a43e/websockets-17.3-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:63b87c93e28957e6dc2bb92d31727a863c9bf4a4daa080f0995fdcb0242c9166", size = 228503, upload-time = "2026-10-19T16:57:29.031Z" }, + { url = "https://files.pythonhosted.org/packages/0d/84/e057788a9bd056f4f7d3a06b59efaaf724bbc6f2d1e1d316f8a93c951abc/websockets-17.3-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4f7431e71072962d3ed1768038200aa4f1e76d9c2d7bedd554d57a55faaf6644", size = 227379, upload-time = "2026-10-19T16:57:30.571Z" }, + { url = "https://files.pythonhosted.org/packages/fa/a7/cca1f9f45b893bb5b7545f2b234f910e07fcd2f8065724ac1a62a0961be2/websockets-17.3-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:534ed583fd4323de45d196535a444cebd1af2105e6e4e0cdcbf8cea266a8747a", size = 224719, upload-time = "2026-10-19T16:57:31.895Z" }, + { url = "https://files.pythonhosted.org/packages/1f/a0/5d07451027150c802ce4c9999e86994a3f0de5f4dbe3d1cce46995999269/websockets-17.3-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:8879b6a4040ee925c638548238ab7fe612cf5fa8752fe847346da0da8be81c3f", size = 227564, upload-time = "2026-10-19T16:57:33.236Z" }, + { url = "https://files.pythonhosted.org/packages/62/90/835f37e13fac0c615a700caae0d39deff1de2d2b9b341836a786f9b359e0/websockets-17.3-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:58e5d1e935a90878a935c7d2737a25c71cf4f1c13b6e6bef454ab722c4f338bb", size = 226218, upload-time = "2026-10-19T16:57:34.876Z" }, + { url = "https://files.pythonhosted.org/packages/16/8a/718639939b947fe715501e8073350fd3f8a42f8b5eba3c0c2389c5836513/websockets-17.3-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:0a657b51e4a5f4ac577c11e706ff9a884ea5aaf3e2666bae283a251c63e66acb", size = 226712, upload-time = "2026-10-19T16:57:36.248Z" }, + { url = "https://files.pythonhosted.org/packages/e8/45/6bef8572b9b0dee51369b69776af1e4c7cc3a807f199dc3c165bbcf1199a/websockets-17.3-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:411aa0fb234f42a1444dea1e177890ddfc577b36ffdfafec25cb0d2c818e1af8", size = 227819, upload-time = "2026-10-19T16:57:37.586Z" }, + { url = "https://files.pythonhosted.org/packages/f1/3f/3b726d0b46a132e641d2d8c0243ea8a7d39464dbaf28c7a206e51fbae681/websockets-17.3-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:623d4b44f64efdf235b1e8dce266057073d93cde6197e7d7684f20c297f67f30", size = 225573, upload-time = "2026-10-19T16:57:39.285Z" }, + { url = "https://files.pythonhosted.org/packages/90/96/cd972a12e1412d9b42c42ef42efbd81aa396ca9408d982d524012f011a8d/websockets-17.3-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:5d0c871efc696ef5eb8514df64b86ab28736db753ebb42a2101f3b562f4849c0", size = 226430, upload-time = "2026-10-19T16:57:40.915Z" }, + { url = "https://files.pythonhosted.org/packages/7d/2d/e11524771588188a39f6da234779d4942496b96c5a10b92f3df30db48608/websockets-17.3-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:1db2604e6aedb7a2cb2f6e0575d6c9a852ccac8239703a930ac83b63309177a5", size = 226728, upload-time = "2026-10-19T16:57:42.245Z" }, + { url = "https://files.pythonhosted.org/packages/17/9b/63722aed973f53ea579e1ce0c4563a2b8b536629e556feff26e4c6a2a60d/websockets-17.3-cp315-cp315t-win32.whl", hash = "sha256:07246d4f0293ef0b87eff3d7dd88c1f03dd9f678fa39f6de87b2af8504e7e0de", size = 218325, upload-time = "2026-10-19T16:57:43.585Z" }, + { url = "https://files.pythonhosted.org/packages/34/07/5e0c92e225546f1789c957c0383852797be7c899b07207e9b6eb4a93473f/websockets-17.3-cp315-cp315t-win_amd64.whl", hash = "sha256:856bbb24f2ee6436af7609267e73309e4bb0a0f9982f79f1c2e01019279c6671", size = 218641, upload-time = "2026-10-19T16:57:44.918Z" }, + { url = "https://files.pythonhosted.org/packages/d4/e4/339663de65c44ab3eb5209890e86eed26e1a131d6afab3df6f1c3e5b4d8c/websockets-17.3-cp315-cp315t-win_arm64.whl", hash = "sha256:a22c4956a4d858200dba83f0691bb692d77b0eeddfca80157820d20b85dea4f1", size = 218564, upload-time = "2026-10-19T16:57:46.332Z" }, + { url = "https://files.pythonhosted.org/packages/e1/f1/b462b1518779adf0b6fce305beee07357a79cf0724bbe61113ed6521882e/websockets-17.3-pp311-pypy311_pp80-macosx_10_15_x86_64.whl", hash = "sha256:34c78052277053bcb09810ac8e9ba4029f9e3e277833fc18ec1c928a6246ac91", size = 215839, upload-time = "2026-10-19T16:57:47.742Z" }, + { url = "https://files.pythonhosted.org/packages/a9/59/7dcea408892967516cc00d491ee7bba48577059c6eb0811f436b720bcd98/websockets-17.3-pp311-pypy311_pp80-macosx_11_0_arm64.whl", hash = "sha256:ef07e0b6b879f699a16fc7a513b974246fdeaef44908a021130cf4afe6a1c89c", size = 216114, upload-time = "2026-10-19T16:57:49.111Z" }, + { url = "https://files.pythonhosted.org/packages/c6/b7/2d447e461f1160dc8dcdd8b143e2adba54d402e5f828eeb1f8469970c937/websockets-17.3-pp311-pypy311_pp80-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:99c5637b74e2805ee4de9e2a43c8b45f678e50abb1c2da9880f0372f6498ba2f", size = 217065, upload-time = "2026-10-19T16:57:50.424Z" }, + { url = "https://files.pythonhosted.org/packages/01/51/35aa5edd12b23e0001b85517ad447342c07a29fcee62009b0859825b77a7/websockets-17.3-pp311-pypy311_pp80-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:2c460aeb12c2bd1c204944d9e9199595bf9e505eb542018d304bf9e63cb60cad", size = 216952, upload-time = "2026-10-19T16:57:51.72Z" }, + { url = "https://files.pythonhosted.org/packages/6c/db/537306b92236d761b99dc56a7316c0ad46f2854cd0756585b3a9d3fe5639/websockets-17.3-pp311-pypy311_pp80-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5e1c174b366565e101f903f9d1cc96d5508f805759dd37d012743f1c73ec0d7b", size = 217844, upload-time = "2026-10-19T16:57:53.144Z" }, + { url = "https://files.pythonhosted.org/packages/e0/c2/494bed87536f3822872e57b07ac9afa744af88ff64dda664b9caa32b1a72/websockets-17.3-pp311-pypy311_pp80-win_amd64.whl", hash = "sha256:c4b3f2c7d84f303da873b634d0beef83b5e1137294c3de4e23102841dac0cf4a", size = 306274, upload-time = "2026-10-19T16:57:54.525Z" }, + { url = "https://files.pythonhosted.org/packages/5a/1a/5582103e0362f86c4725051ded89e585ceaf750f26beace530b7e42c81c0/websockets-17.3-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:0e65260a1b1d7b81651f47343d836de70b88b02358ae3658efa6382104ec37b1", size = 215872, upload-time = "2026-10-19T16:57:55.95Z" }, + { url = "https://files.pythonhosted.org/packages/ef/a7/f69d65ed3ff9ae73d428a918300c23a992e4d50683090b8dc33cc3341d5a/websockets-17.3-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:94c02b0702656f083c098bdbd93bce22a7aa7a2b34ba56d2472efb67dab7cf58", size = 216136, upload-time = "2026-10-19T16:57:57.251Z" }, + { url = "https://files.pythonhosted.org/packages/69/76/c64fda4ac18a3aeb32e66acec481011a766add480b6362fad80e2c3c1963/websockets-17.3-pp312-pypy312_pp80-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:ade76f8c84ade325bbed96806357fffd353fcc29a5166d6dc6d39381f6d9f76c", size = 217080, upload-time = "2026-10-19T16:57:58.593Z" }, + { url = "https://files.pythonhosted.org/packages/6b/6d/085a3f0e6152bbe79917973f3d33cd008437de6c04675e2f15253b921f21/websockets-17.3-pp312-pypy312_pp80-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9a215749c9a88ef2842e880215193e56ae60b856773c99702b078236bc6d4adb", size = 216966, upload-time = "2026-10-19T16:57:59.924Z" }, + { url = "https://files.pythonhosted.org/packages/ed/b8/7eb904583ea2090b329f50487e6f8dc58eb558712b9f3c16f289f0be668e/websockets-17.3-pp312-pypy312_pp80-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4e7b5d23ef144b32645d97bd99f382c4394c443395f45fe1576786838d26e308", size = 217828, upload-time = "2026-10-19T16:58:01.822Z" }, + { url = "https://files.pythonhosted.org/packages/79/36/f54b4a1cd9456ca0a65a76d77d181621433793aca633dfeed214748ff4f0/websockets-17.3-pp312-pypy312_pp80-win_amd64.whl", hash = "sha256:13eace1b315345ebac5b27821f5dcce24e5cf9976ab18f79e00a59bdd67e5d19", size = 306301, upload-time = "2026-10-19T16:58:03.161Z" }, + { url = "https://files.pythonhosted.org/packages/d7/b0/3f01fcb3406662f6deb1e3e72b34dd0979e993991c0b7435a9e12bc14f02/websockets-17.3-py3-none-any.whl", hash = "sha256:dc2b495a92b3971966bf102e73589f950db3ec1ca6713265355ce7771d97b199", size = 212375, upload-time = "2026-10-19T16:58:04.483Z" }, +] + [[package]] name = "werkzeug" version = "3.1.8" @@ -5004,6 +5492,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/93/8c/2e650f2afeb7ee576912636c23ddb621c91ac6a98e66dc8d29c3c69446e1/werkzeug-3.1.8-py3-none-any.whl", hash = "sha256:63a77fb8892bf28ebc3178683445222aa500e48ebad5ec77b0ad80f8726b1f50", size = 226459, upload-time = "2026-04-02T18:49:12.72Z" }, ] +[[package]] +name = "widgetsnbextension" +version = "4.0.16" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bf/60/bc7a980fc78837d6ef8f5940cca4cadc433364503a4c4d42e2a7a0de3231/widgetsnbextension-4.0.16.tar.gz", hash = "sha256:adeea0ae78f0856ee4945f413299801b82a0a01416303301f39a704282a37b73", size = 1111094, upload-time = "2026-08-18T08:52:55.859Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/34/95/40e17e20046b7bc820d29d09ae84ec157ec8dd6e6f6cd722626292c31b2e/widgetsnbextension-4.0.16-py3-none-any.whl", hash = "sha256:a31a8774885b96fe825462f5d6496166f0c7cae111195b6465c801d230eb5a4e", size = 2225148, upload-time = "2026-08-18T08:52:53.736Z" }, +] + [[package]] name = "yarl" version = "1.24.5" From 09e261c55b42c15112f2f039828188ae913a8788 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 14:06:40 -0700 Subject: [PATCH 04/16] test: verify native simulation against pinned Newton --- .../2026-10-29-sysid-backends-and-solvers.md | 8 +- .../integration/test_newton_native_runtime.py | 382 ++++++++++++++++++ .../test_newton_training_runtime.py | 230 +++++++++++ 3 files changed, 616 insertions(+), 4 deletions(-) create mode 100644 tests/integration/test_newton_native_runtime.py create mode 100644 tests/integration/test_newton_training_runtime.py diff --git a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md index eec3249..f64d72c 100644 --- a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md +++ b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md @@ -86,10 +86,10 @@ Paths above are relative to `anchor_bench/`. Tests and documentation are named i **Interfaces:** Existing candidate application, `notify_model_changed`, measured-pose reset, direct/residual training replay, and CPU bias mappings remain native MuJoCo contracts. Reuse the existing `NewtonStepExecutor` public API. -- [ ] **Step 1: Add physical tests.** `test_native_mujoco_candidate_updates_change_each_world_response` uses two scalar-joint worlds and swaps candidates, asserting finite scores and swapped world responses. `test_native_mujoco_repeated_trajectory_reset_is_deterministic` evaluates A/B/A and compares repeated A, delay alignment, and buffer exclusion. `test_native_mujoco_cuda_graph_matches_eager_with_live_candidates` covers odd/even substeps, stable `state` identity, and live gain/armature/target updates. -- [ ] **Step 2: Establish the fork baseline.** Run `uv run pytest -m integration tests/integration/test_newton_native_runtime.py -q`. Add `test_native_replay_direct_and_residual_reset` and `test_offline_bias_matches_live_replay_bias` with nonzero q/qd and MuJoCo `dof_ref`; compare the latter against `mj_forward(...).qfrc_bias`. New regression tests may already pass because this is a compatibility upgrade; do not manufacture failures or change physics to make them red. -- [ ] **Step 3: Fix only demonstrated API incompatibilities.** Preserve native target arrays, modes, reset order, and `joint_target_q_start` indexing. Keep the training replay product on native MuJoCo. Warm up real graphs outside capture and restore state before measuring. -- [ ] **Step 4: Run Stage 1 acceptance.** Run the complete gate below, including existing SO-101 two-generation/six-world export-MSE and held-out accuracy assertions plus G1 residual/full-torque training. Keep SO-101 MSE tolerance `rel=1e-4, abs=1e-7`. Diagnose changed outcomes instead of lowering thresholds. GPU-only claims require observed CUDA results. +- [x] **Step 1: Add physical tests.** `test_native_mujoco_candidate_updates_change_each_world_response` uses two scalar-joint worlds and swaps candidates, asserting finite scores and swapped world responses. `test_native_mujoco_repeated_trajectory_reset_is_deterministic` evaluates A/B/A and compares repeated A, delay alignment, and buffer exclusion. `test_native_mujoco_cuda_graph_matches_eager_with_live_candidates` covers odd/even substeps, stable `state` identity, and live gain/armature/target updates. +- [x] **Step 2: Establish the fork baseline.** Run `uv run pytest -m integration tests/integration/test_newton_native_runtime.py -q`. Add `test_native_replay_direct_and_residual_reset` and `test_offline_bias_matches_live_replay_bias` with nonzero q/qd and MuJoCo `dof_ref`; compare the latter against `mj_forward(...).qfrc_bias`. New regression tests may already pass because this is a compatibility upgrade; do not manufacture failures or change physics to make them red. +- [x] **Step 3: Fix only demonstrated API incompatibilities.** Preserve native target arrays, modes, reset order, and `joint_target_q_start` indexing. Keep the training replay product on native MuJoCo. Warm up real graphs outside capture and restore state before measuring. +- [x] **Step 4: Run Stage 1 acceptance.** Run the complete gate below, including existing SO-101 two-generation/six-world export-MSE and held-out accuracy assertions plus G1 residual/full-torque training. Keep SO-101 MSE tolerance `rel=1e-4, abs=1e-7`. Diagnose changed outcomes instead of lowering thresholds. GPU-only claims require observed CUDA results. - [ ] **Step 5: Review, commit, and prepare PR 1.** Commit compatibility coverage/fixes as `test: verify native simulation against pinned Newton`. Use independent agents on native sysID versus training/bias tests with disjoint files. Review the combined branch, then prepare its own draft PR and attach it. ## PR 2: Simulator-pluggable sysID diff --git a/tests/integration/test_newton_native_runtime.py b/tests/integration/test_newton_native_runtime.py new file mode 100644 index 0000000..2e99279 --- /dev/null +++ b/tests/integration/test_newton_native_runtime.py @@ -0,0 +1,382 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Physical characterization of the native MuJoCo sysID runtime.""" + +from __future__ import annotations + +from pathlib import Path + +import newton +import numpy as np +import pytest +import warp as wp + +from anchor_bench.core.simulation import SimulationContext +from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor +from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory +from anchor_bench.tasks.actuator_sys_id.parameter_space import create_parameter_space +from anchor_bench.tasks.actuator_sys_id.simulation import NewtonPopulationEvaluator + +pytestmark = pytest.mark.integration + + +@pytest.fixture +def scalar_asset(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path: + """Author a unit-mass horizontal slider, with no contacts or downloads.""" + + monkeypatch.setattr(SimulationContext, "_instance", None) + asset = tmp_path / "slider.usda" + asset.write_text( + """#usda 1.0 +( + defaultPrim = "Slider" + metersPerUnit = 1 + upAxis = "Z" +) +def Xform "Slider" ( + prepend apiSchemas = ["PhysicsArticulationRootAPI"] +) { + def Xform "base" ( + prepend apiSchemas = ["PhysicsRigidBodyAPI", "PhysicsMassAPI"] + ) { + float physics:mass = 1 + float3 physics:diagonalInertia = (0.1, 0.1, 0.1) + } + def Xform "carriage" ( + prepend apiSchemas = ["PhysicsRigidBodyAPI", "PhysicsMassAPI"] + ) { + float physics:mass = 1 + float3 physics:diagonalInertia = (0.1, 0.1, 0.1) + } + def PhysicsFixedJoint "root" { + rel physics:body1 = + } + def PhysicsPrismaticJoint "slide" { + rel physics:body0 = + rel physics:body1 = + uniform token physics:axis = "X" + float physics:lowerLimit = -10 + float physics:upperLimit = 10 + } +} +""", + encoding="utf-8", + ) + return asset + + +def _config( + asset: Path, *, delay_ms: int = 0, buffer_time: float = 0.0 +) -> ActuatorSysIdConfig: + return ActuatorSysIdConfig.model_validate( + { + "type": "actuator_sys_id", + "joint_parameters": [ + { + "names": ["slide"], + "controller": { + "type": "pd", + "delay_duration_ms": delay_ms, + "clamps": {"effort_limit": 1000.0, "velocity_limit": 100.0}, + "stiffness": {"lower": 1.0, "upper": 100.0, "initial": 40.0}, + "damping": {"lower": 0.0, "upper": 10.0, "initial": 2.0}, + }, + "parameters": { + "armature": {"lower": 0.0, "upper": 1.0, "initial": 0.1}, + "dry_friction": {"lower": 0.0, "upper": 1.0, "initial": 0.0}, + "viscous_friction": { + "lower": 0.0, + "upper": 2.0, + "initial": 0.0, + }, + }, + } + ], + "optimizer": { + "type": "python-cmaes", + "sigma": 0.2, + "max_iterations": 1, + "epsilon": 0.001, + }, + "simulation": { + "type": "newton", + "usd_path": str(asset), + "physics_freq": 200, + "control_freq": 100, + "render_freq": 50, + "solver": { + "type": "warp_mujoco", + "solver_iterations": 10, + "line_search_iterations": 4, + }, + }, + "num_envs": 2, + "buffer_time": buffer_time, + "output_dir": str(asset.parent / "output"), + "dataset": { + "type": "parquet", + "source": "unused.parquet", + "resampling": {"type": "uniform", "dt": 0.01}, + }, + } + ) + + +def _candidate(*, stiffness: float = 40.0, armature: float = 0.1) -> Candidate: + return { + "slide": { + "stiffness": stiffness, + "damping": 2.0, + "armature": armature, + "dry_friction": 0.0, + "viscous_friction": 0.0, + } + } + + +def _trajectory(command: float, initial: float, *, samples: int = 25) -> Trajectory: + return Trajectory( + experiment=f"command={command},initial={initial}", + joint_names=["slide"], + commanded_position=np.full((samples, 1), command), + measured_position=np.full((samples, 1), initial), + ) + + +@pytest.mark.parametrize( + "alternative", + [_candidate(stiffness=80.0), _candidate(armature=0.8)], + ids=["gain", "armature"], +) +def test_native_mujoco_candidate_updates_change_each_world_response( + scalar_asset: Path, alternative: Candidate +) -> None: + # Dropping notify_model_changed, broadcasting world zero, or caching the + # first population must change these physical scores and final positions. + config = _config(scalar_asset) + with wp.ScopedDevice("cpu"): + evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + episode = _trajectory(0.6, 0.0) + # CPU Warp arrays expose borrowed NumPy storage; retain a snapshot + # before the next evaluation reuses the score buffer. + first = evaluator.evaluate([_candidate(), alternative], [episode]).copy() + first_q = evaluator._simulation_context.state.joint_q + assert first_q is not None + positions = first_q.numpy().copy() + swapped = evaluator.evaluate([alternative, _candidate()], [episode]).copy() + swapped_q = evaluator._simulation_context.state.joint_q + assert swapped_q is not None + + assert np.isfinite(first).all() and np.isfinite(swapped).all() + assert abs(first[0] - first[1]) > 1.0e-4 + assert abs(positions[0] - positions[1]) > 1.0e-3 + np.testing.assert_allclose(swapped, first[::-1], rtol=1.0e-5, atol=1.0e-8) + np.testing.assert_allclose( + swapped_q.numpy(), positions[::-1], rtol=1.0e-5, atol=1.0e-7 + ) + + +def test_native_mujoco_repeated_trajectory_reset_is_deterministic( + scalar_asset: Path, +) -> None: + # Resetting after restoring the measured pose, retaining velocity, or + # leaking solver state across episodes breaks A/B/A repeatability. + config = _config(scalar_asset, delay_ms=20, buffer_time=0.02) + with wp.ScopedDevice("cpu"): + evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + population = [_candidate(), _candidate(stiffness=80.0, armature=0.4)] + a = _trajectory(0.6, 0.23) + b = _trajectory(-0.7, -0.47, samples=13) + first = evaluator.evaluate(population, [a]).copy() + first_q = evaluator._simulation_context.state.joint_q + assert first_q is not None + positions = first_q.numpy().copy() + middle = evaluator.evaluate(population, [b]).copy() + repeated = evaluator.evaluate(population, [a]).copy() + repeated_q = evaluator._simulation_context.state.joint_q + assert repeated_q is not None + + assert np.isfinite(middle).all() + assert not np.allclose(middle, first) + np.testing.assert_allclose(repeated, first, rtol=1.0e-6, atol=1.0e-9) + np.testing.assert_allclose(repeated_q.numpy(), positions, rtol=1.0e-6, atol=1.0e-7) + + +def _native_runtime( + asset: Path, device: str +) -> tuple[ + newton.Model, newton.solvers.SolverMuJoCo, newton.Control, NewtonStepExecutor +]: + """Build a separate native runtime for explicit command scheduling.""" + + with wp.ScopedDevice(device): + template = newton.ModelBuilder() + newton.solvers.SolverMuJoCo.register_custom_attributes(template) + template.add_usd(str(asset), floating=False) + index = next( + i + for i, label in enumerate(template.joint_label) + if label.endswith("/slide") + ) + dof = template.joint_qd_start[index] + template.joint_target_mode[dof] = int(newton.JointTargetMode.POSITION) + template.joint_target_ke[dof] = 40.0 + template.joint_target_kd[dof] = 2.0 + template.joint_armature[dof] = 0.1 + template.joint_effort_limit[dof] = 1000.0 + template.joint_velocity_limit[dof] = 100.0 + builder = newton.ModelBuilder() + newton.solvers.SolverMuJoCo.register_custom_attributes(builder) + builder.replicate(template, copy_count=2) + model = builder.finalize() + solver = newton.solvers.SolverMuJoCo( + model, + solver="newton", + integrator="implicitfast", + iterations=10, + ls_iterations=4, + ) + control = model.control() + executor = NewtonStepExecutor( + model=model, + solver=solver, + state=model.state(), + state_next=model.state(), + control=control, + contacts=None, + ) + return model, solver, control, executor + + +def _reset_native( + model: newton.Model, + solver: newton.solvers.SolverMuJoCo, + executor: NewtonStepExecutor, + *, + q: float, + qd: float = 0.0, +) -> None: + solver.reset(executor.state) + for state in (executor.state, executor.state_next): + assert state.joint_q is not None and state.joint_qd is not None + state.joint_q.assign(np.full(2, q, dtype=np.float32)) + state.joint_qd.assign(np.full(2, qd, dtype=np.float32)) + newton.eval_fk(model, state.joint_q, state.joint_qd, state) + + +def test_native_mujoco_delay_and_buffer_match_explicit_physical_rollout( + scalar_asset: Path, +) -> None: + # An off-by-one delay, scoring the warmup prefix, or scoring the final + # unused command fails against this literal six-transition schedule. + config = _config(scalar_asset, delay_ms=20, buffer_time=0.02) + episode = Trajectory( + experiment="two-step-delay", + joint_names=["slide"], + commanded_position=np.array( + [[0.3], [-0.2], [0.5], [0.1], [-0.4], [0.2], [9.0]] + ), + measured_position=np.array( + [[0.15], [19.0], [-13.0], [0.3], [-0.15], [0.05], [-0.2]] + ), + ) + with wp.ScopedDevice("cpu"): + evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + scores = evaluator.evaluate([_candidate(), _candidate()], [episode]) + model, solver, control, executor = _native_runtime(scalar_asset, "cpu") + _reset_native(model, solver, executor, q=0.15) + assert control.joint_target_q is not None + positions = [] + for target in [0.3, 0.3, 0.3, -0.2, 0.5, 0.1]: + control.joint_target_q.assign(np.full(2, target, dtype=np.float32)) + executor.step(dt=0.01, substeps=2) + assert executor.state.joint_q is not None + positions.append(executor.state.joint_q.numpy().copy()) + + # The first two transitions are deliberately huge measurement outliers. + expected = np.mean( + np.square( + np.asarray(positions)[2:] - np.array([0.3, -0.15, 0.05, -0.2])[:, None] + ), + axis=0, + ) + assert np.isfinite(expected).all() and np.all(expected > 0.01) + np.testing.assert_allclose(scores, expected, rtol=1.0e-5, atol=1.0e-8) + + +@pytest.mark.parametrize("substeps", [3, 4], ids=["odd", "even"]) +def test_native_mujoco_cuda_graph_matches_eager_with_live_candidates( + scalar_asset: Path, substeps: int +) -> None: + # Frozen capture-time properties/targets, swapped state identities, or an + # omitted odd-step copy fail against an independent eager native solver. + devices = wp.get_cuda_devices() + if not devices: + pytest.skip( + "Warp detected no CUDA device; native CUDA graph coverage requires CUDA" + ) + device = devices[0].alias + eager = _native_runtime(scalar_asset, device) + captured = _native_runtime(scalar_asset, device) + for model, solver, control, executor in (eager, captured): + assert model.device.is_cuda and not solver.use_mujoco_cpu + assert control.joint_target_q is not None + control.joint_target_q.assign(np.array([0.6, -0.2], dtype=np.float32)) + # Compile and allocate outside capture, then restore physical state. + for _ in range(2): + executor.step(dt=0.01, substeps=substeps) + _reset_native(model, solver, executor, q=0.15, qd=0.2) + + graph_executor = captured[3] + canonical = graph_executor.state + graph_executor.capture_graph(dt=0.01, substeps=substeps) + assert graph_executor._graph is not None + previous = None + for gains, armatures, targets in [ + ([40.0, 40.0], [0.1, 0.1], [0.6, -0.2]), + ([80.0, 10.0], [0.1, 0.1], [0.6, -0.2]), + ([80.0, 10.0], [0.8, 1.0], [0.6, -0.2]), + ([80.0, 10.0], [0.8, 1.0], [-0.5, 0.4]), + ]: + results = [] + for model, solver, control, executor in (eager, captured): + assert model.joint_target_ke is not None + assert model.joint_armature is not None + assert control.joint_target_q is not None + model.joint_target_ke.assign(np.asarray(gains, dtype=np.float32)) + model.joint_armature.assign(np.asarray(armatures, dtype=np.float32)) + control.joint_target_q.assign(np.asarray(targets, dtype=np.float32)) + solver.notify_model_changed( + newton.ModelFlags.JOINT_DOF_PROPERTIES + | newton.ModelFlags.ACTUATOR_PROPERTIES + ) + _reset_native(model, solver, executor, q=0.15, qd=0.2) + states = [] + for _ in range(12): + if executor is graph_executor: + executor.step(dt=0.01, substeps=substeps) + else: + # Independent eager one-substep intervals expose an odd + # interval that forgets to restore the canonical buffer. + for _ in range(substeps): + executor.step(dt=0.01 / substeps, substeps=1) + assert executor.state.joint_q is not None + assert executor.state.joint_qd is not None + states.append( + np.stack( + ( + executor.state.joint_q.numpy(), + executor.state.joint_qd.numpy(), + ) + ) + ) + if executor is graph_executor: + assert executor.state is canonical + results.append(np.asarray(states)) + assert np.isfinite(results).all() + np.testing.assert_allclose(results[1], results[0], rtol=2.0e-5, atol=2.0e-6) + if previous is not None: + assert np.all(np.abs(results[1][-1, 0] - previous) > 1.0e-4) + previous = results[1][-1, 0].copy() diff --git a/tests/integration/test_newton_training_runtime.py b/tests/integration/test_newton_training_runtime.py new file mode 100644 index 0000000..23ce264 --- /dev/null +++ b/tests/integration/test_newton_training_runtime.py @@ -0,0 +1,230 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Physical regressions for native training replay and bias features.""" + +from __future__ import annotations + +from importlib import import_module +from types import SimpleNamespace +from typing import Any + +import newton +import numpy as np +import pandas as pd +import pytest +import warp as wp +from newton.solvers import SolverMuJoCo + +from anchor_bench.core.simulation import SimulationContext +from anchor_bench.tasks.train.data_processors.gru import DynamicBiasDataProcessor +from anchor_bench.tasks.train.validators.newton_replay_adapter import ( + _NewtonReplayAdapter, +) + +pytestmark = pytest.mark.integration + + +class _CPUMuJoCo(SolverMuJoCo): + """Select real CPU MuJoCo at replay's solver-construction boundary.""" + + def __init__(self, model: newton.Model, **options: Any) -> None: + options["use_mujoco_cpu"] = True + super().__init__(model, **options) + + +def _context(*, device: str, coupled: bool = False) -> SimpleNamespace: + """Build articulated scalar joints without imports or downloaded assets.""" + + gravity = (0.0, -9.81, 0.0) if coupled else (0.0, 0.0, 0.0) + builder = newton.ModelBuilder(gravity=gravity) + SolverMuJoCo.register_custom_attributes(builder) + first = builder.add_link( + com=wp.vec3(0.3, 0.0, 0.0), + mass=2.0, + inertia=wp.mat33(0.02, 0.0, 0.0, 0.0, 0.02, 0.0, 0.0, 0.0, 0.02), + ) + shoulder = builder.add_joint_revolute( + parent=-1, + child=first, + axis=newton.Axis.Z, + label="shoulder", + target_ke=12.0, + target_kd=0.8, + armature=0.1, + friction=0.0, + damping=0.0, + actuator_mode=newton.JointTargetMode.POSITION, + ) + joints = [shoulder] + if coupled: + second = builder.add_link( + com=wp.vec3(0.25, 0.0, 0.0), + mass=1.0, + inertia=wp.mat33(0.01, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.01), + ) + joints.append( + builder.add_joint_revolute( + parent=first, + child=second, + parent_xform=wp.transform(wp.vec3(0.6, 0.0, 0.0), wp.quat_identity()), + axis=newton.Axis.Z, + label="elbow", + armature=0.1, + ) + ) + builder.add_articulation(joints) + model = builder.finalize(device=device) + if coupled: + mujoco_attributes = getattr(model, "mujoco", None) + assert mujoco_attributes is not None + mujoco_attributes.dof_ref.assign(np.array([0.37, -0.28], dtype=np.float32)) + return SimpleNamespace(model=model, state=model.state()) + + +@pytest.mark.parametrize("backend", ["cpu", "cuda"]) +@pytest.mark.parametrize("substeps", [1, 2]) +@pytest.mark.parametrize("residual", [False, True], ids=["direct", "residual"]) +def test_native_replay_direct_and_residual_reset( + monkeypatch: pytest.MonkeyPatch, + backend: str, + substeps: int, + residual: bool, +) -> None: + """Catch duplicated native PD, lost residual PD, and stale reset state.""" + + if backend == "cuda" and not wp.is_cuda_available(): + pytest.skip("Native MuJoCo Warp replay requires an available CUDA device.") + if backend == "cpu": + monkeypatch.setattr(newton.solvers, "SolverMuJoCo", _CPUMuJoCo) + context = _context(device="cpu" if backend == "cpu" else "cuda:0") + original_mode = context.model.joint_target_mode.numpy().copy() + original_ke = context.model.joint_target_ke.numpy().copy() + original_kd = context.model.joint_target_kd.numpy().copy() + adapter = _NewtonReplayAdapter( + context, + output_joints=("shoulder",), + residual=residual, + substeps=substeps, + disable_contacts=True, + ) + + def rollout(command: float, effort: float) -> np.ndarray: + initial = adapter.reset( + position={"shoulder": 0.25}, + velocity={"shoulder": -0.1}, + command={"shoulder": command}, + ) + assert initial.position["shoulder"] == pytest.approx(0.25) + assert initial.velocity["shoulder"] == pytest.approx(-0.1) + values = [] + for _ in range(20): + state = adapter.step( + command={"shoulder": command}, + effort={"shoulder": effort}, + dt=0.005, + ) + values.append([state.position["shoulder"], state.velocity["shoulder"]]) + result = np.asarray(values) + assert np.isfinite(result).all() + return result + + try: + forward = rollout(0.8, 0.3) + backward = rollout(-0.4, 0.3) + repeated = rollout(0.8, 0.3) + np.testing.assert_allclose(repeated, forward, rtol=1e-6, atol=1e-7) + if residual: + assert forward[-1, 0] > backward[-1, 0] + 0.05 + np.testing.assert_array_equal( + context.model.joint_target_mode.numpy(), original_mode + ) + else: + np.testing.assert_allclose(forward, backward, rtol=1e-6, atol=1e-7) + unforced = rollout(0.8, 0.0) + assert forward[-1, 1] > unforced[-1, 1] + 0.05 + np.testing.assert_array_equal(context.model.joint_target_ke.numpy(), [0.0]) + np.testing.assert_array_equal(context.model.joint_target_kd.numpy(), [0.0]) + finally: + adapter.close() + np.testing.assert_array_equal( + context.model.joint_target_mode.numpy(), original_mode + ) + np.testing.assert_array_equal(context.model.joint_target_ke.numpy(), original_ke) + np.testing.assert_array_equal(context.model.joint_target_kd.numpy(), original_kd) + + +def test_offline_bias_matches_live_replay_bias( + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Catch missing dof_ref, velocity, joint mapping, or stale bias caching.""" + + mujoco = import_module("mujoco") + monkeypatch.setattr(newton.solvers, "SolverMuJoCo", _CPUMuJoCo) + context = _context(device="cpu", coupled=True) + monkeypatch.setattr(SimulationContext, "current", classmethod(lambda cls: context)) + # Reverse dataset order relative to model order to expose mapping mistakes. + dataset = pd.DataFrame( + { + "elbow/actual_q": [-0.45, 0.6, -0.45], + "elbow/actual_dq": [1.3, -0.9, 1.3], + "shoulder/actual_q": [0.4, -0.7, 0.4], + "shoulder/actual_dq": [0.8, -1.1, 0.8], + }, + index=pd.Index(["first", "different", "repeat"], name="sample"), + ) + offline = DynamicBiasDataProcessor(dataset).process() + assert offline.index.equals(dataset.index) + assert offline.columns.tolist() == ["elbow/qfrc_bias", "shoulder/qfrc_bias"] + reference_solver = SolverMuJoCo( + context.model, use_mujoco_cpu=True, disable_contacts=True + ) + reference_model = reference_solver.mj_model + reference_data = mujoco.MjData(reference_model) + names = ("shoulder", "elbow") + references = dict(zip(names, [0.37, -0.28], strict=True)) + addresses = {} + for name in names: + joint_id = mujoco.mj_name2id(reference_model, mujoco.mjtObj.mjOBJ_JOINT, name) + assert joint_id >= 0 + addresses[name] = ( + int(reference_model.jnt_qposadr[joint_id]), + int(reference_model.jnt_dofadr[joint_id]), + ) + adapter = _NewtonReplayAdapter( + context, + output_joints=names, + residual=True, + substeps=1, + disable_contacts=True, + ) + try: + for row_label, row in dataset.iterrows(): + positions = {name: float(row[f"{name}/actual_q"]) for name in names} + velocities = {name: float(row[f"{name}/actual_dq"]) for name in names} + state = adapter.reset(position=positions, velocity=velocities, command={}) + mujoco.mj_resetData(reference_model, reference_data) + for name, (q_address, dof_address) in addresses.items(): + reference_data.qpos[q_address] = positions[name] + references[name] + reference_data.qvel[dof_address] = velocities[name] + mujoco.mj_forward(reference_model, reference_data) + expected = reference_data.qfrc_bias.copy() + assert np.isfinite(expected).all() + for name, (_, dof_address) in addresses.items(): + assert offline.loc[row_label, f"{name}/qfrc_bias"] == pytest.approx( + expected[dof_address], rel=1e-6, abs=1e-6 + ) + assert adapter.dynamic_bias(name, state) == pytest.approx( + expected[dof_address], rel=1e-6, abs=1e-6 + ) + # This coupled fixture must exercise velocity-dependent bias as well. + reference_data.qvel[:] = 0.0 + mujoco.mj_forward(reference_model, reference_data) + assert np.max(np.abs(reference_data.qfrc_bias - expected)) > 0.01 + for name, (q_address, _) in addresses.items(): + reference_data.qpos[q_address] = positions[name] + reference_data.qvel[addresses[name][1]] = velocities[name] + mujoco.mj_forward(reference_model, reference_data) + assert np.max(np.abs(reference_data.qfrc_bias - expected)) > 0.1 + finally: + adapter.close() From 70a527d51aff9e75d0b26fe9317bce00e3bfa65d Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 14:07:25 -0700 Subject: [PATCH 05/16] docs: record pinned runtime stage validation --- .../plans/2026-10-29-sysid-backends-and-solvers.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md index f64d72c..4982f2f 100644 --- a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md +++ b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md @@ -68,6 +68,8 @@ Paths above are relative to `anchor_bench/`. Tests and documentation are named i ## PR 1: Pinned Newton runtime +Implemented in [draft PR #174](https://github.com/NVIDIA/anchor-bench/pull/174). All 334 unit and integration tests passed, including CPU/CUDA physical regressions and existing SO-101/G1 workflows; lint, formatting, type checks, and independent reviews passed. Later stages remain pending acceptance of this stage. + ### Task 1: Pin the fork and migrate model construction **Files:** Modify `pyproject.toml`, `uv.lock`, `THIRD_PARTY_LICENSES.md`, `anchor_bench/core/simulation/newton.py`, `tests/test_newton_simulation_context.py`, `tests/integration/usd_trajectory.py`, `docs/system-identification.md`. @@ -90,7 +92,7 @@ Paths above are relative to `anchor_bench/`. Tests and documentation are named i - [x] **Step 2: Establish the fork baseline.** Run `uv run pytest -m integration tests/integration/test_newton_native_runtime.py -q`. Add `test_native_replay_direct_and_residual_reset` and `test_offline_bias_matches_live_replay_bias` with nonzero q/qd and MuJoCo `dof_ref`; compare the latter against `mj_forward(...).qfrc_bias`. New regression tests may already pass because this is a compatibility upgrade; do not manufacture failures or change physics to make them red. - [x] **Step 3: Fix only demonstrated API incompatibilities.** Preserve native target arrays, modes, reset order, and `joint_target_q_start` indexing. Keep the training replay product on native MuJoCo. Warm up real graphs outside capture and restore state before measuring. - [x] **Step 4: Run Stage 1 acceptance.** Run the complete gate below, including existing SO-101 two-generation/six-world export-MSE and held-out accuracy assertions plus G1 residual/full-torque training. Keep SO-101 MSE tolerance `rel=1e-4, abs=1e-7`. Diagnose changed outcomes instead of lowering thresholds. GPU-only claims require observed CUDA results. -- [ ] **Step 5: Review, commit, and prepare PR 1.** Commit compatibility coverage/fixes as `test: verify native simulation against pinned Newton`. Use independent agents on native sysID versus training/bias tests with disjoint files. Review the combined branch, then prepare its own draft PR and attach it. +- [x] **Step 5: Review, commit, and prepare PR 1.** Commit compatibility coverage/fixes as `test: verify native simulation against pinned Newton`. Use independent agents on native sysID versus training/bias tests with disjoint files. Review the combined branch, then prepare its own draft PR and attach it. ## PR 2: Simulator-pluggable sysID From 147308cca0b27a2f50948c9fca895e40e809916a Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 14:10:10 -0700 Subject: [PATCH 06/16] docs: keep feature planning outside the pull request --- .../2026-10-29-sysid-backends-and-solvers.md | 278 ------------- ...10-29-sysid-backends-and-solvers-design.md | 387 ------------------ 2 files changed, 665 deletions(-) delete mode 100644 docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md delete mode 100644 docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md diff --git a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md b/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md deleted file mode 100644 index 4982f2f..0000000 --- a/docs/superpowers/plans/2026-10-29-sysid-backends-and-solvers.md +++ /dev/null @@ -1,278 +0,0 @@ -# Pluggable sysID Backends and Newton Solvers Implementation Plan - -> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. - -**Goal:** Deliver simulator-pluggable sysID, general Newton solver settings, and VBD with external implicit PD, bias prediction, and effort clamping through five separate PRs. - -**Architecture:** Keep model/state ownership in `SimulationContext` and backend-specific population evaluation behind `PopulationEvaluator`. Put Newton solver construction and preparation beneath `NewtonSimulationContext`; use Newton's actuator and solver lifecycle APIs rather than a universal physics-array interface. - -**Tech Stack:** Python >=3.10, Pydantic 2, Newton fork `1.8.0.dev0`, Warp >=1.17.0, MuJoCo/MuJoCo Warp ~=3.16.0, Optuna/CMA-ES, OpenUSD, pytest, uv. - -**Spec:** [Approved design](../specs/2026-10-29-sysid-backends-and-solvers-design.md). - -## Global Constraints - -- Pin `https://github.com/skulkar22/newton`, branch provenance `dev/rigid-vbd-integration`, exact revision `1e5036c48ec92d44782dfe0f448dc25d64984b58`. Never substitute a moving branch head. -- Preserve existing MuJoCo configuration and native-actuation behavior. -- Supported new matrix: MuJoCo/native, MuJoCo/external implicit, VBD/external implicit. VBD/native fails before optimization. -- External mode uses `JointSpaceResponse.refresh(state)` for both solvers, gravity plus Coriolis as `bias_force`, and `ClampingMaxEffort` inside the implicit solve. Ignore velocity limiting. -- Use one coupled actuator over the identified DOFs; do not split coupled coordinates into independent scalar actuator solves. Keep worlds isolated. -- Unknown, internally managed, and demonstrably ignored options warn once; replace their values with `"NOT SET: "` in runtime provenance. Preserve input configuration. Constructor errors for accepted settings remain errors. -- No MPM, real second simulator, explicit external PD, generic YAML model-attribute overrides, new replay CLI, or training-validator feature expansion. -- Preserve command-delay indexing, buffer exclusion, canonical state identity, native Newton USD outputs, and common result files. -- Use `vidur/` branches, authenticated `gh` for GitHub operations, and no attribution or co-author trailers to automated tools. -- All new/touched code headers use the 2026 repository licensing header. Run the repository gates before committing applicable code/dependency changes, including the complete unit/integration gate for shared infrastructure and dependency commits. A later stage's planned checks cannot justify an earlier unchecked commit. - -## Review Focus - -1. Plugin-only settings must survive strict parsing, serialization, configuration hashing, and tracking; test this in Task 3. -2. A recognized but invalid constructor argument must not be mislabeled as an ignored typo; test actual constructor failure and duplicate aliases in Task 5. -3. New solver/model configuration must not silently reuse a process singleton or stale captured graph; test this in Tasks 3 and 6. -4. Candidate gains and armature must affect captured implicit control without duplicate native PD; test this in Tasks 7 and 8. -5. Trajectory resets must discard solver/contact/actuator history, preserve full turns, and retain bias updates; test this in Tasks 8 and 9. - -## Delivery and parallel execution - -| PR | Branch | Tasks | Mergeable outcome | -| --- | --- | --- | --- | -| 1 | `vidur/sysid-newton-pin` | 1–2 | Existing native workflows run on the pinned fork. | -| 2 | `vidur/sysid-backends` | 3–4 | An installed test backend runs sysID without Newton model construction or USD-only output. | -| 3 | `vidur/sysid-solver-settings` | 5–6 | MuJoCo uses the solver factory and general settings with compact runtime provenance. | -| 4 | `vidur/sysid-implicit-pd` | 7–8 | External implicit MuJoCo PD includes coupled response, bias, and effort limits. | -| 5 | `vidur/sysid-vbd` | 9 | VBD sysID, example, and fitted-model replay work through the same backend. | - -Execute and review one PR stage at a time. The first product branch includes the approved design/plan commits; later stages start from the accepted preceding stage. Do not merge PRs automatically or implement later stages against unreviewed API assumptions. - -Parallel agents are explicitly requested. Assign disjoint file ownership within a stage and parallelize independent research, regression work, and review. The controller owns dependency files and integration. Tasks sharing an interface or source file wait for that interface to land; do not run all five stages as concurrent edits. Reuse a suitable clean checkout; additional worktrees are only needed if isolation actually requires them, using the native worktree workflow. - -At each stage finish, run the applicable gates, obtain independent code review, create a concrete draft PR with `gh`, and attach its URL to the task. PR titles/descriptions describe that stage only. A stage is not complete merely because a plan checkbox is checked. - -## File and interface map - -| File | Responsibility | -| --- | --- | -| `core/simulation/__init__.py` | Simulator-neutral resource identity and lazy model/state ownership. | -| `core/simulation/registry.py` | Authoritative backend registrations, sysID capability, and installed-provider discovery. | -| `schema/simulation.py` (new) | Shared sysID timing configuration and Newton-specific simulation/solver configuration. | -| `tasks/actuator_sys_id/backends/newton.py` (new) | Lazy Newton context/evaluator/export/provenance adapters. | -| `tasks/actuator_sys_id/task.py` | Select backend, optimize, request optional export and runtime description. | -| `tasks/actuator_sys_id/artifacts.py`, `model.py` | Common outputs and optional backend model artifacts. | -| `core/simulation/newton_options.py` (new) | Recognize public construction options and record skipped settings. | -| `core/simulation/newton_solvers.py` (new) | Newton solver descriptors, preparation, and owned resources. | -| `core/simulation/newton.py`, `newton_stepper.py` | Newton model lifecycle, canonical stepping, capture, and reset coordination. | -| `tasks/actuator_sys_id/newton_actuation.py` (new) | Coupled external implicit actuator, bias, live parameters, and history. | -| `tasks/actuator_sys_id/newton_capabilities.py` (new) | Validate VBD mode/joint/candidate/model capability combinations. | -| `tasks/actuator_sys_id/simulation.py`, `usd.py` | Newton evaluation and fitted USD semantics. | - -Paths above are relative to `anchor_bench/`. Tests and documentation are named in their owning tasks below. Keep existing imports available through re-exports where the original name is public. - -## PR 1: Pinned Newton runtime - -Implemented in [draft PR #174](https://github.com/NVIDIA/anchor-bench/pull/174). All 334 unit and integration tests passed, including CPU/CUDA physical regressions and existing SO-101/G1 workflows; lint, formatting, type checks, and independent reviews passed. Later stages remain pending acceptance of this stage. - -### Task 1: Pin the fork and migrate model construction - -**Files:** Modify `pyproject.toml`, `uv.lock`, `THIRD_PARTY_LICENSES.md`, `anchor_bench/core/simulation/newton.py`, `tests/test_newton_simulation_context.py`, `tests/integration/usd_trajectory.py`, `docs/system-identification.md`. - -**Interfaces:** Preserve `NewtonSimulationContext(usd_path: str, *, fixed_base: bool=False)` and `initialize(world_count=...)`. Internally use `builder.replicate(template, copy_count=world_count)` and an owned `CollisionPipeline(model, broad_phase="explicit")` with `pipeline.contacts()`. - -- [x] **Step 1: Write migration regressions.** Extend `test_initializes_one_configurable_replicated_simulation` and `test_lazily_builds_one_newton_model_and_state`: record `copy_count`, one pipeline, contacts identity, attributes registered before import/finalize, and unchanged MuJoCo options. Have fakes reject the deprecated `world_count` replicate keyword and deprecated `model.contacts()` path. -- [x] **Step 2: Run the red tests.** `uv run pytest tests/test_newton_simulation_context.py -q`; require failures at the old construction calls. Record dependency/version availability separately rather than mistaking installation failure for a behavioral red test. -- [x] **Step 3: Pin and migrate.** Set the dependency to `newton[importers,sim] @ git+https://github.com/skulkar22/newton.git@1e5036c48ec92d44782dfe0f448dc25d64984b58`; run `uv lock` and `uv sync --locked --extra dev`. Use the public construction APIs above; remove the obsolete `newton.use_coord_layout_targets` assignment from the integration helper. Do not add external collision stepping to native MuJoCo. -- [x] **Step 4: Verify resolution and tests.** Run `uv lock --check`, the Task 1 tests, and inspect Newton's installed `direct_url.json`: `vcs_info.commit_id` must equal the full SHA and package version must be `1.8.0.dev0`. Keep importer/sim extras. Resolve root constraints for Warp >=1.17.0, MuJoCo/MJWarp ~=3.16.0, and schemas >=0.5.0; update affected third-party version/source rows from the actual lock. Do not assume the dependency's uv index settings propagate to the root. -- [x] **Step 5: Gate and commit.** Run the applicable lint/type gates plus targeted construction tests. Commit as `build: pin Newton rigid VBD integration revision` including migration and license-manifest changes. Do not expose VBD or change native actuation in this task. - -### Task 2: Verify real native sysID, replay, and training on the fork - -**Files:** Create `tests/integration/test_newton_native_runtime.py`; extend `tests/test_newton_replay_adapter.py` or its real-runtime integration counterparts; modify `anchor_bench/tasks/train/validators/newton_replay_adapter.py`, `anchor_bench/tasks/train/data_processors/gru.py`, `anchor_bench/core/simulation/newton_stepper.py`, and `anchor_bench/tasks/actuator_sys_id/simulation.py` only for demonstrated fork incompatibilities. Preserve existing SO-101/G1 integration assertions. - -**Interfaces:** Existing candidate application, `notify_model_changed`, measured-pose reset, direct/residual training replay, and CPU bias mappings remain native MuJoCo contracts. Reuse the existing `NewtonStepExecutor` public API. - -- [x] **Step 1: Add physical tests.** `test_native_mujoco_candidate_updates_change_each_world_response` uses two scalar-joint worlds and swaps candidates, asserting finite scores and swapped world responses. `test_native_mujoco_repeated_trajectory_reset_is_deterministic` evaluates A/B/A and compares repeated A, delay alignment, and buffer exclusion. `test_native_mujoco_cuda_graph_matches_eager_with_live_candidates` covers odd/even substeps, stable `state` identity, and live gain/armature/target updates. -- [x] **Step 2: Establish the fork baseline.** Run `uv run pytest -m integration tests/integration/test_newton_native_runtime.py -q`. Add `test_native_replay_direct_and_residual_reset` and `test_offline_bias_matches_live_replay_bias` with nonzero q/qd and MuJoCo `dof_ref`; compare the latter against `mj_forward(...).qfrc_bias`. New regression tests may already pass because this is a compatibility upgrade; do not manufacture failures or change physics to make them red. -- [x] **Step 3: Fix only demonstrated API incompatibilities.** Preserve native target arrays, modes, reset order, and `joint_target_q_start` indexing. Keep the training replay product on native MuJoCo. Warm up real graphs outside capture and restore state before measuring. -- [x] **Step 4: Run Stage 1 acceptance.** Run the complete gate below, including existing SO-101 two-generation/six-world export-MSE and held-out accuracy assertions plus G1 residual/full-torque training. Keep SO-101 MSE tolerance `rel=1e-4, abs=1e-7`. Diagnose changed outcomes instead of lowering thresholds. GPU-only claims require observed CUDA results. -- [x] **Step 5: Review, commit, and prepare PR 1.** Commit compatibility coverage/fixes as `test: verify native simulation against pinned Newton`. Use independent agents on native sysID versus training/bias tests with disjoint files. Review the combined branch, then prepare its own draft PR and attach it. - -## PR 2: Simulator-pluggable sysID - -### Task 3: Generalize resources and register typed backend capabilities - -**Files:** Modify `anchor_bench/core/simulation/__init__.py`, `newton.py`, `registry.py`, `anchor_bench/schema/actuator_sys_id.py`, `anchor_bench/tasks/actuator_sys_id/model.py`, `anchor_bench/errors.py`; create `anchor_bench/schema/simulation.py`, `tests/test_simulation_context.py`, `tests/test_sysid_backends.py`; extend `tests/test_actuator_sys_id_config.py`, `tests/test_simulation_registry.py`, and test-only context subclasses in `tests/test_newton_simulation_context.py`, `tests/test_data_processors.py`, `tests/test_data_processor_runner.py`. Make package initializers lazy only where needed to remove import cycles. - -**Interfaces:** - -```python -SimulationContext.__new__(cls, *, resource_key: Hashable) -> Self -SimulationContext.__init__(self, *, resource_key: Hashable) -> None -SimulationContext.resource_key -> Hashable -SimulationContext._load(self) -> tuple[ModelT, StateT] -``` - -Move file resolution/validation, `usd_path`, and `fixed_base` to `NewtonSimulationContext`; its existing public constructor calls the base with `(resolved_path, fixed_base)`. Preserve the existing training adapter `create_simulation_context(backend, usd_path, *, fixed_base=False)`. - -Define `SysIdSimulationConfig(type: str, physics_freq, control_freq, render_freq)` with common timing validation. Move `WarpMujocoSolverConfig` and `NewtonSimulationConfig` to the neutral schema module and re-export their old names; Newton's config extends the common model with `type: Literal["newton"]`, `usd_path`, and existing solver fields. `ActuatorSysIdConfig.simulation` uses `SerializeAsAny[SysIdSimulationConfig]` and registered strict dispatch before validation. Add frozen `IdentifiedModelArtifact(path: Path, format: str)` to `model.py` now so registry annotations are defined before Task 4 consumes them. - -In `core/simulation/registry.py` define frozen `SimulationBackend(name, context_type, sysid: SysIdBackend|None)` and `SysIdBackend(config_model, create_context, create_evaluator, export_model=None, describe_runtime=None)`. Factories have these signatures: - -```python -create_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any] -create_evaluator(config: ActuatorSysIdConfig, space: ParameterSpace, - context: SimulationContext[Any, Any]) -> PopulationEvaluator -export_model(config: ActuatorSysIdConfig, best: Candidate, - context: SimulationContext[Any, Any], output: Path - ) -> IdentifiedModelArtifact | None -describe_runtime(evaluator: PopulationEvaluator) -> Mapping[str, JsonValue] -register_simulation_backend(registration: SimulationBackend) -> None -get_sysid_backend(name: str) -> SysIdBackend -discover_sysid_backends() -> None -``` - -`JsonValue` is Pydantic's public recursive JSON-compatible alias, re-exported by the neutral schema module. Use postponed annotations and `TYPE_CHECKING` to avoid schema/registry/task cycles. - -- [ ] **Step 1: Write boundary tests.** `test_path_free_context_loads_once` constructs `ToyContext(resource_key=("toy", 2))` without a file and asserts model/state cache identity. Add incompatible-class/key and unhashable-key cases. `test_plugin_simulation_roundtrips_without_losing_fields` validates a typed toy config, rejects extras/wrong types, preserves fields through JSON and config hashing, and detects changed plugin values. -- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_simulation_context.py tests/test_sysid_backends.py tests/test_actuator_sys_id_config.py -q`; require missing neutral-resource/registration behavior to fail. -- [ ] **Step 3: Implement atomic registration and discovery.** Entry-point group is `anchor_bench.sysid_backends`; providers are zero-argument callables returning `SimulationBackend`. Sort names, reject duplicate metadata names before loading, require entry-point and registration names to match, reject duplicate built-in/Python names, and wrap errors in `SimulationBackendError(AnchorBenchError)`. Discover before both direct `model_validate` and YAML parsing; mark discovery successful only after all registrations validate. A context factory returning the wrong concrete registered type is an error. -- [ ] **Step 4: Verify shared-resource compatibility.** Add `test_discovery_is_idempotent`, `test_discovery_error_does_not_leave_partial_registration`, `test_registered_backend_without_sysid_fails_early`, and repeated singleton-incompatibility tests. Run all Task 3 files plus data-processor/context tests. Imports must not construct Newton objects or import the sysID task from the neutral registry. -- [ ] **Step 5: Gate and commit.** Run lint/format/type checks and Task 3 tests; commit as `refactor: register simulation resources and sysid capabilities`. - -### Task 4: Dispatch evaluation, isolate export, and prove installed-plugin CLI use - -**Files:** Create `anchor_bench/tasks/actuator_sys_id/backends/__init__.py`, `backends/newton.py`, `tests/integration/test_sysid_backend_cli.py`, and `tests/fixtures/sysid_backend/`; modify `task.py`, `simulation.py`, `artifacts.py`, `model.py` in that task package, `tests/test_actuator_sys_id_task.py`, and `docs/system-identification.md`. - -**Interfaces:** Consume Task 3's `IdentifiedModelArtifact`. Add `identified_model_path: Path|None` and retain optional `identified_usd_path` in `SysIdResult`; explicitly declared format `"usd"` supplies the compatibility path, never suffix inference. Extend the existing `write_artifacts(..., config, model_artifact: IdentifiedModelArtifact|None=None, runtime_simulation: Mapping[str,JsonValue]|None=None)` signature. It never imports `usd.py`. Newton's export callback invokes the existing USD writer and returns `format="usd"`. - -Preserve `PopulationEvaluator.evaluate` as its only required method. Newton's factory injects the selected context into `NewtonPopulationEvaluator(config, space, *, simulation_context=None)`; preserve its existing two-positional-argument use. The task selects one backend and context, constructs the evaluator, optimizes, invokes its optional exporter/runtime description, and writes common artifacts. - -- [ ] **Step 1: Write orchestration/export regressions.** `test_task_uses_registered_evaluator_and_context` asserts selected factories receive the same context and optimizer behavior remains unchanged. Parameterize `test_common_artifacts_allow_missing_or_json_model_export`; assert optional result paths and no forced USD import. `test_export_failure_prevents_completion` asserts no `.completed` marker after exporter failure. -- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_actuator_sys_id_task.py tests/test_sysid_backends.py -q`; require the hardcoded Newton task/export path to fail toy-backend expectations. -- [ ] **Step 3: Implement the lazy Newton adapter and generic task path.** Re-export moved Newton config names for existing callers. Keep common scores, history, MLOps upload/completion ordering, delay, and datasets unchanged. A missing sysID capability must fail before constructing the optimizer or evaluating a population. -- [ ] **Step 4: Prove real installed discovery.** The integration fixture writes an importable toy package and `.dist-info/METADATA` plus `entry_points.txt` into `tmp_path`, then launches a fresh CLI subprocess with that path. Use real Parquet and CMA-ES; guard Newton context/model construction to raise. Assert plugin-specific config values survive, scores are finite/repeatable, common outputs complete, JSON export appears, and `identified.usda` does not. Repeat with no exporter. Run `uv run pytest -m integration tests/integration/test_sysid_backend_cli.py tests/integration/so101_actuator_sysid/test_cli.py -q`. -- [ ] **Step 5: Gate, commit, review, and prepare PR 2.** Run the full gate; document the Python registration API and entry-point provider contract. Commit as `feat: run sysid through registered simulator backends` and prepare the separate PR. - -## PR 3: General solver settings - -### Task 5: Resolve constructor settings and preserve legacy MuJoCo YAML - -**Files:** Create `anchor_bench/core/simulation/newton_options.py`, `newton_solvers.py`, `tests/test_newton_solver_options.py`, `tests/test_newton_solvers.py`; modify `anchor_bench/schema/simulation.py` and solver-config tests. - -**Interfaces:** Define frozen `OptionResolution(kwargs: dict[str, object], recorded: dict[str, JsonValue])` and: - -```python -resolve_constructor_options(constructor: Callable[..., object], - requested: Mapping[str, JsonValue], *, path: str, - managed: frozenset[str], - enum_converters: Mapping[str, Callable[[JsonValue], object]], - ignored: Mapping[str, str]) -> OptionResolution -get_newton_solver(name: str) -> NewtonSolverDescriptor -resolve_newton_solver_settings(config: NewtonSolverConfig) -> OptionResolution -``` - -`NewtonSolverConfig` accepts `type: str`, JSON-compatible `settings`, and optional legacy MuJoCo fields. Use explicit field-presence tracking for alias conflicts; do not inject legacy defaults into VBD or generic settings. Keep legacy runtime defaults `integrator="implicitfast"`, `solver="newton"`, and existing required iteration settings for legacy syntax. - -`NewtonSolverDescriptor` contains name, solver class, `register_attributes(builder)`, `prepare_builder(builder)`, and `build_resources(model, options)`; Task 6 defines the resource record. Initially register only `warp_mujoco`. - -- [ ] **Step 1: Write option tests.** `test_known_options_reach_constructor` asserts exact keyword forwarding. `test_unknown_managed_and_documented_ignored_options_warn_once` asserts omission plus string replacement. `test_kwargs_does_not_accept_arbitrary_names` rejects names merely hidden by `**kwargs`. `test_legacy_aliases_preserve_mujoco_arguments` asserts original option dictionary; `test_duplicate_legacy_and_settings_argument_fails` rejects even equal duplicate values. -- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_newton_solver_options.py tests/test_newton_solvers.py tests/test_actuator_sys_id_config.py -q`. -- [ ] **Step 3: Implement public-option resolution.** Exclude `self`, positional-only parameters, `*args`, `**kwargs`, and context-owned resources including `model`/`collision_pipeline`. Use explicit public enum converters for supported enum settings; never load runtime objects from arbitrary strings. Unknown solver names fail. Maintain a small pinned-version map only for documented ignored options; do not mark an option ignored merely because it is deprecated. -- [ ] **Step 4: Verify error boundaries.** Add `test_recognized_invalid_value_is_constructor_error`, asserting a supported option rejected by the real constructor fails with the configuration path and original reason. Verify warnings and provenance never mutate the input dictionary, and unrelated Newton warnings remain visible. -- [ ] **Step 5: Gate and commit.** Run quality gates and Task 5 tests; commit as `feat: resolve generic Newton solver settings`. - -### Task 6: Integrate solver resources, context identity, and compact provenance - -**Files:** Modify `anchor_bench/core/simulation/newton.py`, `newton_stepper.py`, `newton_solvers.py`, `anchor_bench/tasks/actuator_sys_id/simulation.py`, `backends/newton.py`, `tests/test_newton_simulation_context.py`, `tests/test_actuator_sys_id_simulation.py`, `tests/test_actuator_sys_id_task.py`, and `docs/system-identification.md`. - -**Interfaces:** Define frozen `NewtonSolverResources(solver: SolverBase, contacts: Contacts|None, step_contacts: Contacts|None, collision_pipeline: CollisionPipeline|None)`. Context initialization adds `solver_type: str="warp_mujoco"` and optional `solver_resolution: OptionResolution|None` while preserving `solver_options`; supplying both option forms is an error. The evaluator passes Task 5's resolution, while direct callers' raw `solver_options` are resolved inside the context. Resolve once before resource creation and retain `solver_settings: Mapping[str,JsonValue]` for reporting. The executor's step argument comes from `step_contacts`, independently of inspected `context.contacts`. - -Newton's backend `describe_runtime(evaluator)` returns the compact runtime simulation configuration. The common writer nests it in `run_summary.yaml`; accepted requested values stay values and omitted values become strings. Record the exact Newton revision without duplicating every constructor default or adding separate failure lists. - -- [ ] **Step 1: Write context/report tests.** `test_solver_attributes_are_registered_before_import_and_replication` checks both builders. `test_context_rejects_changed_solver_or_accepted_options` asserts singleton protection. `test_runtime_solver_settings_replace_only_skipped_values` checks output YAML and unchanged input/config hash. `test_same_accepted_options_reuse_context` covers equivalent requests with skipped keys. -- [ ] **Step 2: Run red tests.** Run modified context/evaluator/task tests plus Task 5 files; require hardcoded construction or missing provenance behavior to fail. -- [ ] **Step 3: Use descriptor resources throughout Newton setup.** Type solver ownership as `SolverBase`. Register attributes before import/replication, prepare the replicated builder before finalization, and include solver identity/normalized accepted values in singleton compatibility. Never expose VBD until Task 9 supplies its preparation and validation. -- [ ] **Step 4: Run real MuJoCo settings acceptance.** Parameterize a short native runtime over legacy/new settings forms and compare forwarded settings and scores with the original behavior. Run the native runtime integration, installed toy-backend integration, and SO-101 integration. Validate constructor errors prevent optimization/completion. -- [ ] **Step 5: Gate, commit, review, and prepare PR 3.** Run full acceptance and document generic YAML/legacy compatibility. Commit as `feat: configure Newton solvers through shared construction` and prepare the separate PR. - -## PR 4: External implicit PD with bias - -### Task 7: Build the coupled external actuator and bind live candidates - -**Files:** Create `anchor_bench/tasks/actuator_sys_id/newton_actuation.py`, `tests/test_newton_sysid_actuation.py`; modify controller schema in `anchor_bench/schema/actuator_sys_id.py` and its tests. - -**Interfaces:** Add `PdControllerConfig.implementation: Literal["native", "external_implicit"]="native"` and optional JSON `implicit_options` valid only for external mode. Reject mixed implementations/options within one coupled articulation for this release. Define: - -```python -ExternalImplicitPD.build(model: newton.Model, config: ActuatorSysIdConfig, *, - joint_names: Sequence[str], q_indices: np.ndarray, - dof_indices: np.ndarray, target_indices: np.ndarray) -> ExternalImplicitPD -ExternalImplicitPD.apply_population(population: Sequence[Candidate]) -> None -ExternalImplicitPD.reset() -> None -ExternalImplicitPD.before_substep(state: newton.State, - control: newton.Control, dt: float) -> None -ExternalImplicitPD.runtime_metadata() -> Mapping[str, JsonValue] -ExternalImplicitPD.supports_graph_capture() -> tuple[bool, str | None] -``` - -- [ ] **Step 1: Write analytic actuator tests.** `test_implicit_pd_matches_scalar_solution_with_bias` asserts the uncapped scalar effort against the equation below. `test_implicit_pd_effort_is_bounded_inside_solve` uses large error and nonzero bias to assert `abs(effort) <= effort_limit`. `test_implicit_pd_uses_off_diagonal_response` compares a two-DOF articulation with a dense coupled oracle, not independent scalar PD. - - For the unclamped oracle, use `A=M_inverse`, `K=diag(dt*kp+kd)` and solve `(I + dt*K*A)*tau = kp*(target_q-q) + kd*target_qd - K*qd + dt*K*A*bias`. Use small deterministic articulated models; compare the actuator effort, not exact constrained simulator trajectories. -- [ ] **Step 2: Run red tests.** `uv run pytest tests/test_newton_sysid_actuation.py tests/test_actuator_sys_id_config.py -q` must fail because the external mode is absent. -- [ ] **Step 3: Implement through Newton's public actuator API.** Construct full coupled `JointSpaceResponse`, `DrivePD`, `ClampingMaxEffort`, and one `Actuator` across selected DOFs/worlds. Call `set_effort_mode_implicit` before storing gain references; write candidates into the resulting `drive.kp`/`drive.kd` views. Keep separate position, DOF, target indices and preallocated full-DOF gravity/Coriolis/bias arrays. Do not add DC-motor velocity limiting or a second command delay. -- [ ] **Step 4: Verify updates and provenance.** Add `test_bound_gain_views_remain_live_after_implicit_binding`, `test_response_refresh_includes_updated_armature`, `test_bias_uses_current_state_without_mutating_body_poses`, and `test_external_velocity_limit_is_recorded_as_ignored`. Assert the implicit options use the same skip/error policy as solver options. Check no extra gravity-compensation torque is added. -- [ ] **Step 5: Gate and commit.** Run quality gates, controller/config tests, and real actuator tests; commit as `feat: add coupled implicit PD with bias and effort limits`. - -### Task 8: Integrate full physics-substep capture, reset, and fitted-model replay - -**Files:** Modify `anchor_bench/core/simulation/newton_stepper.py`, `newton.py`, `anchor_bench/tasks/actuator_sys_id/simulation.py`, `usd.py`, `backends/newton.py`; extend `tests/test_newton_step_executor.py`, `tests/test_actuator_sys_id_simulation.py`, `tests/test_actuator_sys_id_usd.py`; create `tests/integration/test_sysid_external_pd.py` and `tests/integration/sysid_replay.py`; update `docs/system-identification.md`. - -**Interfaces:** The executor accepts optional `before_substep: Callable[[State, Control, float], None]` and calls it after clearing forces, before every solver step, both eager and captured; supplying it without a control buffer is an error. Add `restore_state: Callable[[], None]|None` to capture orchestration and `can_capture: Callable[[], tuple[bool,str|None]]|None`; native callers remain compatible. Expose context `configure_step_callbacks(*, before_substep, restore_state, can_capture, configuration_key: Hashable) -> None` to attach these once before capture. Reject replacement by different callbacks after attachment; do not retain a stale actuator owner or graph. Include controller implementation and accepted implicit options in the evaluator's builder/runtime configuration key. `ExternalImplicitPD.before_substep` executes response refresh, passive inverse dynamics, bias sum, effort clear, and implicit actuator step with physics dt. Replay helper runs in a fresh process to avoid source/export singleton collisions. - -- [ ] **Step 1: Write lifecycle regressions.** `test_external_pd_runs_before_each_physics_substep` asserts full ordering and dt. `test_external_candidate_updates_do_not_restore_native_pd` asserts native ke/kd stay zero while external gains change. `test_bias_and_clamp_are_present_in_captured_substeps` asserts numerical output, not just callback invocation. `test_capture_restores_initial_state_and_histories` compares repeated independent runs. `test_context_rejects_native_external_reconfiguration_or_hook_replacement` prevents stale callback/gain ownership when the USD and world count are unchanged. -- [ ] **Step 2: Run red tests.** Run the modified stepper/evaluator tests and new external-PD integration. Existing native tests must continue to pass with callbacks omitted. -- [ ] **Step 3: Wire the external path.** Disable native gains on external DOFs (MuJoCo effort mode; VBD cannot rely on target mode). Keep physical armature/friction/damping updates in the model. Retain delayed command targets at control rate and recompute response/bias/effort at every physics substep. Warm up full intervals outside capture, restore both visible state buffers/control plus solver/contact/actuator history before capture and again afterward. Reset output efforts between substeps and histories between trajectories. -- [ ] **Step 4: Verify physical, graph, and export behavior.** Add two-world A/B/A and live-candidate CUDA replay cases; compare eager/graph results for odd/even substeps. Require `device.is_cuda` and `wp.is_mempool_enabled(device)` for capture of bias scratch allocations; when unavailable, log the reason and run the entire sequence eagerly. Persist external mode/options/ignored velocity metadata. External export must not author a stronger finite velocity opinion. Reimport the exported USD in a fresh process with recorded config and fitted parameters, tile the candidate across worlds, and compare MSE to the recorded optimum. Keep the existing native replay helper and training validator unchanged. -- [ ] **Step 5: Gate, commit, review, and prepare PR 4.** Run full acceptance including native and external MuJoCo plus installed backend integration. Commit as `feat: run sysid with external implicit PD actuation` and prepare its separate PR. - -## PR 5: VBD sysID - -### Task 9: Add VBD resources, capability validation, and real sysID acceptance - -**Files:** Modify `anchor_bench/core/simulation/newton_solvers.py`, `newton.py`, `anchor_bench/tasks/actuator_sys_id/simulation.py`, `backends/newton.py`; create `newton_capabilities.py` in that task package, `tests/test_newton_sysid_capabilities.py`, `tests/integration/test_sysid_vbd.py`, and `examples/system_identification/so101_vbd.yaml`; extend solver/context/reset tests and `docs/system-identification.md`. - -**Interfaces:** Add `validate_newton_sysid_capabilities(config: ActuatorSysIdConfig, model: newton.Model, *, joint_names: Sequence[str], dof_indices: np.ndarray) -> None`. Add descriptor `vbd`: register its attributes before USD import, color the replicated builder before finalize, create the collision pipeline before solver construction, and pass the pipeline to VBD. Resources expose `contacts=solver.contacts` for inspection and `step_contacts=None` for solver-owned detection. - -- [ ] **Step 1: Write capability and ordering tests.** `test_vbd_requires_external_implicit`, `test_vbd_pipeline_owns_contacts_and_detection`, and `test_vbd_is_colored_after_replication` assert the supported configuration and resource order. `test_vbd_armature_requires_revolute_in_actual_sparse_articulation` checks upper bounds/nonzero fixed values and imported unselected joints, not only initial values or a sparse-setting string. Reject sparse local fallback, unsupported joint types, sparse reduced-elastic combinations, unsupported tendon resets, collision settings that leave stale contacts after episode reset, and `integrate_with_external_rigid_solver=True` without a rigid-body coupler. -- [ ] **Step 2: Run red tests.** Run `uv run pytest tests/test_newton_sysid_capabilities.py tests/test_newton_solvers.py tests/test_newton_simulation_context.py -q`; missing VBD resources/capability checks must fail. -- [ ] **Step 3: Enable VBD with the shared implicit controller.** Use `block_sparse_joints` or `block_sparse_levels` where armature requires them. Keep local compliant ALM available only for compatible zero-armature models; document its static friction versus sparse regularized friction. Send appropriate model-change notifications. Reset VBD with `flags=0`, write measured/full-turn coordinates and velocities into both buffers, run FK, reset pipeline contact matching and actuator state, then let VBD's schedule generate fresh contacts. Read fork-published joint outputs directly without `eval_ik` or overwriting body poses. Normalize public collision-slot/frequency enums and Warp deterministic options; classify the fork's documented ignored VBD options explicitly, including the three `rigid_contact_stick_*_eps` fields, `rigid_tendon_relaxation`, and `rigid_enable_dahl_friction`. -- [ ] **Step 4: Run real VBD acceptance and document the example.** `test_vbd_sysid_changes_friction_damping_and_sparse_armature` proves each supported property affects motion. `test_vbd_reset_preserves_continuous_turns_and_cold_contacts` checks A/B/A and contact resets. `test_vbd_external_pd_cuda_matches_eager` covers full bias/actuator/solver graph execution and live candidates. A short SO-101 sparse VBD run uses explicit `controller.implementation: external_implicit`, effort limits, ignored velocity, finite scores, common outputs, and fresh-process fitted-model replay matching its logged MSE. Do not require identical identified parameters across MuJoCo and VBD. Test BDF2 settings only under the fork's documented restrictions, with early errors for incompatible models. -- [ ] **Step 5: Gate, commit, review, and prepare PR 5.** Run full acceptance for native/external MuJoCo, VBD, and toy backend, then commit as `feat: support VBD actuator system identification` and prepare its separate PR. - -## Stage acceptance and finishing - -For every product stage run from the repository root: - -```bash -uv run ruff check -uv run ruff format --check -uv run pyright -uv run pytest -uv run pytest -o "addopts=" -``` - -The final command includes integration tests because all stages affect shared simulation/task infrastructure or its dependencies. Run tests once after the final relevant edits; repeat only for new failures or changes. Report actual hardware skips, download/environment failures, and unrelated baseline failures without weakening assertions or claiming unexecuted checks passed. - -The existing relevant integration gates are: - -```bash -uv run pytest -m integration tests/integration/so101_actuator_sysid/test_cli.py -uv run pytest -m integration tests/integration/g1/test_training.py -``` - -New integration modules join the targeted gate when their stage lands. Independent review checks the design and tests against the exact diff before PR creation. Use a temporary body file with `gh pr create --draft --body-file ...`, describe only the completed stage and observed validation, then attach its URL with the app artifact tool. Preserve separate stage branches/PRs and wait for stage acceptance before beginning dependent stages. - -## Planning evidence and self-review - -- Dependency migration research verified `copy_count`, explicit collision pipelines, intrinsic coordinate targets, retained native APIs, and the actual fork dependency floors. -- Backend research verified the USD assumption in the base context, eager-import cycles, polymorphic Pydantic serialization, and a real installed-metadata fixture rather than mocked discovery. -- Solver/actuator research verified owned `contacts=None`, packed gain views after implicit binding, per-call bias scratch allocation, full coupled response, and fresh-process replay requirements. -- Coverage: Tasks 1–2 cover the pinned runtime; Tasks 3–4 cover backend/config/context/export/discovery; Tasks 5–6 cover settings/identity/provenance; Tasks 7–8 cover implicit PD/bias/clamp/reset/capture/export; Task 9 covers VBD capabilities, runtime, examples, and replay. No design section is assigned to an unimplemented future stage outside these five PRs. -- Self-review checked interface definitions before consumers, export/provenance types, legacy/raw option entry points, context identity including controller mode, and the ownership of captured callbacks. File arrangement and helper bodies remain implementation choices; user-visible configuration names, supported modes, physics sequence, error behavior, and acceptance boundaries are fixed by this plan and the approved design. diff --git a/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md b/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md deleted file mode 100644 index 3b5a263..0000000 --- a/docs/superpowers/specs/2026-10-29-sysid-backends-and-solvers-design.md +++ /dev/null @@ -1,387 +0,0 @@ -# Pluggable sysID backends and configurable Newton solvers - -Date: 2026-10-29 -Status: Approved on 2026-10-29; implementation plan in review - -## Intent and agreed scope - -Allow actuator system identification to select a simulator backend and, within -Newton, select and configure a physics solver. Deliver the work in independently -reviewable PRs. Implement Newton MuJoCo and VBD; leave additional real simulator -implementations and MPM outside this project. - -Use the Newton fork at -`https://github.com/skulkar22/newton`, branch `dev/rigid-vbd-integration`. -The inspected revision is `1e5036c48ec92d44782dfe0f448dc25d64984b58` -(`1.8.0.dev0`). Lock this exact revision; updating the branch deliberately is a -dependency change, not an implicit change between runs. - -User requirements: - -- Keep the simulator boundary separate from Newton's solver selection. -- Accept solver-specific settings through a general YAML dictionary rather than - duplicating all solver constructor options in handwritten configuration models. -- Warn about unknown/skipped solver settings. In recorded settings, replace that - setting's value with a short string explaining why it was not set. -- Include the extension points needed for another simulator to supply sysID. -- Use external implicit PD actuation with effort clamping and bias feedback. -- Ignore the velocity limit in the new external actuator path. -- Preserve existing MuJoCo configuration and native-actuation behavior. - -## Current architecture - -`SimulationContext` owns one lazily loaded model and state per process. Its only -abstract operation is model loading; it does not define a complete stepping or -sysID execution protocol. `SIMULATION_CONTEXTS` currently registers only Newton. - -`PopulationEvaluator.evaluate(population, trajectories)` is already independent -of the simulator. The objective and optimizer consume scores through this -protocol. However, `ActuatorSysIdTask` constructs `NewtonPopulationEvaluator` -directly, the simulation schema permits only Newton, and the evaluator checks -for `NewtonSimulationContext` before manipulating Newton/Warp arrays. - -The Newton context hardcodes MuJoCo construction and attribute registration. -The evaluator maps three YAML options to MuJoCo constructor keywords and fixes -its internal algorithm to `solver="newton"`. - -Common result writing currently invokes a Newton-specific USD exporter and -requires an `identified.usda` result. This coupling must move behind the backend -boundary as well as evaluator construction. - -## Approaches and selected direction - -Two architecture choices were considered: - -1. Expand `SimulationContext` into a universal physics interface for every sysID - array operation. This centralizes execution but forces different simulators - and device layouts into one detailed model/state contract. -2. Keep `SimulationContext` responsible for resources, and select a backend's - population evaluator through the existing scoring protocol. Keep solver - integration beneath Newton. This preserves efficient native simulation and - scoring while leaving the optimization algorithm independent of the backend. - -The discussion selected the second direction, including the backend selection -work in this project. Do not introduce a universal array abstraction or duplicate -Newton's existing `SolverBase` lifecycle interface. - -For numerical settings, use constructor-based discovery. Arbitrary post-build -attribute assignment is unsuitable: constructors resolve settings, allocate -buffers, and create cached values that assigning an attribute may not update. - -## Backend boundary - -Provide an explicit sysID backend registration containing: - -- A backend name and configuration model. -- A population-evaluator factory implementing the existing scoring protocol. -- A simulation context factory compatible with resource ownership. -- An optional fitted-model export hook. - -Registration must connect to the existing simulation registry rather than -requiring inconsistent declarations in unrelated catalogs. Validate duplicate -registrations and missing sysID capabilities before running optimization. -Support registration through the Python API and discovery through the -`anchor_bench.sysid_backends` entry-point group, so an installed backend can run -through the CLI without editing core source. Load registration metadata before -parsing its configuration, with deterministic duplicate-name errors. - -Common sysID data remains joint names, candidate physical parameters, aligned -command/measurement trajectories, timing, and one finite position-MSE score per -candidate. A backend owns candidate application, state resets, actuation, -stepping, and score calculation. The objective, CMA-ES implementation, dataset -loader, delay semantics, and buffer exclusion are unchanged. - -The simulation configuration dispatches on its existing `type` field. Keep -shared timing fields available to task invariant validation; Newton owns -`usd_path` and its solver block. Registered backend configuration models retain -their own validation and complete serialization. A custom backend's parsing and -execution must not construct or require a Newton context. - -Common output files remain `config.yaml`, `best_params.yaml`, -`optimization_log.csv`, `run_summary.yaml`, and `.completed`. Backend-specific -model export is optional. Newton continues to write `identified.usda`; another -backend can write a different identified model or only the common results. -Represent optional model artifacts without requiring a USD path. Preserve the -existing Newton result access and filename for current callers. - -Prove the boundary with a test backend using its own configuration, model/state -objects, deterministic population evaluation, and non-USD export. It must run -through configuration parsing, optimization, and common output writing without -constructing Newton objects. This is contract validation, not a second simulator -implementation. - -## Newton solver selection and settings - -Newton's backend owns a solver registry/factory and the small setup hooks needed -by each supported solver. Initial public names are `warp_mujoco` and `vbd`. -Unknown solver names fail before simulation setup. Settings never import an -arbitrary class named by a configuration string. - -The preferred configuration is: - -```yaml -simulation: - type: newton - usd_path: path/to/robot.usda - physics_freq: 1000 - control_freq: 200 - render_freq: 60 - solver: - type: vbd - settings: - iterations: 20 - rigid_compliant_alm: true - rigid_articulation_solve: block_sparse_joints -``` - -Inspect the selected solver's public constructor to identify keyword parameters. -Exclude resource arguments owned by the context, including `model` and -`collision_pipeline`. Do not interpret an unrestricted `**kwargs` argument as -proof that an arbitrary option is supported. Normalize supported enum-valued -options from YAML using explicit public types; runtime resources are never -constructed from arbitrary YAML objects. Constructor failures for recognized -arguments remain errors and must identify the offending configuration path. - -Keep legacy MuJoCo `integrator`, `solver_iterations`, and -`line_search_iterations`, translating them to the same construction path. -Preserve the current internal `solver="newton"` default for legacy configs. -If legacy and new settings specify the same argument, reject ambiguous duplicate -specification rather than silently choosing precedence. - -Register selected-solver custom attributes before USD import and on population -builders. Preserve solver-specific attributes authored in USD. VBD colors the -population builder before finalization and checks articulation layout for sparse -modes. Arbitrary YAML overrides of per-joint or per-particle attributes are not -part of this first implementation; they are distinct from constructor options. - -The initialized-context identity includes solver selection and accepted settings -alongside world count and builder configuration. Reusing the process singleton -with a different solver/configuration must fail clearly. Solver settings remain -fixed during a run; candidate physical parameters update between generations. - -### Warning and provenance behavior - -Warn once during setup for each unknown, internally managed, or demonstrably -ignored requested setting. Keep the input configuration intact. Add the compact -runtime solver-settings mapping to `run_summary.yaml`; accepted requested values -remain values, and skipped values become explanatory strings: - -```yaml -simulation: - type: newton - solver: - type: vbd - settings: - iterations: 20 - misspelled_option: "NOT SET: unknown constructor parameter" -``` - -Do not create a second failure list or copy every library default into the -summary. The dependency lock identifies defaults. Preserve the fork revision in -run metadata. Use documented ignored parameters and captured, attributable -Newton warnings to distinguish accepted-but-ignored options; a deprecation -warning alone does not prove an option is ignored. Do not claim to detect every -conditionally inactive setting from constructor introspection. - -## Newton lifecycle and VBD capabilities - -Use the solver's existing `step`, `reset`, `notify_model_changed`, and custom -attribute registration interfaces. Small Newton-owned handlers cover resource -construction, preparation, capability checks, and reset coordination, not a -second hierarchy duplicating every solver method. - -Create an explicit `CollisionPipeline` for VBD before solver construction and -use the fork's solver-owned collision scheduling. Do not also run a duplicate -external collision pass. Reset collision matching as well as solver history -between independent trajectories. Preallocate/warm up required buffers outside -capture, then restore initial simulation, collision, and actuator state before -capturing or evaluating a trajectory. - -The pinned fork publishes `state.joint_q` and `state.joint_qd` for revolute, -prismatic, and D6 joints, including continuous turns. Consume these directly; -do not overwrite continuous output with generic inverse kinematics. Reset from -measured joint coordinates with matching forward-kinematic body poses and -preserve full turn counts. Candidate/world isolation, delayed commands, scoring -alignment, and stable canonical state-buffer identities remain invariant. - -Validate physical capabilities using solver mode, joint types, actual authored -model values, and configured candidate bounds. In this fork: - -- Drive stiffness/damping and passive viscous damping support revolute, - prismatic, and D6 joints. -- Dry friction under local compliant ALM supports static sticking. Sparse modes - use regularized Coulomb friction, which has different near-zero behavior. -- Revolute armature requires a declared articulation solved with - `block_sparse_joints` or `block_sparse_levels`; the local fallback must not be - accepted for a fitted or nonzero armature. -- Sparse reduced-elastic articulation joints have further restrictions on - armature, passive damping, friction, and mimics. Reject unsupported combinations. -- External actuation supplies effort clamping independently of VBD's unsupported - native effort-limit property. Velocity limiting is intentionally unused. - -Do not reject armature and friction merely because released Newton 1.4.0 lacked -them. Conversely, accepting a constructor setting does not establish that the -selected model/joint/mode supports every fitted physical parameter. - -## External implicit PD actuation with bias - -Add an explicit controller implementation choice: existing configurations default -to `native`; new external actuation is `external_implicit`. This is a design -proposal for the configuration spelling, not an existing field. Support the -external mode with MuJoCo and VBD so solver comparisons can use the same control -law. Keep native MuJoCo behavior as the compatibility baseline. - -The supported matrix is MuJoCo/native, MuJoCo/external implicit, and VBD/external -implicit. VBD/native is outside this project. Selecting VBD with the compatibility -default `native` must fail before optimization with a message requiring -`controller.implementation: external_implicit`; do not switch it silently. The -VBD example explicitly sets this field for every identified joint group. - -Use Newton's `Actuator`, `DrivePD`, `ClampingMaxEffort`, -`JointSpaceResponse`, and `Actuator.set_effort_mode_implicit`. Effort saturation -is enforced inside the implicit actuator solve, not after an explicit PD step. -Use one actuator with all optimized DOFs for each replicated model so the -implicit solve retains coupling within each articulation and isolation between -worlds. All joints sharing an articulation's coupled external controller must -use compatible implementation/options; reject a mixed native/external selection -within that articulation for the first implementation. - -Provide optional `implicit_options` under an external controller for public -`Actuator.ImplicitOptions` values. Use the same recognized-option filtering and -compact skipped-setting reporting policy. External implicit mode always includes -bias prediction; do not silently fall back to explicit PD, omit bias, or use a -diagonal response. - -Each physics substep performs: - -1. Expose the current simulated joint/body state and delayed control targets. -2. Refresh the coupled joint-space inverse-mass response at the current state, - including the current candidate's armature. -3. Evaluate `newton.eval_inverse_dynamics_passive` at the current simulated state - into preallocated gravity and Coriolis arrays; form their sum as `bias_force`. -4. Clear actuator output effort, evaluate the implicit actuator with the physics - timestep and `bias_force`, and write its clamped effort to `control.joint_f`. -5. Advance the selected Newton solver. Native PD is disabled on externally - controlled DOFs; physical armature, dry friction, and viscous damping remain - active in the physics solver. - -The bias convention is `tau = M*qdd + b`, with `b = gravity + Coriolis`. -The actuator predicts `qd_next = qd + M_inverse * (impulse - dt*b)`. Passing -`bias_force` is not an additional gravity-compensation feedforward torque. -The physics solver applies its own gravity/Coriolis forces; do not add the bias -as another output torque. This interprets the user's bias-feedback requirement -as the pinned fork's implicit actuator bias input. - -Use `JointSpaceResponse.refresh(state)` for both MuJoCo and VBD initially. This -constructs the full coupled articulation mass response with current armature, -keeps the controller prediction consistent across solvers, and avoids depending -on a MuJoCo factorization from the preceding step. This is a design choice for -review. It is a prediction model, not the exact constrained solver response: -contacts, friction, damping, joint limits, and loop constraints are not folded -into its inertia. The bias input similarly covers gravity and Coriolis, not -contact/limit reactions, passive joint damping, or other applied forces. Do not -claim equivalence to either solver's complete constrained dynamics. A future -solver-faithful inertia response can use `refresh_from_solve` once current-state -preparation and its behavior are independently validated. - -The fork's passive inverse-dynamics helper allocates scratch per call. The -external mode therefore requires Warp's device memory pool for CUDA capture; -warm up and validate that requirement before capturing. If the memory pool is -unavailable, log the reason and execute the same full response/bias/actuator -sequence eagerly. Do not capture only the solver or silently omit bias to make -capture succeed. - -Bind each candidate's gains to the actuator-owned parameter arrays after -implicit-mode binding; assigning the model's native PD arrays alone is -insufficient. Do not rebind arrays after graph capture. Capture response refresh, -bias evaluation, actuator stepping, and solver stepping as one substep sequence. -Reset any actuator history between independent trajectories. Keep the existing -trajectory command-delay implementation and do not apply a second actuator delay. - -Ignore `velocity_limit` in external mode. Retain the legacy input field for -configuration compatibility, report `"NOT SET: velocity limit ignored"` in -runtime controller provenance, and do not add a DC-motor speed envelope or hard -speed constraint. The external model export must not author a stronger finite -velocity-limit opinion that implies it was enforced during fitting. Export -metadata must preserve the selected controller implementation and solver so -replay can reproduce its actuation semantics. - -Replay acceptance means reimporting the exported fitted model and evaluating -its fitted parameters through the same sysID backend/evaluator with the recorded -solver/controller configuration. It does not add external-actuator or VBD -selection to the training replay validator. That validator remains on its -existing native MuJoCo path, with regression compatibility checked in stage 1. -Do not add a separate replay CLI or change the training validator's product -contract as part of this project. - -## Delivery stages - -Each stage is its own PR and must be mergeable with its tests and documentation. -The default execution is one stage at a time. Do not combine all product changes -into one PR or merge/publish stages merely because this design is approved. - -| Stage | Change | Acceptance boundary | -| --- | --- | --- | -| 1 | Pin the Newton fork and migrate existing API usage | Existing native MuJoCo sysID and training/replay workflows work on the exact fork revision; no new solver exposed yet. | -| 2 | Register sysID backends, dispatch configuration/evaluator, and isolate model export | Existing Newton behavior remains; an installed test backend runs the complete CLI flow without Newton context construction or USD-only output requirements. | -| 3 | Add Newton solver factory, general settings, legacy translation, and compact runtime provenance | MuJoCo runs through the new factory; known options reach construction, unknown/ignored options warn and appear as strings, and singleton configuration conflicts are rejected. | -| 4 | Add external implicit PD, coupled response, gravity/Coriolis bias, effort clamp, and reset/capture support | MuJoCo external mode has verified saturation, live candidate gains/armature, coupled multi-DOF response, bias sign, and independent trajectory/world behavior. Native mode remains compatible. | -| 5 | Enable VBD with its preparation, collision/reset integration, capability checks, and example | VBD sysID runs with external implicit PD and effort clamping, supported fitted physical parameters, repeatable replay/export, and validated eager/graph execution. | - -An installed third-party simulator, a universal simulator tensor API, MPM, -explicit external PD, velocity limiting, generic YAML model-attribute overrides, -and equivalence of all solver physics are non-goals. BDF2 may be configured only -where the fork supports it; adding a separate BDF2 feature project is unnecessary. - -## Validation - -Use meaningful behavior tests at each boundary, not only constructor mocks: - -- Existing native MuJoCo configuration, result exports, and score alignment. -- Backend discovery/registration, strict custom schema round-trip, config errors, - evaluator selection, optional/non-USD exports, and Newton-independent execution. -- Actual constructor-option forwarding and errors, legacy compatibility, unknown - and documented ignored settings, provenance without input-config mutation. -- PD effort saturation under large position error, implicit coupled response - versus an analytic small articulation, and gravity/Coriolis bias sign and - effect. Include nonzero armature and multiple replicated worlds. -- Candidate updates visible during CUDA graph replay, independent trajectory - reset, history restoration after warm-up/capture, and eager/graph agreement. -- VBD friction/damping changes, sparse-mode armature, unsupported model/mode - rejection, continuous joint coordinates, fresh collisions after reset, and - absence of duplicate native PD forces. -- A short real SO-101 sysID run per supported mode and replay of exported - parameters using the recorded solver/controller configuration. Do not require - identical fitted parameters or trajectories across different solvers. - -The repository gates apply to every code/dependency stage: `uv run ruff check`, -`uv run ruff format --check`, `uv run pyright`, and appropriate pytest coverage. -Because the dependency migration and simulation changes affect shared -infrastructure and integrations, run the complete unit and integration suite -with `uv run pytest -o "addopts="` for those stages. CUDA claims require actual -CUDA validation; document any unavailable hardware or unrelated baseline failure. -Documentation-only design work does not run these gates. - -## Builder decisions and follow-up checks - -The builder may choose file layout, precise registration function signatures, -optional-result compatibility helpers, and test fixture structure. The proposed -controller field names and entry-point group are design choices for review. - -Confirm contact capacity warm-up and graph capture restore all solver-owned -history, not just the visible state arrays. The chosen generic response path is -part of the external controller's recorded runtime implementation; no stale -MuJoCo solve or unrecorded controller-mode fallback is allowed. - -The inspected fork source and its tests support these design claims, but have -not been installed or executed during design research. Stage 1 establishes the -runtime baseline before subsequent feature work. - -## Source evidence - -- [Pinned fork revision](https://github.com/skulkar22/newton/commit/1e5036c48ec92d44782dfe0f448dc25d64984b58). -- [VBD capabilities, settings, collision and reset behavior](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/_src/solvers/vbd/solver_vbd.py). -- [External implicit actuation and bias conventions](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/docs/concepts/actuators.rst). -- [Coupled joint-space response](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/_src/actuators/joint_space_response.py). -- [Actuator, bias, clamping, and live-update tests](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/tests/test_actuators.py). -- [Sparse articulation and armature tests](https://github.com/skulkar22/newton/blob/1e5036c48ec92d44782dfe0f448dc25d64984b58/newton/tests/test_vbd_sparse_articulation.py). From 8bfd95459f212177a5927f0a3d956516d3babaaf Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 14:25:58 -0700 Subject: [PATCH 07/16] feat: run sysid through registered simulator backends --- anchor_bench/__init__.py | 16 +- anchor_bench/core/__init__.py | 46 ++- anchor_bench/core/simulation/__init__.py | 62 ++-- anchor_bench/core/simulation/newton.py | 36 ++- anchor_bench/core/simulation/registry.py | 280 +++++++++++++++- anchor_bench/errors.py | 4 + anchor_bench/schema/actuator_sys_id.py | 69 ++-- anchor_bench/schema/simulation.py | 51 +++ .../tasks/actuator_sys_id/__init__.py | 29 +- .../tasks/actuator_sys_id/artifacts.py | 31 +- .../actuator_sys_id/backends/__init__.py | 4 + .../tasks/actuator_sys_id/backends/newton.py | 74 +++++ anchor_bench/tasks/actuator_sys_id/model.py | 11 +- .../tasks/actuator_sys_id/simulation.py | 27 +- anchor_bench/tasks/actuator_sys_id/task.py | 26 +- docs/system-identification.md | 67 +++- tests/fixtures/sysid_backend/run_cli.py | 21 ++ .../toy_sysid_backend/__init__.py | 124 ++++++++ tests/integration/test_sysid_backend_cli.py | 188 +++++++++++ tests/integration/usd_trajectory.py | 12 +- tests/test_actuator_sys_id_config.py | 15 + tests/test_actuator_sys_id_simulation.py | 36 ++- tests/test_actuator_sys_id_task.py | 235 ++++++++++++-- tests/test_data_processor_runner.py | 8 +- tests/test_data_processors.py | 20 +- tests/test_newton_simulation_context.py | 29 +- tests/test_simulation_context.py | 100 ++++++ tests/test_simulation_registry.py | 7 + tests/test_sysid_backends.py | 299 ++++++++++++++++++ 29 files changed, 1745 insertions(+), 182 deletions(-) create mode 100644 anchor_bench/schema/simulation.py create mode 100644 anchor_bench/tasks/actuator_sys_id/backends/__init__.py create mode 100644 anchor_bench/tasks/actuator_sys_id/backends/newton.py create mode 100644 tests/fixtures/sysid_backend/run_cli.py create mode 100644 tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py create mode 100644 tests/integration/test_sysid_backend_cli.py create mode 100644 tests/test_simulation_context.py create mode 100644 tests/test_sysid_backends.py diff --git a/anchor_bench/__init__.py b/anchor_bench/__init__.py index 7e889d4..30f4af5 100644 --- a/anchor_bench/__init__.py +++ b/anchor_bench/__init__.py @@ -3,6 +3,20 @@ """Anchor Bench task runner.""" -from anchor_bench.core.task_runner import TaskRunner +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from anchor_bench.core.task_runner import TaskRunner __all__ = ["TaskRunner"] + + +def __getattr__(name: str) -> Any: + """Load the runner only when explicitly requested.""" + + if name != "TaskRunner": + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + from anchor_bench.core.task_runner import TaskRunner + + globals()[name] = TaskRunner + return TaskRunner diff --git a/anchor_bench/core/__init__.py b/anchor_bench/core/__init__.py index f7f729c..65d0a69 100644 --- a/anchor_bench/core/__init__.py +++ b/anchor_bench/core/__init__.py @@ -3,14 +3,33 @@ """Core task-runner and simulation functionality.""" -from anchor_bench.core.artifacts import ( - get_or_create_output_folder, - resolve_repo_root, - write_yaml, -) -from anchor_bench.core.simulation import SimulationContext -from anchor_bench.core.simulation.newton import NewtonSimulationContext -from anchor_bench.core.task_runner import TaskRunner +from importlib import import_module +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from anchor_bench.core.artifacts import ( + get_or_create_output_folder, + resolve_repo_root, + write_yaml, + ) + from anchor_bench.core.simulation import SimulationContext + from anchor_bench.core.simulation.newton import NewtonSimulationContext + from anchor_bench.core.task_runner import TaskRunner + +_EXPORTS = { + "NewtonSimulationContext": ( + "anchor_bench.core.simulation.newton", + "NewtonSimulationContext", + ), + "SimulationContext": ("anchor_bench.core.simulation", "SimulationContext"), + "TaskRunner": ("anchor_bench.core.task_runner", "TaskRunner"), + "get_or_create_output_folder": ( + "anchor_bench.core.artifacts", + "get_or_create_output_folder", + ), + "resolve_repo_root": ("anchor_bench.core.artifacts", "resolve_repo_root"), + "write_yaml": ("anchor_bench.core.artifacts", "write_yaml"), +} __all__ = [ "NewtonSimulationContext", @@ -20,3 +39,14 @@ "resolve_repo_root", "write_yaml", ] + + +def __getattr__(name: str) -> Any: + """Resolve public exports without importing task or simulator runtimes eagerly.""" + + if name not in _EXPORTS: + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + module_name, attribute = _EXPORTS[name] + value = getattr(import_module(module_name), attribute) + globals()[name] = value + return value diff --git a/anchor_bench/core/simulation/__init__.py b/anchor_bench/core/simulation/__init__.py index 7ee2241..b58b662 100644 --- a/anchor_bench/core/simulation/__init__.py +++ b/anchor_bench/core/simulation/__init__.py @@ -6,7 +6,7 @@ from __future__ import annotations from abc import ABC, abstractmethod -from pathlib import Path +from collections.abc import Hashable from typing import Any, ClassVar, Generic, Optional, Tuple, TypeVar, cast from typing_extensions import Self @@ -19,54 +19,40 @@ class SimulationContext(ABC, Generic[ModelT, StateT]): """Own the single lazily loaded simulation model and state.""" _instance: ClassVar[Optional[SimulationContext[Any, Any]]] = None - _usd_path: Path - _fixed_base: bool + _resource_key: Hashable _model: Optional[ModelT] _state: Optional[StateT] - def __new__( - cls, - usd_path: str, - *, - fixed_base: bool = False, - ) -> Self: - """Create or return the process-wide simulation context.""" + def __new__(cls, *, resource_key: Hashable) -> Self: + """Create or return the process-wide context for a hashable resource.""" + + try: + hash(resource_key) + except TypeError as exc: + raise TypeError("resource_key must be hashable.") from exc - source = Path(usd_path).expanduser().resolve() current = SimulationContext._instance if current is not None: if type(current) is not cls: raise RuntimeError( "Only one simulation backend can be used per process." ) - if current.usd_path != source: - raise RuntimeError( - f"Simulation context already uses {current.usd_path}." - ) - if current.fixed_base != fixed_base: + if current.resource_key != resource_key: raise RuntimeError( - "Simulation context already uses a different base mode." + "Simulation context already uses resource key " + f"{current.resource_key!r}." ) return cast(Self, current) - if not source.is_file(): - raise FileNotFoundError(f"USD file does not exist: {source}.") - instance = super().__new__(cls) - instance._usd_path = source - instance._fixed_base = fixed_base + instance._resource_key = resource_key instance._model = None instance._state = None SimulationContext._instance = instance return instance - def __init__( - self, - usd_path: str, - *, - fixed_base: bool = False, - ) -> None: - """Accept the mandatory USD path handled during construction.""" + def __init__(self, *, resource_key: Hashable) -> None: + """Accept the mandatory resource identity handled during construction.""" @classmethod def current(cls) -> Self: @@ -78,22 +64,16 @@ def current(cls) -> Self: return cast(Self, instance) @property - def usd_path(self) -> Path: - """Return the USD file assigned to this process.""" - - return self._usd_path - - @property - def fixed_base(self) -> bool: - """Return whether the imported robot root is fixed.""" + def resource_key(self) -> Hashable: + """Return the backend-defined resource identity assigned to this process.""" - return self._fixed_base + return self._resource_key def load(self) -> Tuple[ModelT, StateT]: """Load and cache the model and state on first use.""" if self._model is None or self._state is None: - model, state = self._load(self._usd_path) + model, state = self._load() self._model = model self._state = state return self._model, self._state @@ -113,6 +93,6 @@ def state(self) -> StateT: return state @abstractmethod - def _load(self, usd_path: Path) -> Tuple[ModelT, StateT]: - """Load a backend model and initial state from the assigned USD.""" + def _load(self) -> Tuple[ModelT, StateT]: + """Load a backend model and initial state for the assigned resource.""" raise NotImplementedError diff --git a/anchor_bench/core/simulation/newton.py b/anchor_bench/core/simulation/newton.py index b1584a4..38443c0 100644 --- a/anchor_bench/core/simulation/newton.py +++ b/anchor_bench/core/simulation/newton.py @@ -11,6 +11,7 @@ from typing import Any, Callable, Mapping, Tuple import newton +from typing_extensions import Self from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor @@ -27,6 +28,8 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): count. """ + _usd_path: Path + _fixed_base: bool _initialized: bool _world_count: int _configuration_key: Hashable | None @@ -37,6 +40,23 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): _solver: newton.solvers.SolverMuJoCo _step_executor: NewtonStepExecutor + def __new__( + cls, + usd_path: str, + *, + fixed_base: bool = False, + ) -> Self: + """Assign the resolved USD path and base mode as resource identity.""" + + source = Path(usd_path).expanduser().resolve() + if SimulationContext._instance is None and not source.is_file(): + raise FileNotFoundError(f"USD file does not exist: {source}.") + + instance = super().__new__(cls, resource_key=(source, fixed_base)) + instance._usd_path = source + instance._fixed_base = fixed_base + return instance + def __init__( self, usd_path: str, @@ -45,10 +65,22 @@ def __init__( ) -> None: """Initialize instance bookkeeping without resetting the singleton.""" - super().__init__(usd_path, fixed_base=fixed_base) + super().__init__(resource_key=(self.usd_path, self.fixed_base)) if not hasattr(self, "_initialized"): self._initialized = False + @property + def usd_path(self) -> Path: + """Return the resolved USD file assigned to this Newton context.""" + + return self._usd_path + + @property + def fixed_base(self) -> bool: + """Return whether the imported robot root is fixed.""" + + return self._fixed_base + def initialize( self, *, @@ -185,7 +217,7 @@ def step(self, *, dt: float, substeps: int = 1) -> None: self._step_executor.step(dt=dt, substeps=substeps) self._state = self._step_executor.state - def _load(self, usd_path: Path) -> Tuple[newton.Model, newton.State]: + def _load(self) -> Tuple[newton.Model, newton.State]: """Return the owned model and current state, initializing if needed.""" self._ensure_initialized() diff --git a/anchor_bench/core/simulation/registry.py b/anchor_bench/core/simulation/registry.py index d7fbf5a..ce9a7d2 100644 --- a/anchor_bench/core/simulation/registry.py +++ b/anchor_bench/core/simulation/registry.py @@ -1,18 +1,281 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Simulation backend registry.""" +"""Simulation resources and typed system-identification capabilities.""" from __future__ import annotations -from typing import Any +from collections import Counter +from collections.abc import Callable, Iterator, Mapping +from dataclasses import dataclass +from importlib.metadata import entry_points +from pathlib import Path +from typing import TYPE_CHECKING, Any, cast from anchor_bench.core.simulation import SimulationContext -from anchor_bench.core.simulation.newton import NewtonSimulationContext +from anchor_bench.errors import SimulationBackendError -SIMULATION_CONTEXTS: dict[str, type[SimulationContext[Any, Any]]] = { - "newton": NewtonSimulationContext, -} +if TYPE_CHECKING: + from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig + from anchor_bench.schema.simulation import JsonValue, SysIdSimulationConfig + from anchor_bench.tasks.actuator_sys_id.model import ( + Candidate, + IdentifiedModelArtifact, + ) + from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator + from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace + + +@dataclass(frozen=True) +class SysIdBackend: + """Typed factories and optional model export for an identification backend.""" + + config_model: type[SysIdSimulationConfig] + create_context: Callable[[ActuatorSysIdConfig], SimulationContext[Any, Any]] + create_evaluator: Callable[ + [ActuatorSysIdConfig, ParameterSpace, SimulationContext[Any, Any]], + PopulationEvaluator, + ] + export_model: ( + Callable[ + [ActuatorSysIdConfig, Candidate, SimulationContext[Any, Any], Path], + IdentifiedModelArtifact | None, + ] + | None + ) = None + describe_runtime: ( + Callable[[PopulationEvaluator], Mapping[str, JsonValue]] | None + ) = None + + +@dataclass(frozen=True) +class SimulationBackend: + """One registered resource class and its optional identification capability.""" + + name: str + context_type: type[SimulationContext[Any, Any]] + sysid: SysIdBackend | None = None + + +_BACKENDS: dict[str, SimulationBackend] = {} +_DISCOVERED = False +_PENDING: dict[str, SimulationBackend] | None = None + + +def _newton_create_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any]: + from anchor_bench.tasks.actuator_sys_id.backends.newton import create_context + + return create_context(config) + + +def _newton_create_evaluator( + config: ActuatorSysIdConfig, + space: ParameterSpace, + context: SimulationContext[Any, Any], +) -> PopulationEvaluator: + from anchor_bench.tasks.actuator_sys_id.backends.newton import create_evaluator + + return create_evaluator(config, space, context) + + +def _newton_export_model( + config: ActuatorSysIdConfig, + best: Candidate, + context: SimulationContext[Any, Any], + output: Path, +) -> IdentifiedModelArtifact | None: + from anchor_bench.tasks.actuator_sys_id.backends.newton import export_model + + return export_model(config, best, context, output) + + +def _newton_describe_runtime(evaluator: PopulationEvaluator) -> Mapping[str, JsonValue]: + from anchor_bench.tasks.actuator_sys_id.backends.newton import describe_runtime + + return describe_runtime(evaluator) + + +def _ensure_builtin() -> None: + if "newton" in _BACKENDS: + return + from anchor_bench.core.simulation.newton import NewtonSimulationContext + from anchor_bench.schema.simulation import NewtonSimulationConfig + + _BACKENDS["newton"] = SimulationBackend( + "newton", + NewtonSimulationContext, + SysIdBackend( + NewtonSimulationConfig, + _newton_create_context, + _newton_create_evaluator, + _newton_export_model, + _newton_describe_runtime, + ), + ) + + +def _validate_registration(registration: object) -> SimulationBackend: + from anchor_bench.schema.simulation import SysIdSimulationConfig + + if not isinstance(registration, SimulationBackend): + raise SimulationBackendError( + "Provider must return a SimulationBackend registration." + ) + if not isinstance(registration.name, str) or not registration.name.strip(): + raise SimulationBackendError( + "Simulation backend name must be a non-empty string." + ) + if not isinstance(registration.context_type, type) or not issubclass( + registration.context_type, SimulationContext + ): + raise SimulationBackendError( + "Backend context_type must extend SimulationContext." + ) + capability = registration.sysid + if capability is None: + return registration + if not isinstance(capability, SysIdBackend): + raise SimulationBackendError("Backend sysid capability must be a SysIdBackend.") + if not isinstance(capability.config_model, type) or not issubclass( + capability.config_model, SysIdSimulationConfig + ): + raise SimulationBackendError( + "Backend config_model must extend SysIdSimulationConfig." + ) + for name in ( + "create_context", + "create_evaluator", + "export_model", + "describe_runtime", + ): + factory = getattr(capability, name) + if ( + factory is None and name in ("export_model", "describe_runtime") + ) or callable(factory): + continue + raise SimulationBackendError(f"Backend {name} must be callable.") + return registration + + +def register_simulation_backend(registration: SimulationBackend) -> None: + """Register a backend once, rejecting invalid capabilities and name collisions.""" + + _ensure_builtin() + _validate_registration(registration) + target = _BACKENDS if _PENDING is None else _PENDING + if registration.name in target: + raise SimulationBackendError( + f"Simulation backend {registration.name!r} is already registered." + ) + target[registration.name] = registration + + +def discover_sysid_backends() -> None: + """Load sorted entry points atomically, allowing a failed discovery to retry.""" + + global _DISCOVERED, _PENDING + if _DISCOVERED: + return + if _PENDING is not None: + raise SimulationBackendError( + "Recursive simulation backend discovery is not supported." + ) + _ensure_builtin() + try: + entries = sorted( + entry_points(group="anchor_bench.sysid_backends"), + key=lambda entry: entry.name, + ) + duplicates = sorted( + name + for name, count in Counter(entry.name for entry in entries).items() + if count > 1 + ) + if duplicates: + raise SimulationBackendError( + f"Duplicate simulation backend entry-point names: {', '.join(duplicates)}." + ) + for entry in entries: + if entry.name in _BACKENDS: + raise SimulationBackendError( + f"Simulation backend {entry.name!r} is already registered." + ) + _PENDING = _BACKENDS.copy() + for entry in entries: + try: + provider = entry.load() + if not callable(provider): + raise SimulationBackendError( + "Entry-point provider must be callable." + ) + registration = _validate_registration(provider()) + if registration.name != entry.name: + raise SimulationBackendError( + f"Entry-point name {entry.name!r} does not match registration name {registration.name!r}." + ) + register_simulation_backend(registration) + except Exception as error: + raise SimulationBackendError( + f"Could not load simulation backend {entry.name!r}: {error}" + ) from error + _BACKENDS.update(_PENDING) + _DISCOVERED = True + except SimulationBackendError: + raise + except Exception as error: + raise SimulationBackendError( + f"Could not discover simulation backends: {error}" + ) from error + finally: + _PENDING = None + + +def get_sysid_backend(name: str) -> SysIdBackend: + """Return a discovered backend's identification capability or fail early.""" + + discover_sysid_backends() + registration = _BACKENDS.get(name) + if registration is None: + raise SimulationBackendError(f"Unknown simulation backend {name!r}.") + if registration.sysid is None: + raise SimulationBackendError( + f"Simulation backend {name!r} does not support system identification." + ) + return registration.sysid + + +def create_sysid_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any]: + """Create and verify the concrete resource promised by a backend registration.""" + + backend = get_sysid_backend(config.simulation.type) + context = backend.create_context(config) + expected = _BACKENDS[config.simulation.type].context_type + if type(context) is not expected: + raise SimulationBackendError( + f"Backend {config.simulation.type!r} returned context type {type(context).__name__}; expected {expected.__name__}." + ) + return context + + +class _SimulationContexts(Mapping[str, type[SimulationContext[Any, Any]]]): + """Compatibility view over the single canonical backend registry.""" + + def __getitem__(self, name: str) -> type[SimulationContext[Any, Any]]: + _ensure_builtin() + return _BACKENDS[name].context_type + + def __iter__(self) -> Iterator[str]: + _ensure_builtin() + return iter(_BACKENDS) + + def __len__(self) -> int: + _ensure_builtin() + return len(_BACKENDS) + + +SIMULATION_CONTEXTS: Mapping[str, type[SimulationContext[Any, Any]]] = ( + _SimulationContexts() +) def create_simulation_context( @@ -21,10 +284,11 @@ def create_simulation_context( *, fixed_base: bool = False, ) -> SimulationContext[Any, Any]: - """Create the simulation context registered for a configured backend.""" + """Preserve the training adapter's path-based construction API.""" try: context_type = SIMULATION_CONTEXTS[backend] except KeyError as error: raise ValueError(f"Unknown simulation backend {backend!r}.") from error - return context_type(usd_path, fixed_base=fixed_base) + constructor = cast(Callable[..., SimulationContext[Any, Any]], context_type) + return constructor(usd_path, fixed_base=fixed_base) diff --git a/anchor_bench/errors.py b/anchor_bench/errors.py index bdbba63..135dc2e 100644 --- a/anchor_bench/errors.py +++ b/anchor_bench/errors.py @@ -38,3 +38,7 @@ class MLOpsBackendNotFoundError(MLOpsError): class MLOpsTrackingError(MLOpsError): """Raised when an MLOps backend cannot create or update a tracked run.""" + + +class SimulationBackendError(AnchorBenchError): + """Raised when simulation backend registration or discovery fails.""" diff --git a/anchor_bench/schema/actuator_sys_id.py b/anchor_bench/schema/actuator_sys_id.py index c8401bd..9a63102 100644 --- a/anchor_bench/schema/actuator_sys_id.py +++ b/anchor_bench/schema/actuator_sys_id.py @@ -8,12 +8,36 @@ from math import isclose from typing import Annotated, List, Literal, Optional, Union -from pydantic import Field, StrictFloat, StrictInt, field_validator, model_validator +from pydantic import ( + Field, + SerializeAsAny, + StrictFloat, + StrictInt, + field_validator, + model_validator, +) from typing_extensions import TypeAlias from anchor_bench.schema.base import BaseConfig, StrictBaseModel from anchor_bench.schema.dataset import ParquetDatasetConfig from anchor_bench.schema.mlops import MLOpsConfig +from anchor_bench.schema.simulation import ( + NewtonSimulationConfig, + SysIdSimulationConfig, + WarpMujocoSolverConfig, +) + +__all__ = [ + "ActuatorSysIdConfig", + "Bound", + "CmaesOptimizerConfig", + "ControllerClamps", + "JointParameterGroup", + "JointParameters", + "NewtonSimulationConfig", + "PdControllerConfig", + "WarpMujocoSolverConfig", +] JsonNumber: TypeAlias = Union[StrictInt, StrictFloat] NonEmptyString: TypeAlias = Annotated[str, Field(min_length=1)] @@ -93,28 +117,6 @@ def physical_parameter_bounds_must_be_nonnegative(self) -> JointParameterGroup: return self -class WarpMujocoSolverConfig(StrictBaseModel): - type: Literal["warp_mujoco"] - integrator: NonEmptyString = "implicitfast" - solver_iterations: PositiveInteger - line_search_iterations: NonNegativeInteger - - -class NewtonSimulationConfig(StrictBaseModel): - type: Literal["newton"] - usd_path: NonEmptyString - physics_freq: PositiveInteger - control_freq: PositiveInteger - render_freq: PositiveInteger - solver: WarpMujocoSolverConfig - - @model_validator(mode="after") - def validate_frequencies(self) -> NewtonSimulationConfig: - if self.physics_freq % self.control_freq != 0: - raise ValueError("physics_freq must be divisible by control_freq") - return self - - class ActuatorSysIdConfig(BaseConfig): type: Literal["actuator_sys_id"] # pyright: ignore[reportIncompatibleVariableOverride] description: Optional[str] = None @@ -125,13 +127,32 @@ class ActuatorSysIdConfig(BaseConfig): ) joint_parameters: Annotated[List[JointParameterGroup], Field(min_length=1)] optimizer: CmaesOptimizerConfig - simulation: NewtonSimulationConfig + simulation: SerializeAsAny[SysIdSimulationConfig] num_envs: CmaesPopulationSize = 64 buffer_time: NonNegativeNumber = 0.0 seed: NonNegativeInteger = 0 output_dir: NonEmptyString = "outputs/actuator_sys_id" dataset: ParquetDatasetConfig + @field_validator("simulation", mode="before") + @classmethod + def dispatch_simulation(cls, value: object) -> SysIdSimulationConfig: + from anchor_bench.core.simulation.registry import get_sysid_backend + + if isinstance(value, SysIdSimulationConfig): + backend = get_sysid_backend(value.type) + if type(value) is not backend.config_model: + raise ValueError( + "simulation config must use the registered config model" + ) + return backend.config_model.model_validate(value.model_dump()) + if not isinstance(value, dict): + raise ValueError("simulation must be a configuration object") # noqa: TRY004 - Pydantic validation errors require ValueError + backend_name = value.get("type") + if not isinstance(backend_name, str): + raise ValueError("simulation must define a string type") # noqa: TRY004 - Pydantic validation errors require ValueError + return get_sysid_backend(backend_name).config_model.model_validate(value) + @model_validator(mode="after") def validate_task_invariants(self) -> ActuatorSysIdConfig: names = [ diff --git a/anchor_bench/schema/simulation.py b/anchor_bench/schema/simulation.py new file mode 100644 index 0000000..8fb6e2e --- /dev/null +++ b/anchor_bench/schema/simulation.py @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Backend-neutral system-identification simulation configuration.""" + +from __future__ import annotations + +from typing import Annotated, Literal + +from pydantic import Field, JsonValue, StrictInt, model_validator + +from anchor_bench.schema.base import StrictBaseModel + +__all__ = [ + "JsonValue", + "NewtonSimulationConfig", + "SysIdSimulationConfig", + "WarpMujocoSolverConfig", +] + +PositiveInteger = Annotated[StrictInt, Field(ge=1)] +NonNegativeInteger = Annotated[StrictInt, Field(ge=0)] +NonEmptyString = Annotated[str, Field(min_length=1)] + + +class SysIdSimulationConfig(StrictBaseModel): + """Timing shared by all registered system-identification backends.""" + + type: NonEmptyString + physics_freq: PositiveInteger + control_freq: PositiveInteger + render_freq: PositiveInteger + + @model_validator(mode="after") + def validate_frequencies(self) -> SysIdSimulationConfig: + if self.physics_freq % self.control_freq != 0: + raise ValueError("physics_freq must be divisible by control_freq") + return self + + +class WarpMujocoSolverConfig(StrictBaseModel): + type: Literal["warp_mujoco"] + integrator: NonEmptyString = "implicitfast" + solver_iterations: PositiveInteger + line_search_iterations: NonNegativeInteger + + +class NewtonSimulationConfig(SysIdSimulationConfig): + type: Literal["newton"] # pyright: ignore[reportIncompatibleVariableOverride] + usd_path: NonEmptyString + solver: WarpMujocoSolverConfig diff --git a/anchor_bench/tasks/actuator_sys_id/__init__.py b/anchor_bench/tasks/actuator_sys_id/__init__.py index 3373409..b704a3d 100644 --- a/anchor_bench/tasks/actuator_sys_id/__init__.py +++ b/anchor_bench/tasks/actuator_sys_id/__init__.py @@ -1,9 +1,32 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Native-Newton actuator system-identification task.""" +"""Actuator system-identification task and result.""" -from anchor_bench.tasks.actuator_sys_id.model import SysIdResult -from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask +from importlib import import_module +from typing import TYPE_CHECKING, Any + +if TYPE_CHECKING: + from anchor_bench.tasks.actuator_sys_id.model import SysIdResult + from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask + +_EXPORTS = { + "ActuatorSysIdTask": ( + "anchor_bench.tasks.actuator_sys_id.task", + "ActuatorSysIdTask", + ), + "SysIdResult": ("anchor_bench.tasks.actuator_sys_id.model", "SysIdResult"), +} __all__ = ["ActuatorSysIdTask", "SysIdResult"] + + +def __getattr__(name: str) -> Any: + """Resolve public exports without importing task or simulator runtimes eagerly.""" + + if name not in _EXPORTS: + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + module_name, attribute = _EXPORTS[name] + value = getattr(import_module(module_name), attribute) + globals()[name] = value + return value diff --git a/anchor_bench/tasks/actuator_sys_id/artifacts.py b/anchor_bench/tasks/actuator_sys_id/artifacts.py index 7e55b3d..276b7a3 100644 --- a/anchor_bench/tasks/actuator_sys_id/artifacts.py +++ b/anchor_bench/tasks/actuator_sys_id/artifacts.py @@ -6,19 +6,20 @@ from __future__ import annotations import csv +from collections.abc import Mapping, Sequence from datetime import datetime, timezone from pathlib import Path -from typing import Sequence, Union import yaml from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import JsonValue from anchor_bench.tasks.actuator_sys_id.model import ( Candidate, GenerationRecord, + IdentifiedModelArtifact, SysIdResult, ) -from anchor_bench.tasks.actuator_sys_id.usd import write_identified_usd_layer def write_artifacts( @@ -27,15 +28,15 @@ def write_artifacts( best_parameters: Candidate, best_mse: float, history: Sequence[GenerationRecord], - source_usd_path: Union[str, Path], config: ActuatorSysIdConfig, + model_artifact: IdentifiedModelArtifact | None = None, + runtime_simulation: Mapping[str, JsonValue] | None = None, ) -> SysIdResult: - """Write the fitted parameters, USD layer, log, and resolved run summary.""" + """Write common results and record an optional backend-native model export.""" best_parameters_path = output_dir / "best_params.yaml" optimization_log_path = output_dir / "optimization_log.csv" run_summary_path = output_dir / "run_summary.yaml" - identified_usd_path = output_dir / "identified.usda" best_document = { "schema_version": 1, @@ -67,21 +68,12 @@ def write_artifacts( "best_mse": best_mse, "generations": len(history), } + if runtime_simulation is not None: + summary["runtime_simulation"] = dict(runtime_simulation) run_summary_path.write_text( yaml.safe_dump(summary, sort_keys=False), encoding="utf-8", ) - write_identified_usd_layer( - source_usd_path, - identified_usd_path, - best_parameters, - { - joint_name: group.controller.clamps - for group in config.joint_parameters - for joint_name in group.names - }, - config.model_dump_json(), - ) return SysIdResult( best_parameters=best_parameters, best_mse=best_mse, @@ -90,5 +82,10 @@ def write_artifacts( best_parameters_path=best_parameters_path, optimization_log_path=optimization_log_path, run_summary_path=run_summary_path, - identified_usd_path=identified_usd_path, + identified_model_path=model_artifact.path if model_artifact else None, + identified_usd_path=( + model_artifact.path + if model_artifact is not None and model_artifact.format == "usd" + else None + ), ) diff --git a/anchor_bench/tasks/actuator_sys_id/backends/__init__.py b/anchor_bench/tasks/actuator_sys_id/backends/__init__.py new file mode 100644 index 0000000..8e74906 --- /dev/null +++ b/anchor_bench/tasks/actuator_sys_id/backends/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Backend-specific actuator identification adapters, imported on demand.""" diff --git a/anchor_bench/tasks/actuator_sys_id/backends/newton.py b/anchor_bench/tasks/actuator_sys_id/backends/newton.py new file mode 100644 index 0000000..bae718e --- /dev/null +++ b/anchor_bench/tasks/actuator_sys_id/backends/newton.py @@ -0,0 +1,74 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Newton evaluation and native USD export for system identification.""" + +from __future__ import annotations + +from collections.abc import Mapping +from pathlib import Path +from typing import Any + +from anchor_bench.core.simulation import SimulationContext +from anchor_bench.core.simulation.newton import NewtonSimulationContext +from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import JsonValue, NewtonSimulationConfig +from anchor_bench.tasks.actuator_sys_id.model import Candidate, IdentifiedModelArtifact +from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator +from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace +from anchor_bench.tasks.actuator_sys_id.simulation import NewtonPopulationEvaluator + + +def _simulation_config(config: ActuatorSysIdConfig) -> NewtonSimulationConfig: + if not isinstance(config.simulation, NewtonSimulationConfig): + raise TypeError("Newton backend requires NewtonSimulationConfig") + return config.simulation + + +def create_context(config: ActuatorSysIdConfig) -> NewtonSimulationContext: + """Resolve the fixed-base Newton resource selected by the run.""" + simulation = _simulation_config(config) + return NewtonSimulationContext(simulation.usd_path, fixed_base=True) + + +def create_evaluator( + config: ActuatorSysIdConfig, + space: ParameterSpace, + context: SimulationContext[Any, Any], +) -> NewtonPopulationEvaluator: + """Reuse the selected context for population evaluation.""" + if not isinstance(context, NewtonSimulationContext): + raise TypeError("Newton backend requires a Newton simulation context") + return NewtonPopulationEvaluator(config, space, simulation_context=context) + + +def export_model( + config: ActuatorSysIdConfig, + best: Candidate, + context: SimulationContext[Any, Any], + output: Path, +) -> IdentifiedModelArtifact: + """Author fitted actuator properties as the existing native USD layer.""" + from anchor_bench.tasks.actuator_sys_id.usd import write_identified_usd_layer + + simulation = _simulation_config(config) + path = output / "identified.usda" + write_identified_usd_layer( + simulation.usd_path, + path, + best, + { + joint: group.controller.clamps + for group in config.joint_parameters + for joint in group.names + }, + config.model_dump_json(), + ) + return IdentifiedModelArtifact(path, "usd") + + +def describe_runtime(evaluator: PopulationEvaluator) -> Mapping[str, JsonValue]: + """Describe Newton timing and solver configuration used by the evaluator.""" + if not isinstance(evaluator, NewtonPopulationEvaluator): + raise TypeError("Newton runtime description requires its population evaluator") + return evaluator.simulation_config.model_dump(mode="json") diff --git a/anchor_bench/tasks/actuator_sys_id/model.py b/anchor_bench/tasks/actuator_sys_id/model.py index fcdee09..c05437b 100644 --- a/anchor_bench/tasks/actuator_sys_id/model.py +++ b/anchor_bench/tasks/actuator_sys_id/model.py @@ -14,6 +14,14 @@ Candidate = Dict[str, Dict[str, float]] +@dataclass(frozen=True) +class IdentifiedModelArtifact: + """A backend-native model exported after identification.""" + + path: Path + format: str + + @dataclass(frozen=True) class Trajectory: """One aligned command/measurement episode.""" @@ -69,4 +77,5 @@ class SysIdResult: best_parameters_path: Path optimization_log_path: Path run_summary_path: Path - identified_usd_path: Path + identified_usd_path: Path | None = None + identified_model_path: Path | None = None diff --git a/anchor_bench/tasks/actuator_sys_id/simulation.py b/anchor_bench/tasks/actuator_sys_id/simulation.py index bdabba3..23299ab 100644 --- a/anchor_bench/tasks/actuator_sys_id/simulation.py +++ b/anchor_bench/tasks/actuator_sys_id/simulation.py @@ -16,6 +16,7 @@ from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.core.simulation.registry import create_simulation_context from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import NewtonSimulationConfig from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace @@ -71,7 +72,12 @@ def __init__( self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace, + *, + simulation_context: NewtonSimulationContext | None = None, ) -> None: + if not isinstance(config.simulation, NewtonSimulationConfig): + raise TypeError("Newton evaluator requires NewtonSimulationConfig") + self.simulation_config = config.simulation self.config = config self.parameter_space = parameter_space self.joint_names = _joint_names(config) @@ -92,20 +98,25 @@ def __init__( _joint_delay_steps(config, self.control_dt), dtype=np.int64, ) - self._initialize_simulation() + self._initialize_simulation(simulation_context) self._initialize_score_buffers() self._simulation_context.capture_step_graph( dt=self.physics_dt * self.control_substeps, substeps=self.control_substeps, ) - def _initialize_simulation(self) -> None: + def _initialize_simulation( + self, + simulation_context: NewtonSimulationContext | None = None, + ) -> None: initial = self.parameter_space.decode(self.parameter_space.initial_normalized) - context = create_simulation_context( - self.config.simulation.type, - self.config.simulation.usd_path, - fixed_base=True, - ) + context = simulation_context + if context is None: + context = create_simulation_context( + self.simulation_config.type, + self.simulation_config.usd_path, + fixed_base=True, + ) if not isinstance(context, NewtonSimulationContext): raise TypeError("actuator_sys_id requires a Newton simulation context") self._simulation_context = context @@ -114,7 +125,7 @@ def configure_template(template: newton.ModelBuilder) -> None: template_indices = _builder_joint_indices(template, self.joint_names) self._configure_template(template, template_indices, initial) - solver_config = self.config.simulation.solver + solver_config = self.simulation_config.solver context.initialize( world_count=self.num_envs, configure_builder=configure_template, diff --git a/anchor_bench/tasks/actuator_sys_id/task.py b/anchor_bench/tasks/actuator_sys_id/task.py index 2aed5de..0181766 100644 --- a/anchor_bench/tasks/actuator_sys_id/task.py +++ b/anchor_bench/tasks/actuator_sys_id/task.py @@ -8,6 +8,10 @@ import logging from pathlib import Path +from anchor_bench.core.simulation.registry import ( + create_sysid_context, + get_sysid_backend, +) from anchor_bench.logging_utils import should_log_progress from anchor_bench.mlops import get_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig @@ -17,16 +21,16 @@ from anchor_bench.tasks.actuator_sys_id.objective import ActuatorSysIdObjective from anchor_bench.tasks.actuator_sys_id.optimizer import create_optimizer from anchor_bench.tasks.actuator_sys_id.parameter_space import create_parameter_space -from anchor_bench.tasks.actuator_sys_id.simulation import NewtonPopulationEvaluator from anchor_bench.tasks.base_task import BaseTask logger = logging.getLogger(__name__) class ActuatorSysIdTask(BaseTask[ActuatorSysIdConfig]): - """Fit actuator parameters by replaying recorded commands in Newton.""" + """Fit actuator parameters with the configured simulation backend.""" def run(self, output_directory: Path) -> Path: + backend = get_sysid_backend(self.config.simulation.type) mlops_run = get_active_run() joint_names = [ joint for group in self.config.joint_parameters for joint in group.names @@ -41,7 +45,8 @@ def run(self, output_directory: Path) -> Path: ) parameter_space = create_parameter_space(self.config) optimizer = create_optimizer(self.config, parameter_space) - evaluator = NewtonPopulationEvaluator(self.config, parameter_space) + context = create_sysid_context(self.config) + evaluator = backend.create_evaluator(self.config, parameter_space, context) objective = ActuatorSysIdObjective( parameter_space, evaluator, @@ -78,13 +83,26 @@ def run(self, output_directory: Path) -> Path: ) best_parameters = parameter_space.decode(optimizer.best_candidate) + model_artifact = ( + backend.export_model( + self.config, best_parameters, context, output_directory + ) + if backend.export_model is not None + else None + ) + runtime_simulation = ( + backend.describe_runtime(evaluator) + if backend.describe_runtime is not None + else None + ) write_artifacts( output_directory, best_parameters=best_parameters, best_mse=optimizer.best_score, history=history, - source_usd_path=self.config.simulation.usd_path, config=self.config, + model_artifact=model_artifact, + runtime_simulation=runtime_simulation, ) # Upload only after every SysID output file is finalized. TaskRunner # separately owns the completion marker and tracked-run status. diff --git a/docs/system-identification.md b/docs/system-identification.md index 1297b52..cba53b0 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -101,8 +101,69 @@ uv run anchor-bench \ ``` The runtime loads the configured trajectories, evaluates optimizer candidates -in Newton, and stops when the optimizer reaches its iteration or convergence -condition. +with the selected simulator backend, and stops when the optimizer reaches its +iteration or convergence condition. + +## Register another simulator + +A backend supplies its own strict simulation configuration, resource context, +and population evaluator. Its configuration extends +`anchor_bench.schema.simulation.SysIdSimulationConfig`, retaining the shared +timing fields and declaring its own `type` and simulator settings. Its context +extends `SimulationContext` with a hashable `resource_key` and a parameterless +`_load()` that returns its model and initial state. + +Register these components through the Python API before validating a task: + +```python +from anchor_bench.core.simulation.registry import ( + SimulationBackend, + SysIdBackend, + register_simulation_backend, +) + +registration = SimulationBackend( + name="my_simulator", + context_type=MySimulationContext, + sysid=SysIdBackend( + config_model=MySimulationConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, + ), +) +register_simulation_backend(registration) +``` + +The classes and callbacks in this example are supplied by the plugin. +`create_context(config)` returns the registered context type. +`create_evaluator(config, parameter_space, context)` receives that same context +and returns an object implementing `evaluate(population, trajectories)`: one +finite position-MSE score per decoded candidate. The evaluator owns its +simulator's candidate application, resets, command delay, buffer exclusion, +actuation, and stepping. The task retains dataset loading and optimization. + +An installed package can expose a zero-argument provider that returns the +`SimulationBackend` registration, using this entry-point group: + +```toml +[project.entry-points."anchor_bench.sysid_backends"] +my_simulator = "my_package.backend:provide_backend" +``` + +The entry-point name, registration name, and configuration `type` must agree. +Discovery runs before direct configuration validation and YAML parsing; +duplicate names and invalid providers fail before optimization. Select the +backend using `simulation.type: my_simulator` and provide its configuration +fields. Plugin fields survive configuration serialization and hashing. + +Model export is optional. An exporter receives `(config, best_parameters, +context, output_directory)` and returns an `IdentifiedModelArtifact(path, +format)` or `None`. The result exposes the returned path through +`SysIdResult.identified_model_path`; only an explicit `format="usd"` also +supplies the compatibility `identified_usd_path`. An optional +`describe_runtime(evaluator)` callback returns +JSON-compatible runtime settings for `run_summary.yaml`. ## Artifacts @@ -114,7 +175,7 @@ run writes: | `best_params.yaml` | Best candidate, position MSE, and result schema metadata. | | `optimization_log.csv` | Best and population-mean MSE for each generation. | | `run_summary.yaml` | Timestamp, best MSE, metric name, and generation count. | -| `identified.usda` | USD layer containing the fitted actuator opinions. | +| `identified.usda` | Newton's USD layer containing the fitted actuator opinions. Other backends can export a different format or omit model export. | When MLOps tracking is enabled, the task also reports per-generation metrics and uploads the finalized directory as the `sysid-output` artifact collection. diff --git a/tests/fixtures/sysid_backend/run_cli.py b/tests/fixtures/sysid_backend/run_cli.py new file mode 100644 index 0000000..e72948b --- /dev/null +++ b/tests/fixtures/sysid_backend/run_cli.py @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Enter the real CLI with Newton construction forbidden in this process.""" + +import newton + +from anchor_bench.core.simulation.newton import NewtonSimulationContext + + +def forbid_newton(*args: object, **kwargs: object) -> None: + raise AssertionError("installed toy backend must not construct Newton resources") + + +NewtonSimulationContext.__new__ = staticmethod(forbid_newton) # pyright: ignore[reportAttributeAccessIssue] +newton.ModelBuilder = forbid_newton # pyright: ignore[reportAssignmentType] + +# Import the CLI only after installing the construction guards. +from anchor_bench.cli import main + +raise SystemExit(main()) diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py new file mode 100644 index 0000000..f0ffc5b --- /dev/null +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -0,0 +1,124 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""A path-free installed backend for exercising the real sysID CLI.""" + +from __future__ import annotations + +import json +from collections.abc import Sequence +from pathlib import Path +from typing import Any, Literal, cast + +import numpy as np + +from anchor_bench.core.simulation import SimulationContext +from anchor_bench.core.simulation.registry import SimulationBackend, SysIdBackend +from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import SysIdSimulationConfig +from anchor_bench.tasks.actuator_sys_id.model import ( + Candidate, + IdentifiedModelArtifact, + Trajectory, +) +from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray +from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace + + +class ToyConfig(SysIdSimulationConfig): + type: Literal["toy-sysid"] = "toy-sysid" # pyright: ignore[reportIncompatibleVariableOverride] + gain: float + model_name: str + + +class ToyContext(SimulationContext[float, float]): + """Load a scalar response model without any USD resource.""" + + def _load(self) -> tuple[float, float]: + _, gain = cast(tuple[str, float], self.resource_key) + return float(gain), 0.0 + + +class ToyEvaluator: + def __init__(self, context: ToyContext) -> None: + self._gain = context.model + + def evaluate( + self, + population: Sequence[Candidate], + trajectories: Sequence[Trajectory], + ) -> FloatArray: + scores = [] + for candidate in population: + squared_errors = [] + for trajectory in trajectories: + stiffness = candidate[trajectory.joint_names[0]]["stiffness"] + predicted = trajectory.commanded_position * stiffness / self._gain + squared_errors.extend( + np.square(predicted - trajectory.measured_position).ravel() + ) + scores.append(float(np.mean(squared_errors))) + return np.asarray(scores, dtype=np.float64) + + +def create_context(config: ActuatorSysIdConfig) -> ToyContext: + simulation = config.simulation + if not isinstance(simulation, ToyConfig): + raise TypeError("toy backend requires its registered config model") + return ToyContext(resource_key=(simulation.model_name, simulation.gain)) + + +def create_evaluator( + config: ActuatorSysIdConfig, + space: ParameterSpace, + context: SimulationContext[Any, Any], +) -> ToyEvaluator: + if not isinstance(context, ToyContext): + raise TypeError("toy evaluator requires its registered context") + return ToyEvaluator(context) + + +def export_model( + config: ActuatorSysIdConfig, + best: Candidate, + context: SimulationContext[Any, Any], + output: Path, +) -> IdentifiedModelArtifact: + path = output / "identified.json" + path.write_text( + json.dumps( + { + "parameters": best, + "simulation": config.simulation.model_dump(mode="json"), + "gain": context.model, + }, + sort_keys=True, + ), + encoding="utf-8", + ) + return IdentifiedModelArtifact(path=path, format="json") + + +def provide_json() -> SimulationBackend: + return SimulationBackend( + name="toy-sysid", + context_type=ToyContext, + sysid=SysIdBackend( + config_model=ToyConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, + ), + ) + + +def provide_no_export() -> SimulationBackend: + return SimulationBackend( + name="toy-sysid", + context_type=ToyContext, + sysid=SysIdBackend( + config_model=ToyConfig, + create_context=create_context, + create_evaluator=create_evaluator, + ), + ) diff --git a/tests/integration/test_sysid_backend_cli.py b/tests/integration/test_sysid_backend_cli.py new file mode 100644 index 0000000..d0bb20f --- /dev/null +++ b/tests/integration/test_sysid_backend_cli.py @@ -0,0 +1,188 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Fresh-process installed-plugin discovery through the complete sysID CLI.""" + +from __future__ import annotations + +import csv +import json +import math +import os +import shutil +import subprocess +import sys +from pathlib import Path + +import pandas as pd +import pytest +import yaml + +pytestmark = pytest.mark.integration + +REPOSITORY = Path(__file__).resolve().parents[2] +FIXTURE = REPOSITORY / "tests" / "fixtures" / "sysid_backend" +COMMON_OUTPUTS = ( + ".completed", + "config.yaml", + "best_params.yaml", + "optimization_log.csv", + "run_summary.yaml", +) + + +@pytest.fixture +def installed_backend(tmp_path: Path) -> Path: + """Install an importable package and distribution metadata on a private path.""" + installed = tmp_path / "site-packages" + installed.mkdir() + shutil.copytree(FIXTURE / "toy_sysid_backend", installed / "toy_sysid_backend") + distribution = installed / "anchor_bench_toy_sysid-1.0.dist-info" + distribution.mkdir() + (distribution / "METADATA").write_text( + "Metadata-Version: 2.1\nName: anchor-bench-toy-sysid\nVersion: 1.0\n", + encoding="utf-8", + ) + return installed + + +def _write_config(tmp_path: Path) -> Path: + rows = [ + { + "time_ns": timestamp, + "experiment": "toy-wave", + "field": field, + "value": value, + } + for field, values in ( + ("hip/command_q", [0.0, 1.0, -0.5, 0.75]), + ("hip/actual_q", [0.0, 0.65, -0.325, 0.4875]), + ) + for timestamp, value in zip((0, 10_000_000, 20_000_000, 30_000_000), values) + ] + parquet = tmp_path / "recording.parquet" + pd.DataFrame(rows).to_parquet(parquet, index=False) + document = { + "type": "actuator_sys_id", + "joint_parameters": [ + { + "names": ["hip"], + "controller": { + "type": "pd", + "clamps": {"effort_limit": 10.0, "velocity_limit": 10.0}, + "stiffness": {"lower": 0.5, "upper": 3.0}, + "damping": {"lower": 0.0, "upper": 1.0}, + }, + "parameters": { + "dry_friction": {"lower": 0.0, "upper": 0.1}, + "viscous_friction": {"lower": 0.0, "upper": 0.1}, + "armature": {"lower": 0.0, "upper": 0.1}, + }, + } + ], + "optimizer": { + "type": "python-cmaes", + "sigma": 0.4, + "max_iterations": 3, + "epsilon": 0.0001, + }, + "simulation": { + "type": "toy-sysid", + "physics_freq": 200, + "control_freq": 100, + "render_freq": 50, + "gain": 2.5, + "model_name": "path-free-response", + }, + "num_envs": 6, + "seed": 17, + "dataset": { + "type": "parquet", + "source": str(parquet), + "resampling": {"type": "uniform", "dt": 0.01}, + }, + } + config = tmp_path / "config.yaml" + config.write_text(yaml.safe_dump(document), encoding="utf-8") + return config + + +@pytest.mark.parametrize("export_json", [True, False], ids=["json-export", "no-export"]) +def test_cli_discovers_installed_sysid_backend( + tmp_path: Path, + installed_backend: Path, + export_json: bool, +) -> None: + provider = "provide_json" if export_json else "provide_no_export" + distribution = installed_backend / "anchor_bench_toy_sysid-1.0.dist-info" + (distribution / "entry_points.txt").write_text( + f"[anchor_bench.sysid_backends]\ntoy-sysid = toy_sysid_backend:{provider}\n", + encoding="utf-8", + ) + config = _write_config(tmp_path) + environment = dict(os.environ) + environment["PYTHONPATH"] = os.pathsep.join( + [str(installed_backend), str(REPOSITORY), environment.get("PYTHONPATH", "")] + ) + outputs = [tmp_path / "first-run", tmp_path / "repeat-run"] + for output in outputs: + result = subprocess.run( + [ + sys.executable, + str(FIXTURE / "run_cli.py"), + "--config", + str(config), + "--output", + str(output), + ], + cwd=tmp_path, + env=environment, + capture_output=True, + text=True, + timeout=120, + check=False, + ) + assert result.returncode == 0, result.stdout + result.stderr + assert all((output / filename).is_file() for filename in COMMON_OUTPUTS) + assert not (output / "identified.usda").exists() + assert (output / "identified.json").exists() is export_json + + resolved = yaml.safe_load((output / "config.yaml").read_text()) + assert resolved["simulation"] == { + "type": "toy-sysid", + "physics_freq": 200, + "control_freq": 100, + "render_freq": 50, + "gain": 2.5, + "model_name": "path-free-response", + } + best = yaml.safe_load((output / "best_params.yaml").read_text()) + summary = yaml.safe_load((output / "run_summary.yaml").read_text()) + assert summary["generations"] == 3 + assert summary["best_mse"] == best["best_mse"] + assert math.isfinite(best["best_mse"]) + # Mean command square is (1 + 0.25 + 0.5625) / 4 for this recording. + stiffness = best["parameters"]["hip"]["stiffness"] + assert best["best_mse"] == pytest.approx( + 0.453125 * (stiffness / 2.5 - 0.65) ** 2 + ) + with (output / "optimization_log.csv").open(newline="") as stream: + history = list(csv.DictReader(stream)) + assert len(history) == 3 + assert [int(row["generation"]) for row in history] == [0, 1, 2] + assert all( + math.isfinite(float(row[column])) + for row in history + for column in ("best_mse", "population_mean_mse") + ) + assert float(history[-1]["best_mse"]) == best["best_mse"] + if export_json: + model = json.loads((output / "identified.json").read_text()) + assert model["parameters"] == best["parameters"] + assert model["simulation"] == resolved["simulation"] + assert model["gain"] == 2.5 + + for filename in ("best_params.yaml", "optimization_log.csv"): + assert (outputs[0] / filename).read_text() == ( + outputs[1] / filename + ).read_text() diff --git a/tests/integration/usd_trajectory.py b/tests/integration/usd_trajectory.py index 0abb99f..1fa4a3e 100644 --- a/tests/integration/usd_trajectory.py +++ b/tests/integration/usd_trajectory.py @@ -14,6 +14,7 @@ from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import NewtonSimulationConfig from anchor_bench.tasks.actuator_sys_id.dataset import load_trajectories from anchor_bench.tasks.actuator_sys_id.model import Trajectory @@ -94,10 +95,13 @@ class _NewtonTrajectoryRunner: """Replay measured commands using actuator properties authored in one USD.""" def __init__(self, config: ActuatorSysIdConfig) -> None: + simulation = config.simulation + if not isinstance(simulation, NewtonSimulationConfig): + raise TypeError("USD trajectory replay requires NewtonSimulationConfig") builder = newton.ModelBuilder() newton.solvers.SolverMuJoCo.register_custom_attributes(builder) builder.add_usd( - source=str(Path(config.simulation.usd_path).resolve()), + source=str(Path(simulation.usd_path).resolve()), floating=False, ) self._model = builder.finalize() @@ -107,9 +111,9 @@ def __init__(self, config: ActuatorSysIdConfig) -> None: self._solver = newton.solvers.SolverMuJoCo( self._model, solver="newton", - iterations=config.simulation.solver.solver_iterations, - ls_iterations=config.simulation.solver.line_search_iterations, - integrator=config.simulation.solver.integrator, + iterations=simulation.solver.solver_iterations, + ls_iterations=simulation.solver.line_search_iterations, + integrator=simulation.solver.integrator, ) self._newton = newton self._contacts = self._collision_pipeline.contacts() diff --git a/tests/test_actuator_sys_id_config.py b/tests/test_actuator_sys_id_config.py index 9ef71bf..41297d3 100644 --- a/tests/test_actuator_sys_id_config.py +++ b/tests/test_actuator_sys_id_config.py @@ -8,6 +8,7 @@ from anchor_bench.schema.actuator_sys_id import ( ActuatorSysIdConfig, + NewtonSimulationConfig, PdControllerConfig, ) from anchor_bench.schema.dataset import ParquetDatasetConfig @@ -78,6 +79,7 @@ def test_model_matches_schema_and_applies_defaults(valid_config_data): assert config.dataset.resampling.dt == 0.005 assert isinstance(config.joint_parameters[0].controller, PdControllerConfig) assert config.joint_parameters[0].controller.delay_duration_ms == 0 + assert isinstance(config.simulation, NewtonSimulationConfig) assert config.simulation.solver.integrator == "implicitfast" assert config.mlops is None @@ -189,3 +191,16 @@ def test_model_rejects_non_finite_numbers(valid_config_data): with pytest.raises(ValidationError): ActuatorSysIdConfig.model_validate(data) + + +def test_legacy_newton_config_names_reexport_neutral_models(): + from anchor_bench.schema.actuator_sys_id import WarpMujocoSolverConfig + from anchor_bench.schema.simulation import ( + NewtonSimulationConfig as NeutralNewtonConfig, + ) + from anchor_bench.schema.simulation import ( + WarpMujocoSolverConfig as NeutralSolverConfig, + ) + + assert NewtonSimulationConfig is NeutralNewtonConfig + assert WarpMujocoSolverConfig is NeutralSolverConfig diff --git a/tests/test_actuator_sys_id_simulation.py b/tests/test_actuator_sys_id_simulation.py index e7dcf2d..623be67 100644 --- a/tests/test_actuator_sys_id_simulation.py +++ b/tests/test_actuator_sys_id_simulation.py @@ -14,6 +14,7 @@ from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id import simulation as simulation_module from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory from anchor_bench.tasks.actuator_sys_id.parameter_space import create_parameter_space @@ -154,10 +155,12 @@ def test_actuator_config_rejects_dataset_timestep_mismatch(tmp_path): _config(tmp_path, dataset_dt=0.01) +@pytest.mark.parametrize("inject_context", [False, True]) def test_newton_evaluator_uses_shared_simulation_context( tmp_path, monkeypatch, caplog, + inject_context, ): class FakeArray: def __init__(self, values): @@ -218,6 +221,7 @@ def capture_step_graph(self, *, dt, substeps): requested_context = {} def create_context(backend, usd_path, *, fixed_base): + assert not inject_context, "injected context must be reused" requested_context.update( backend=backend, usd_path=usd_path, @@ -246,13 +250,22 @@ def create_context(backend, usd_path, *, fixed_base): ) with caplog.at_level(logging.DEBUG, logger=simulation_module.__name__): - evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + evaluator = NewtonPopulationEvaluator( + config, + create_parameter_space(config), + **( + {"simulation_context": cast(NewtonSimulationContext, context)} + if inject_context + else {} + ), + ) assert evaluator._simulation_context is context assert evaluator._simulation_context.control is context.control np.testing.assert_allclose(evaluator._base_targets, [1.0, 2.0]) assert context.created_world_count == config.num_envs - assert requested_context["fixed_base"] is True + if not inject_context: + assert requested_context["fixed_base"] is True assert context.template.joint_target_ke == [15.0] assert context.captured_step == (pytest.approx(0.005), 5) assert context.solver_options == { @@ -588,3 +601,22 @@ def launch_position_error(measured_positions, sample_index): assert score_sums.numpy_calls == 1 assert context.solver.reset_states == [context.state] assert len(context.solver.changed_flags) == 1 + + +def test_newton_evaluator_rejects_non_newton_config_before_loading( + tmp_path, monkeypatch +): + config = _config(tmp_path) + config.simulation = SysIdSimulationConfig( + type="other", + physics_freq=1000, + control_freq=200, + render_freq=60, + ) + + def unexpected(*args, **kwargs): + raise AssertionError("must validate backend config before loading resources") + + monkeypatch.setattr(simulation_module, "create_simulation_context", unexpected) + with pytest.raises(TypeError, match="NewtonSimulationConfig"): + NewtonPopulationEvaluator(config, create_parameter_space(config)) diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 536e25e..9658146 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -3,6 +3,9 @@ from __future__ import annotations +import builtins +import importlib +from typing import Literal from unittest.mock import Mock import numpy as np @@ -10,14 +13,23 @@ import pytest import yaml -from anchor_bench.errors import DatasetAlignmentError +from anchor_bench.core.simulation import SimulationContext, registry +from anchor_bench.core.simulation.registry import SimulationBackend, SysIdBackend +from anchor_bench.core.task_runner import TaskRunner +from anchor_bench.errors import DatasetAlignmentError, SimulationBackendError from anchor_bench.mlops import MLOpsRun, bind_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id import artifacts as artifacts_module from anchor_bench.tasks.actuator_sys_id import task as task_module from anchor_bench.tasks.actuator_sys_id.artifacts import write_artifacts from anchor_bench.tasks.actuator_sys_id.dataset import load_trajectories -from anchor_bench.tasks.actuator_sys_id.model import GenerationRecord, Trajectory +from anchor_bench.tasks.actuator_sys_id.model import ( + GenerationRecord, + IdentifiedModelArtifact, + SysIdResult, + Trajectory, +) from anchor_bench.tasks.actuator_sys_id.optimizer import OptimizationStep from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask @@ -78,6 +90,76 @@ def _config(tmp_path, **overrides): return ActuatorSysIdConfig.model_validate(data) +class ToySimulationConfig(SysIdSimulationConfig): + type: Literal["task-toy"] = "task-toy" # pyright: ignore[reportIncompatibleVariableOverride] + gain: float = 2.0 + + +class ToyContext(SimulationContext[object, object]): + def _load(self): + return object(), object() + + +@pytest.fixture +def register_toy(monkeypatch, tmp_path): + monkeypatch.setattr(SimulationContext, "_instance", None) + monkeypatch.setattr(registry, "_BACKENDS", registry._BACKENDS.copy()) + monkeypatch.setattr(registry, "_DISCOVERED", True) + + def register(create_evaluator, *, export_model=None, describe_runtime=None): + context = ToyContext(resource_key=("task-toy", str(tmp_path))) + + def create_context(config): + assert isinstance(config.simulation, ToySimulationConfig) + assert config.simulation.gain == 2.0 + return context + + registry.register_simulation_backend( + SimulationBackend( + "task-toy", + ToyContext, + SysIdBackend( + ToySimulationConfig, + create_context, + create_evaluator, + export_model, + describe_runtime, + ), + ) + ) + config = _config( + tmp_path, + simulation={ + "type": "task-toy", + "gain": 2.0, + "physics_freq": 1000, + "control_freq": 200, + "render_freq": 60, + }, + ) + return config, context + + return register + + +def test_sysid_result_preserves_eight_positional_argument_signature(tmp_path): + usd_path = tmp_path / "identified.usda" + + result = SysIdResult( + {"hip": {"armature": 0.05}}, + 0.25, + 2, + tmp_path, + tmp_path / "best_parameters.yaml", + tmp_path / "optimization_log.csv", + tmp_path / "run_summary.yaml", + usd_path, + ) + + assert result.identified_usd_path == usd_path + assert result.identified_model_path is None + + def test_load_trajectories_aligns_commanded_and_measured_data( tmp_path, monkeypatch, @@ -238,8 +320,9 @@ def test_load_trajectories_rejects_an_episode_without_a_transition( load_trajectories(_config(tmp_path).dataset, joint_names=["hip"]) -def test_task_runs_optimization_and_writes_artifacts(tmp_path, monkeypatch): - config = _config(tmp_path) +def test_task_uses_registered_evaluator_and_context( + tmp_path, monkeypatch, register_toy +): trajectory = Trajectory( experiment="wave", joint_names=["hip"], @@ -290,10 +373,30 @@ def write(output_dir, **values): task_module, "load_trajectories", lambda *args, **kwargs: [trajectory] ) monkeypatch.setattr(task_module, "create_optimizer", lambda *args: FakeOptimizer()) - monkeypatch.setattr( - task_module, - "NewtonPopulationEvaluator", - lambda *args: FakeEvaluator(), + evaluator = FakeEvaluator() + received = {} + + def create_evaluator(selected_config, space, selected_context): + received.update(config=selected_config, context=selected_context, space=space) + return evaluator + + def export_model(selected_config, best, selected_context, output): + assert selected_config is config + assert selected_context is context + assert output == output_directory + assert best["hip"]["stiffness"] == pytest.approx(20.0) + path = output / "identified.json" + path.write_text('{"model": "toy"}') + return IdentifiedModelArtifact(path, "json") + + def describe_runtime(selected_evaluator): + assert selected_evaluator is evaluator + return {"type": "task-toy", "effective_gain": 2.0} + + config, context = register_toy( + create_evaluator, + export_model=export_model, + describe_runtime=describe_runtime, ) monkeypatch.setattr(task_module, "write_artifacts", write) @@ -303,7 +406,13 @@ def write(output_dir, **values): assert result == output_directory assert written["best_mse"] == pytest.approx(0.25) - assert written["source_usd_path"] == config.simulation.usd_path + assert received["config"] is config + assert received["context"] is context + assert written["model_artifact"] == IdentifiedModelArtifact( + output_directory / "identified.json", + "json", + ) + assert written["runtime_simulation"] == {"type": "task-toy", "effective_gain": 2.0} assert written["config"] is config assert written["best_parameters"]["hip"]["stiffness"] == pytest.approx(20.0) assert written["history"] == [ @@ -324,7 +433,12 @@ def write(output_dir, **values): ) -def test_writes_fitted_parameters_and_generation_history(tmp_path, monkeypatch): +@pytest.mark.parametrize("model_format", [None, "json", "usd"]) +def test_common_artifacts_allow_missing_or_json_model_export( + tmp_path, + monkeypatch, + model_format, +): candidate = { "hip": { "stiffness": 20.0, @@ -334,40 +448,97 @@ def test_writes_fitted_parameters_and_generation_history(tmp_path, monkeypatch): "viscous_friction": 1.0, } } - output_dir = tmp_path / "output" output_dir.mkdir() - source_usd_path = tmp_path / "robot.usd" config = _config(tmp_path) - - def write_usd(source, output, parameters, controller_clamps, config_metadata): - assert source == source_usd_path - assert parameters == candidate - assert controller_clamps == { - "hip": config.joint_parameters[0].controller.clamps - } - assert config_metadata == config.model_dump_json() - output.write_text("#usda 1.0\n", encoding="utf-8") - return output - - monkeypatch.setattr( - artifacts_module, - "write_identified_usd_layer", - write_usd, - ) + model_artifact = None + if model_format is not None: + # Deliberately use the USD suffix for JSON: compatibility depends on format. + path = output_dir / "identified.usda" + path.write_text("exported") + model_artifact = IdentifiedModelArtifact(path, model_format) + + original_import = builtins.__import__ + + def guard_import(name, *args, **kwargs): + if name.endswith("actuator_sys_id.usd"): + raise AssertionError("common artifacts must not import USD support") + return original_import(name, *args, **kwargs) + + monkeypatch.setattr(builtins, "__import__", guard_import) + importlib.reload(artifacts_module) result = write_artifacts( output_dir, best_parameters=candidate, best_mse=0.125, history=[GenerationRecord(0, 0.125, 0.5)], - source_usd_path=source_usd_path, config=config, + model_artifact=model_artifact, + runtime_simulation={"type": "toy", "solver": {"iterations": 8}}, ) document = yaml.safe_load(result.best_parameters_path.read_text()) assert document["metric"] == "position_mse" assert document["parameters"] == candidate assert "0,0.125,0.5" in result.optimization_log_path.read_text() - assert result.run_summary_path.is_file() - assert result.identified_usd_path == output_dir / "identified.usda" - assert result.identified_usd_path.is_file() + summary = yaml.safe_load(result.run_summary_path.read_text()) + assert summary["best_mse"] == 0.125 + assert summary["generations"] == 1 + assert summary["runtime_simulation"] == {"type": "toy", "solver": {"iterations": 8}} + assert result.identified_model_path == ( + model_artifact.path if model_artifact else None + ) + assert result.identified_usd_path == ( + model_artifact.path if model_artifact and model_format == "usd" else None + ) + if model_artifact is None: + assert not (output_dir / "identified.usda").exists() + + +def test_export_failure_prevents_completion(tmp_path, monkeypatch, register_toy): + class Evaluator: + def evaluate(self, population, trajectories): + return np.asarray([1.0] * len(population)) + + def export_model(*args): + raise RuntimeError("toy export failed") + + config, _ = register_toy(lambda *args: Evaluator(), export_model=export_model) + config.num_envs = 4 + monkeypatch.setattr( + task_module, + "load_trajectories", + lambda *args, **kwargs: [ + Trajectory("wave", ["hip"], np.zeros((2, 1)), np.zeros((2, 1))) + ], + ) + config_path = tmp_path / "config.yaml" + config_path.write_text(yaml.safe_dump(config.model_dump(mode="json"))) + output = tmp_path / "failed" + with pytest.raises(RuntimeError, match="toy export failed"): + TaskRunner().run(str(config_path), output=output) + assert not (output / ".completed").exists() + assert not (output / "best_params.yaml").exists() + + +def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): + config = _config(tmp_path) + monkeypatch.setattr(registry, "_BACKENDS", registry._BACKENDS.copy()) + monkeypatch.setattr(registry, "_DISCOVERED", True) + registry.register_simulation_backend(SimulationBackend("resource-only", ToyContext)) + config.simulation = SysIdSimulationConfig( + type="resource-only", + physics_freq=1000, + control_freq=200, + render_freq=60, + ) + + def unexpected(*args, **kwargs): + raise AssertionError("must fail before optimization or dataset loading") + + monkeypatch.setattr(task_module, "load_trajectories", unexpected) + monkeypatch.setattr(task_module, "create_optimizer", unexpected) + with pytest.raises( + SimulationBackendError, match="does not support system identification" + ): + ActuatorSysIdTask(config).run(tmp_path) diff --git a/tests/test_data_processor_runner.py b/tests/test_data_processor_runner.py index 1e450ed..4e2b178 100644 --- a/tests/test_data_processor_runner.py +++ b/tests/test_data_processor_runner.py @@ -3,7 +3,6 @@ from __future__ import annotations -from pathlib import Path from types import SimpleNamespace from typing import Any @@ -80,7 +79,7 @@ def numpy(self) -> np.ndarray: class RunnerSimulationContext(SimulationContext): """Provide the shared context required by runner data processors.""" - def _load(self, usd_path: Path) -> tuple[Any, Any]: + def _load(self) -> tuple[Any, Any]: """Return inert model and state objects.""" model = SimpleNamespace( @@ -95,14 +94,11 @@ def _load(self, usd_path: Path) -> tuple[Any, Any]: @pytest.fixture(autouse=True) def simulation_context( monkeypatch: pytest.MonkeyPatch, - tmp_path: Path, ) -> RunnerSimulationContext: """Create the shared simulation context before running data processors.""" monkeypatch.setattr(SimulationContext, "_instance", None) - source = tmp_path / "robot.usda" - source.write_text("#usda 1.0", encoding="utf-8") - return RunnerSimulationContext(str(source)) + return RunnerSimulationContext(resource_key="data-processor-runner") @pytest.fixture diff --git a/tests/test_data_processors.py b/tests/test_data_processors.py index 387208e..f23d688 100644 --- a/tests/test_data_processors.py +++ b/tests/test_data_processors.py @@ -3,9 +3,8 @@ from __future__ import annotations -from pathlib import Path from types import SimpleNamespace -from typing import Any, Optional, Tuple +from typing import Any, Tuple import numpy as np import pandas as pd @@ -44,12 +43,9 @@ def process(self) -> pd.DataFrame: class RecordingSimulationContext(SimulationContext): - loaded_path: Optional[str] = None + def _load(self) -> Tuple[Any, Any]: + """Provide the model consumed through the current shared context.""" - def _load(self, usd_path: Path) -> Tuple[Any, Any]: - """Record the USD selected by the current context.""" - - self.loaded_path = str(usd_path) return SimpleNamespace( joint_label=["shoulder", "elbow"], joint_qd_start=FakeNewtonArray([0, 1, 2]), @@ -63,7 +59,6 @@ def _load(self, usd_path: Path) -> Tuple[Any, Any]: @pytest.fixture(autouse=True) def simulation_context( monkeypatch: pytest.MonkeyPatch, - tmp_path: Path, ) -> RecordingSimulationContext: """Create one process-wide context for every data processor test.""" @@ -72,9 +67,7 @@ def simulation_context( "_instance", None, ) - source = tmp_path / "robot.usda" - source.write_text("#usda 1.0", encoding="utf-8") - return RecordingSimulationContext(str(source)) + return RecordingSimulationContext(resource_key="data-processors") @pytest.fixture @@ -107,15 +100,12 @@ def test_base_data_processor_cannot_be_instantiated(dataset: pd.DataFrame) -> No def test_simulation_context_cannot_be_instantiated( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, ) -> None: - source = tmp_path / "robot.usda" - source.write_text("#usda 1.0", encoding="utf-8") monkeypatch.setattr(SimulationContext, "_instance", None) with pytest.raises(TypeError): - SimulationContext(str(source)) # pyright: ignore[reportAbstractUsage] + SimulationContext(resource_key="abstract") # pyright: ignore[reportAbstractUsage] def test_base_data_processor_uses_current_context( diff --git a/tests/test_newton_simulation_context.py b/tests/test_newton_simulation_context.py index 04d5f9e..ee860ad 100644 --- a/tests/test_newton_simulation_context.py +++ b/tests/test_newton_simulation_context.py @@ -142,7 +142,7 @@ def step(self, **values: Any) -> None: class OtherSimulationContext(SimulationContext): """Represent a second backend for singleton enforcement tests.""" - def _load(self, usd_path: Path) -> Tuple[Any, Any]: + def _load(self) -> Tuple[Any, Any]: """Return placeholder backend objects.""" return object(), object() @@ -426,7 +426,7 @@ def test_rejects_a_different_backend(tmp_path: Path) -> None: NewtonSimulationContext(str(source)) with pytest.raises(RuntimeError, match="Only one simulation backend"): - OtherSimulationContext(str(source)) + OtherSimulationContext(resource_key=(source.resolve(), False)) def test_rejects_different_import_configuration(tmp_path: Path) -> None: @@ -436,5 +436,28 @@ def test_rejects_different_import_configuration(tmp_path: Path) -> None: source.write_text("#usda 1.0", encoding="utf-8") NewtonSimulationContext(str(source), fixed_base=True) - with pytest.raises(RuntimeError, match="different base mode"): + with pytest.raises(RuntimeError, match="already uses resource key"): NewtonSimulationContext(str(source), fixed_base=False) + + +def test_resolved_usd_alias_reuses_newton_resources( + fake_newton_usd: Path, + monkeypatch: pytest.MonkeyPatch, +) -> None: + """Canonicalize backend-owned paths before assigning resource identity.""" + + monkeypatch.chdir(fake_newton_usd.parent) + alias = fake_newton_usd.parent / "alias.usda" + alias.symlink_to(fake_newton_usd) + context = NewtonSimulationContext("robot.usda", fixed_base=True) + model, state = context.load() + + repeated = NewtonSimulationContext(str(alias), fixed_base=True) + + assert repeated is context + assert context.usd_path == fake_newton_usd.resolve() + assert context.fixed_base is True + assert context.resource_key == (fake_newton_usd.resolve(), True) + assert repeated.model is model + assert repeated.state is state + assert FakeModelBuilder.instance_count == 2 diff --git a/tests/test_simulation_context.py b/tests/test_simulation_context.py new file mode 100644 index 0000000..9fa517c --- /dev/null +++ b/tests/test_simulation_context.py @@ -0,0 +1,100 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Backend-neutral resource identity and lifetime contracts.""" + +from __future__ import annotations + +from typing import Any + +import pytest + +from anchor_bench.core.simulation import SimulationContext + + +class ToyContext(SimulationContext[object, object]): + """Load in-memory resources without any filesystem dependency.""" + + load_count = 0 + + def _load(self) -> tuple[object, object]: + self.load_count += 1 + return object(), object() + + +class OtherToyContext(ToyContext): + """Represent an incompatible backend with the same resource key.""" + + +@pytest.fixture(autouse=True) +def reset_context(monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.setattr(SimulationContext, "_instance", None) + + +def test_path_free_context_loads_once() -> None: + context = ToyContext(resource_key=("toy", 2)) + + assert context.resource_key == ("toy", 2) + assert context.load_count == 0 + model, state = context.load() + assert context.model is model + assert context.state is state + assert context.load() == (model, state) + assert context.load_count == 1 + assert SimulationContext.current() is context + + +def test_equivalent_resource_keys_reuse_loaded_context() -> None: + context = ToyContext(resource_key=("toy", 2)) + model, state = context.load() + + resource_parts = ["toy", 2] + repeated = ToyContext(resource_key=tuple(resource_parts)) + + assert repeated is context + assert repeated.model is model + assert repeated.state is state + assert repeated.load_count == 1 + + +def test_repeated_resource_key_conflicts_leave_original_context_usable() -> None: + context = ToyContext(resource_key=("toy", 2)) + model, state = context.load() + + for _ in range(2): + with pytest.raises(RuntimeError, match="already uses"): + ToyContext(resource_key=("toy", 3)) + + assert ToyContext(resource_key=("toy", 2)) is context + assert context.model is model + assert context.state is state + assert context.load_count == 1 + + +def test_repeated_backend_conflicts_leave_original_context_usable() -> None: + context = ToyContext(resource_key=("toy", 2)) + + for _ in range(2): + with pytest.raises(RuntimeError, match="Only one simulation backend"): + OtherToyContext(resource_key=("toy", 2)) + + assert ToyContext(resource_key=("toy", 2)) is context + assert SimulationContext.current() is context + + +@pytest.mark.parametrize("resource_key", [["toy", 2], ("toy", [])]) +def test_unhashable_resource_key_does_not_claim_context(resource_key: Any) -> None: + with pytest.raises(TypeError, match="hashable"): + ToyContext(resource_key=resource_key) + + context = ToyContext(resource_key=("toy", 2)) + assert SimulationContext.current() is context + + +def test_resource_key_is_required_keyword_only() -> None: + context_type: Any = ToyContext + + with pytest.raises(TypeError): + context_type() + with pytest.raises(TypeError): + context_type(("toy", 2)) diff --git a/tests/test_simulation_registry.py b/tests/test_simulation_registry.py index 41c4ef7..7394542 100644 --- a/tests/test_simulation_registry.py +++ b/tests/test_simulation_registry.py @@ -30,3 +30,10 @@ def test_rejects_unknown_backend() -> None: with pytest.raises(ValueError, match="Unknown simulation backend 'missing'"): create_simulation_context("missing", "robot.usda") + + +def test_registry_exposes_typed_sysid_registration() -> None: + from anchor_bench.core.simulation import registry + + assert hasattr(registry, "SysIdBackend") + assert hasattr(registry, "register_simulation_backend") diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py new file mode 100644 index 0000000..27863c2 --- /dev/null +++ b/tests/test_sysid_backends.py @@ -0,0 +1,299 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +"""Typed plugin registration and transactional discovery boundaries.""" + +from __future__ import annotations + +import json +import subprocess +import sys +from copy import deepcopy +from dataclasses import FrozenInstanceError +from pathlib import Path +from types import SimpleNamespace +from typing import Any, Literal, cast + +import pytest +from pydantic import StrictInt, ValidationError + +from anchor_bench.core.artifacts import _hash_name +from anchor_bench.core.simulation import SimulationContext, registry +from anchor_bench.errors import SimulationBackendError +from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig +from anchor_bench.schema.simulation import SysIdSimulationConfig +from anchor_bench.tasks.actuator_sys_id.model import IdentifiedModelArtifact + + +class ToyConfig(SysIdSimulationConfig): + type: Literal["toy"] = "toy" # pyright: ignore[reportIncompatibleVariableOverride] + gain: StrictInt + + +class ToyContext(SimulationContext[object, object]): + def _load(self) -> tuple[object, object]: + return object(), object() + + +def toy_registration(name: str = "toy") -> registry.SimulationBackend: + return registry.SimulationBackend( + name=name, + context_type=ToyContext, + sysid=registry.SysIdBackend( + config_model=ToyConfig, + create_context=lambda config: ToyContext( + resource_key=("toy", config.simulation.physics_freq) + ), + create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] + ), + ) + + +@pytest.fixture(autouse=True) +def isolated_registry(monkeypatch: pytest.MonkeyPatch): + registry.discover_sysid_backends() + monkeypatch.setattr(registry, "_BACKENDS", registry._BACKENDS.copy()) + monkeypatch.setattr(registry, "_DISCOVERED", False) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: []) + monkeypatch.setattr(SimulationContext, "_instance", None) + + +@pytest.fixture +def toy_task_data(): + return { + "type": "actuator_sys_id", + "joint_parameters": [ + { + "names": ["joint"], + "controller": { + "type": "pd", + "clamps": {"effort_limit": 1, "velocity_limit": 1}, + "stiffness": {"lower": 0, "upper": 1}, + "damping": {"lower": 0, "upper": 1}, + }, + "parameters": { + key: {"lower": 0, "upper": 1} + for key in ("dry_friction", "viscous_friction", "armature") + }, + } + ], + "optimizer": { + "type": "python-cmaes", + "sigma": 1, + "max_iterations": 1, + "epsilon": 0.1, + }, + "simulation": { + "type": "toy", + "gain": 2, + "physics_freq": 1000, + "control_freq": 200, + "render_freq": 60, + }, + "dataset": { + "type": "parquet", + "source": "toy.parquet", + "resampling": {"type": "uniform", "dt": 0.005}, + }, + } + + +def test_plugin_simulation_roundtrips_without_losing_fields(toy_task_data): + registry.register_simulation_backend(toy_registration()) + config = ActuatorSysIdConfig.model_validate(toy_task_data) + assert isinstance(config.simulation, ToyConfig) + assert config.simulation.gain == 2 + assert json.loads(config.model_dump_json())["simulation"]["gain"] == 2 + restored = ActuatorSysIdConfig.model_validate_json(config.model_dump_json()) + assert restored == config + assert _hash_name(restored) == _hash_name(config) + changed = deepcopy(toy_task_data) + changed["simulation"]["gain"] = 3 + assert _hash_name(ActuatorSysIdConfig.model_validate(changed)) != _hash_name(config) + + +@pytest.mark.parametrize("patch", [{"gain": "2"}, {"extra": 1}, {"control_freq": 300}]) +def test_plugin_simulation_is_strict(toy_task_data, patch): + registry.register_simulation_backend(toy_registration()) + toy_task_data["simulation"].update(patch) + with pytest.raises(ValidationError): + ActuatorSysIdConfig.model_validate(toy_task_data) + + +def test_discovery_is_idempotent(monkeypatch): + loads = [] + entry = SimpleNamespace( + name="toy", load=lambda: loads.append("load") or toy_registration + ) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + registry.discover_sysid_backends() + registry.discover_sysid_backends() + assert loads == ["load"] + assert registry.get_sysid_backend("toy").config_model is ToyConfig + + +def test_discovery_error_does_not_leave_partial_registration(monkeypatch): + first = SimpleNamespace(name="toy", load=lambda: toy_registration) + second = SimpleNamespace( + name="zzz", load=lambda: lambda: (_ for _ in ()).throw(RuntimeError("broken")) + ) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [second, first]) + with pytest.raises(SimulationBackendError, match="broken"): + registry.discover_sysid_backends() + assert "toy" not in registry.SIMULATION_CONTEXTS + assert not registry._DISCOVERED + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [first]) + registry.discover_sysid_backends() + assert "toy" in registry.SIMULATION_CONTEXTS + + +def test_duplicate_metadata_names_fail_before_loading(monkeypatch): + loads = [] + entry = SimpleNamespace(name="toy", load=lambda: loads.append(True)) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry, entry]) + with pytest.raises(SimulationBackendError, match="Duplicate"): + registry.discover_sysid_backends() + assert loads == [] + + +def test_entry_point_name_must_match_registration(monkeypatch): + entry = SimpleNamespace(name="other", load=lambda: toy_registration) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + with pytest.raises(SimulationBackendError, match="name"): + registry.discover_sysid_backends() + assert "toy" not in registry.SIMULATION_CONTEXTS + + +def test_python_registration_rejects_duplicate_names(): + registry.register_simulation_backend(toy_registration()) + with pytest.raises(SimulationBackendError, match="already registered"): + registry.register_simulation_backend(toy_registration()) + with pytest.raises(SimulationBackendError, match="already registered"): + registry.register_simulation_backend(toy_registration("newton")) + + +def test_registered_backend_without_sysid_fails_early(toy_task_data): + registry.register_simulation_backend( + registry.SimulationBackend("toy", ToyContext, None) + ) + with pytest.raises(SimulationBackendError, match="system identification"): + ActuatorSysIdConfig.model_validate(toy_task_data) + + +def test_wrong_concrete_context_factory_is_rejected(toy_task_data): + class OtherContext(ToyContext): + pass + + capability = registry.SysIdBackend( + config_model=ToyConfig, + create_context=lambda config: OtherContext(resource_key="wrong"), + create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] + ) + registry.register_simulation_backend( + registry.SimulationBackend("toy", ToyContext, capability) + ) + config = ActuatorSysIdConfig.model_validate(toy_task_data) + with pytest.raises(SimulationBackendError, match="context type"): + registry.create_sysid_context(config) + + +def test_artifact_is_frozen(): + artifact = IdentifiedModelArtifact(Path("model.usd"), "usd") + with pytest.raises(FrozenInstanceError): + artifact.format = "other" # type: ignore[misc] + + +def test_neutral_registry_import_does_not_import_newton_task(): + code = "import sys; import anchor_bench.core.simulation.registry; assert 'anchor_bench.tasks.actuator_sys_id.task' not in sys.modules; assert 'newton' not in sys.modules" + subprocess.run([sys.executable, "-c", code], check=True) + + +def test_discovery_loads_providers_in_metadata_name_order(monkeypatch): + loaded = [] + + def entry(name): + def load(): + loaded.append(name) + return lambda: registry.SimulationBackend(name, ToyContext) + + return SimpleNamespace(name=name, load=load) + + monkeypatch.setattr( + registry, "entry_points", lambda **kwargs: [entry("z-last"), entry("a-first")] + ) + registry.discover_sysid_backends() + assert loaded == ["a-first", "z-last"] + + +@pytest.mark.parametrize( + "provider", + [ + None, + lambda: object(), + lambda: registry.SimulationBackend("toy", cast(Any, object)), + ], +) +def test_invalid_plugin_capabilities_fail_atomically(monkeypatch, provider): + entry = SimpleNamespace(name="toy", load=lambda: provider) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + with pytest.raises(SimulationBackendError): + registry.discover_sysid_backends() + assert "toy" not in registry.SIMULATION_CONTEXTS + assert not registry._DISCOVERED + + +def test_entry_point_cannot_replace_builtin_before_loading(monkeypatch): + loads = [] + entry = SimpleNamespace(name="newton", load=lambda: loads.append(True)) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + with pytest.raises(SimulationBackendError, match="already registered"): + registry.discover_sysid_backends() + assert loads == [] + + +def test_entry_point_enumeration_errors_are_wrapped_and_retryable(monkeypatch): + def broken(**kwargs): + raise RuntimeError("metadata unavailable") + + monkeypatch.setattr(registry, "entry_points", broken) + with pytest.raises(SimulationBackendError, match="metadata unavailable"): + registry.discover_sysid_backends() + assert not registry._DISCOVERED + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: []) + registry.discover_sysid_backends() + assert registry._DISCOVERED + + +def test_provider_registration_side_effects_are_rolled_back(monkeypatch): + def broken(): + registry.register_simulation_backend(toy_registration()) + raise RuntimeError("provider failed") + + entry = SimpleNamespace(name="toy", load=lambda: broken) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + with pytest.raises(SimulationBackendError, match="provider failed"): + registry.discover_sysid_backends() + assert "toy" not in registry.SIMULATION_CONTEXTS + + +def test_validation_discovers_before_dispatch(monkeypatch, toy_task_data): + entry = SimpleNamespace(name="toy", load=lambda: toy_registration) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + config = ActuatorSysIdConfig.model_validate(toy_task_data) + assert isinstance(config.simulation, ToyConfig) + assert config.simulation.gain == 2 + + +def test_yaml_parser_discovers_before_dispatch(monkeypatch, toy_task_data, tmp_path): + import yaml + + from anchor_bench.schema.parse import parse + + entry = SimpleNamespace(name="toy", load=lambda: toy_registration) + monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + path = tmp_path / "task.yaml" + path.write_text(yaml.safe_dump(toy_task_data), encoding="utf-8") + config = parse(path) + assert isinstance(config, ActuatorSysIdConfig) + assert isinstance(config.simulation, ToyConfig) + assert config.simulation.gain == 2 From 5545c2da6105fe4e4075e26640ccfde96fb87d55 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 14:41:57 -0700 Subject: [PATCH 08/16] fix: require USD input for simulation contexts --- anchor_bench/core/simulation/__init__.py | 58 +++++++++----- anchor_bench/core/simulation/newton.py | 35 +-------- anchor_bench/schema/simulation.py | 4 +- docs/system-identification.md | 8 +- .../toy_sysid_backend/__init__.py | 27 ++++--- tests/integration/test_sysid_backend_cli.py | 16 +++- tests/test_actuator_sys_id_simulation.py | 1 + tests/test_actuator_sys_id_task.py | 6 +- tests/test_data_processor_runner.py | 6 +- tests/test_data_processors.py | 11 ++- tests/test_newton_simulation_context.py | 5 +- tests/test_simulation_context.py | 78 ++++++++++++------- tests/test_sysid_backends.py | 16 +++- 13 files changed, 162 insertions(+), 109 deletions(-) diff --git a/anchor_bench/core/simulation/__init__.py b/anchor_bench/core/simulation/__init__.py index b58b662..ec4cb00 100644 --- a/anchor_bench/core/simulation/__init__.py +++ b/anchor_bench/core/simulation/__init__.py @@ -6,7 +6,7 @@ from __future__ import annotations from abc import ABC, abstractmethod -from collections.abc import Hashable +from pathlib import Path from typing import Any, ClassVar, Generic, Optional, Tuple, TypeVar, cast from typing_extensions import Self @@ -19,40 +19,54 @@ class SimulationContext(ABC, Generic[ModelT, StateT]): """Own the single lazily loaded simulation model and state.""" _instance: ClassVar[Optional[SimulationContext[Any, Any]]] = None - _resource_key: Hashable + _usd_path: Path + _fixed_base: bool _model: Optional[ModelT] _state: Optional[StateT] - def __new__(cls, *, resource_key: Hashable) -> Self: - """Create or return the process-wide context for a hashable resource.""" - - try: - hash(resource_key) - except TypeError as exc: - raise TypeError("resource_key must be hashable.") from exc + def __new__( + cls, + usd_path: str, + *, + fixed_base: bool = False, + ) -> Self: + """Create or return the process-wide simulation context.""" + source = Path(usd_path).expanduser().resolve() current = SimulationContext._instance if current is not None: if type(current) is not cls: raise RuntimeError( "Only one simulation backend can be used per process." ) - if current.resource_key != resource_key: + if current.usd_path != source: + raise RuntimeError( + f"Simulation context already uses {current.usd_path}." + ) + if current.fixed_base != fixed_base: raise RuntimeError( - "Simulation context already uses resource key " - f"{current.resource_key!r}." + "Simulation context already uses a different base mode." ) return cast(Self, current) + if not source.is_file(): + raise FileNotFoundError(f"USD file does not exist: {source}.") + instance = super().__new__(cls) - instance._resource_key = resource_key + instance._usd_path = source + instance._fixed_base = fixed_base instance._model = None instance._state = None SimulationContext._instance = instance return instance - def __init__(self, *, resource_key: Hashable) -> None: - """Accept the mandatory resource identity handled during construction.""" + def __init__( + self, + usd_path: str, + *, + fixed_base: bool = False, + ) -> None: + """Accept the mandatory USD path handled during construction.""" @classmethod def current(cls) -> Self: @@ -64,10 +78,16 @@ def current(cls) -> Self: return cast(Self, instance) @property - def resource_key(self) -> Hashable: - """Return the backend-defined resource identity assigned to this process.""" + def usd_path(self) -> Path: + """Return the USD file assigned to this process.""" + + return self._usd_path + + @property + def fixed_base(self) -> bool: + """Return whether the imported robot root is fixed.""" - return self._resource_key + return self._fixed_base def load(self) -> Tuple[ModelT, StateT]: """Load and cache the model and state on first use.""" @@ -94,5 +114,5 @@ def state(self) -> StateT: @abstractmethod def _load(self) -> Tuple[ModelT, StateT]: - """Load a backend model and initial state for the assigned resource.""" + """Load a backend model and initial state from the assigned USD.""" raise NotImplementedError diff --git a/anchor_bench/core/simulation/newton.py b/anchor_bench/core/simulation/newton.py index 38443c0..0cc1685 100644 --- a/anchor_bench/core/simulation/newton.py +++ b/anchor_bench/core/simulation/newton.py @@ -7,11 +7,9 @@ import logging from collections.abc import Hashable -from pathlib import Path from typing import Any, Callable, Mapping, Tuple import newton -from typing_extensions import Self from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor @@ -28,8 +26,6 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): count. """ - _usd_path: Path - _fixed_base: bool _initialized: bool _world_count: int _configuration_key: Hashable | None @@ -40,23 +36,6 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): _solver: newton.solvers.SolverMuJoCo _step_executor: NewtonStepExecutor - def __new__( - cls, - usd_path: str, - *, - fixed_base: bool = False, - ) -> Self: - """Assign the resolved USD path and base mode as resource identity.""" - - source = Path(usd_path).expanduser().resolve() - if SimulationContext._instance is None and not source.is_file(): - raise FileNotFoundError(f"USD file does not exist: {source}.") - - instance = super().__new__(cls, resource_key=(source, fixed_base)) - instance._usd_path = source - instance._fixed_base = fixed_base - return instance - def __init__( self, usd_path: str, @@ -65,22 +44,10 @@ def __init__( ) -> None: """Initialize instance bookkeeping without resetting the singleton.""" - super().__init__(resource_key=(self.usd_path, self.fixed_base)) + super().__init__(usd_path, fixed_base=fixed_base) if not hasattr(self, "_initialized"): self._initialized = False - @property - def usd_path(self) -> Path: - """Return the resolved USD file assigned to this Newton context.""" - - return self._usd_path - - @property - def fixed_base(self) -> bool: - """Return whether the imported robot root is fixed.""" - - return self._fixed_base - def initialize( self, *, diff --git a/anchor_bench/schema/simulation.py b/anchor_bench/schema/simulation.py index 8fb6e2e..4a691f6 100644 --- a/anchor_bench/schema/simulation.py +++ b/anchor_bench/schema/simulation.py @@ -24,12 +24,13 @@ class SysIdSimulationConfig(StrictBaseModel): - """Timing shared by all registered system-identification backends.""" + """Required USD input and timing shared by identification backends.""" type: NonEmptyString physics_freq: PositiveInteger control_freq: PositiveInteger render_freq: PositiveInteger + usd_path: NonEmptyString @model_validator(mode="after") def validate_frequencies(self) -> SysIdSimulationConfig: @@ -47,5 +48,4 @@ class WarpMujocoSolverConfig(StrictBaseModel): class NewtonSimulationConfig(SysIdSimulationConfig): type: Literal["newton"] # pyright: ignore[reportIncompatibleVariableOverride] - usd_path: NonEmptyString solver: WarpMujocoSolverConfig diff --git a/docs/system-identification.md b/docs/system-identification.md index cba53b0..8bdcb55 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -109,9 +109,11 @@ iteration or convergence condition. A backend supplies its own strict simulation configuration, resource context, and population evaluator. Its configuration extends `anchor_bench.schema.simulation.SysIdSimulationConfig`, retaining the shared -timing fields and declaring its own `type` and simulator settings. Its context -extends `SimulationContext` with a hashable `resource_key` and a parameterless -`_load()` that returns its model and initial state. +required `usd_path` and timing fields, and declaring its own `type` and simulator +settings. Its context extends `SimulationContext(usd_path, *, fixed_base=False)`. +The shared context resolves and validates the USD path and protects reuse by +backend class, resolved path, and base mode. Its parameterless `_load()` reads +`self.usd_path` and returns the model and initial state. Register these components through the Python API before validating a task: diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py index f0ffc5b..bbf380d 100644 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -1,14 +1,15 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""A path-free installed backend for exercising the real sysID CLI.""" +"""A USD-backed installed backend for exercising the real sysID CLI.""" from __future__ import annotations import json from collections.abc import Sequence +from importlib import import_module from pathlib import Path -from typing import Any, Literal, cast +from typing import Any, Literal import numpy as np @@ -32,16 +33,20 @@ class ToyConfig(SysIdSimulationConfig): class ToyContext(SimulationContext[float, float]): - """Load a scalar response model without any USD resource.""" + """Load the scalar response scale from the shared USD input.""" def _load(self) -> tuple[float, float]: - _, gain = cast(tuple[str, float], self.resource_key) - return float(gain), 0.0 + usd = import_module("pxr.Usd") + stage = usd.Stage.Open(str(self.usd_path)) + if stage is None: + raise ValueError("Could not open the response USD") + scale = stage.GetPrimAtPath("/response").GetAttribute("gain_scale").Get() + return float(scale), 0.0 class ToyEvaluator: - def __init__(self, context: ToyContext) -> None: - self._gain = context.model + def __init__(self, context: ToyContext, gain: float) -> None: + self._gain = context.model * gain def evaluate( self, @@ -65,7 +70,7 @@ def create_context(config: ActuatorSysIdConfig) -> ToyContext: simulation = config.simulation if not isinstance(simulation, ToyConfig): raise TypeError("toy backend requires its registered config model") - return ToyContext(resource_key=(simulation.model_name, simulation.gain)) + return ToyContext(simulation.usd_path) def create_evaluator( @@ -75,7 +80,9 @@ def create_evaluator( ) -> ToyEvaluator: if not isinstance(context, ToyContext): raise TypeError("toy evaluator requires its registered context") - return ToyEvaluator(context) + if not isinstance(config.simulation, ToyConfig): + raise TypeError("toy evaluator requires its registered config model") + return ToyEvaluator(context, config.simulation.gain) def export_model( @@ -90,7 +97,7 @@ def export_model( { "parameters": best, "simulation": config.simulation.model_dump(mode="json"), - "gain": context.model, + "gain_scale": context.model, }, sort_keys=True, ), diff --git a/tests/integration/test_sysid_backend_cli.py b/tests/integration/test_sysid_backend_cli.py index d0bb20f..144dafe 100644 --- a/tests/integration/test_sysid_backend_cli.py +++ b/tests/integration/test_sysid_backend_cli.py @@ -62,6 +62,11 @@ def _write_config(tmp_path: Path) -> Path: ] parquet = tmp_path / "recording.parquet" pd.DataFrame(rows).to_parquet(parquet, index=False) + usd = tmp_path / "response.usda" + usd.write_text( + '#usda 1.0\ndef Xform "response" {\n custom double gain_scale = 2.0\n}\n', + encoding="utf-8", + ) document = { "type": "actuator_sys_id", "joint_parameters": [ @@ -88,11 +93,12 @@ def _write_config(tmp_path: Path) -> Path: }, "simulation": { "type": "toy-sysid", + "usd_path": str(usd), "physics_freq": 200, "control_freq": 100, "render_freq": 50, "gain": 2.5, - "model_name": "path-free-response", + "model_name": "usd-response", }, "num_envs": 6, "seed": 17, @@ -150,11 +156,12 @@ def test_cli_discovers_installed_sysid_backend( resolved = yaml.safe_load((output / "config.yaml").read_text()) assert resolved["simulation"] == { "type": "toy-sysid", + "usd_path": str(tmp_path / "response.usda"), "physics_freq": 200, "control_freq": 100, "render_freq": 50, "gain": 2.5, - "model_name": "path-free-response", + "model_name": "usd-response", } best = yaml.safe_load((output / "best_params.yaml").read_text()) summary = yaml.safe_load((output / "run_summary.yaml").read_text()) @@ -162,9 +169,10 @@ def test_cli_discovers_installed_sysid_backend( assert summary["best_mse"] == best["best_mse"] assert math.isfinite(best["best_mse"]) # Mean command square is (1 + 0.25 + 0.5625) / 4 for this recording. + # The USD scale 2.0 and configured gain 2.5 give an effective gain of 5.0. stiffness = best["parameters"]["hip"]["stiffness"] assert best["best_mse"] == pytest.approx( - 0.453125 * (stiffness / 2.5 - 0.65) ** 2 + 0.453125 * (stiffness / 5.0 - 0.65) ** 2 ) with (output / "optimization_log.csv").open(newline="") as stream: history = list(csv.DictReader(stream)) @@ -180,7 +188,7 @@ def test_cli_discovers_installed_sysid_backend( model = json.loads((output / "identified.json").read_text()) assert model["parameters"] == best["parameters"] assert model["simulation"] == resolved["simulation"] - assert model["gain"] == 2.5 + assert model["gain_scale"] == 2.0 for filename in ("best_params.yaml", "optimization_log.csv"): assert (outputs[0] / filename).read_text() == ( diff --git a/tests/test_actuator_sys_id_simulation.py b/tests/test_actuator_sys_id_simulation.py index 623be67..29d9e60 100644 --- a/tests/test_actuator_sys_id_simulation.py +++ b/tests/test_actuator_sys_id_simulation.py @@ -608,6 +608,7 @@ def test_newton_evaluator_rejects_non_newton_config_before_loading( ): config = _config(tmp_path) config.simulation = SysIdSimulationConfig( + usd_path=config.simulation.usd_path, type="other", physics_freq=1000, control_freq=200, diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 9658146..2444044 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -107,7 +107,9 @@ def register_toy(monkeypatch, tmp_path): monkeypatch.setattr(registry, "_DISCOVERED", True) def register(create_evaluator, *, export_model=None, describe_runtime=None): - context = ToyContext(resource_key=("task-toy", str(tmp_path))) + usd = tmp_path / "scene.usda" + usd.write_text("#usda 1.0\n") + context = ToyContext(str(usd)) def create_context(config): assert isinstance(config.simulation, ToySimulationConfig) @@ -131,6 +133,7 @@ def create_context(config): tmp_path, simulation={ "type": "task-toy", + "usd_path": str(usd), "gain": 2.0, "physics_freq": 1000, "control_freq": 200, @@ -527,6 +530,7 @@ def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): monkeypatch.setattr(registry, "_DISCOVERED", True) registry.register_simulation_backend(SimulationBackend("resource-only", ToyContext)) config.simulation = SysIdSimulationConfig( + usd_path=config.simulation.usd_path, type="resource-only", physics_freq=1000, control_freq=200, diff --git a/tests/test_data_processor_runner.py b/tests/test_data_processor_runner.py index 4e2b178..0f1d8bb 100644 --- a/tests/test_data_processor_runner.py +++ b/tests/test_data_processor_runner.py @@ -3,6 +3,7 @@ from __future__ import annotations +from pathlib import Path from types import SimpleNamespace from typing import Any @@ -93,12 +94,15 @@ def _load(self) -> tuple[Any, Any]: @pytest.fixture(autouse=True) def simulation_context( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, ) -> RunnerSimulationContext: """Create the shared simulation context before running data processors.""" monkeypatch.setattr(SimulationContext, "_instance", None) - return RunnerSimulationContext(resource_key="data-processor-runner") + source = tmp_path / "scene.usda" + source.write_text("#usda 1.0\n") + return RunnerSimulationContext(str(source)) @pytest.fixture diff --git a/tests/test_data_processors.py b/tests/test_data_processors.py index f23d688..f76d11e 100644 --- a/tests/test_data_processors.py +++ b/tests/test_data_processors.py @@ -3,6 +3,7 @@ from __future__ import annotations +from pathlib import Path from types import SimpleNamespace from typing import Any, Tuple @@ -58,6 +59,7 @@ def _load(self) -> Tuple[Any, Any]: @pytest.fixture(autouse=True) def simulation_context( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, ) -> RecordingSimulationContext: """Create one process-wide context for every data processor test.""" @@ -67,7 +69,9 @@ def simulation_context( "_instance", None, ) - return RecordingSimulationContext(resource_key="data-processors") + source = tmp_path / "scene.usda" + source.write_text("#usda 1.0\n") + return RecordingSimulationContext(str(source)) @pytest.fixture @@ -100,12 +104,15 @@ def test_base_data_processor_cannot_be_instantiated(dataset: pd.DataFrame) -> No def test_simulation_context_cannot_be_instantiated( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch, ) -> None: monkeypatch.setattr(SimulationContext, "_instance", None) + source = tmp_path / "scene.usda" + source.write_text("#usda 1.0\n") with pytest.raises(TypeError): - SimulationContext(resource_key="abstract") # pyright: ignore[reportAbstractUsage] + SimulationContext(str(source)) # pyright: ignore[reportAbstractUsage] def test_base_data_processor_uses_current_context( diff --git a/tests/test_newton_simulation_context.py b/tests/test_newton_simulation_context.py index ee860ad..68826af 100644 --- a/tests/test_newton_simulation_context.py +++ b/tests/test_newton_simulation_context.py @@ -426,7 +426,7 @@ def test_rejects_a_different_backend(tmp_path: Path) -> None: NewtonSimulationContext(str(source)) with pytest.raises(RuntimeError, match="Only one simulation backend"): - OtherSimulationContext(resource_key=(source.resolve(), False)) + OtherSimulationContext(str(source)) def test_rejects_different_import_configuration(tmp_path: Path) -> None: @@ -436,7 +436,7 @@ def test_rejects_different_import_configuration(tmp_path: Path) -> None: source.write_text("#usda 1.0", encoding="utf-8") NewtonSimulationContext(str(source), fixed_base=True) - with pytest.raises(RuntimeError, match="already uses resource key"): + with pytest.raises(RuntimeError, match="different base mode"): NewtonSimulationContext(str(source), fixed_base=False) @@ -457,7 +457,6 @@ def test_resolved_usd_alias_reuses_newton_resources( assert repeated is context assert context.usd_path == fake_newton_usd.resolve() assert context.fixed_base is True - assert context.resource_key == (fake_newton_usd.resolve(), True) assert repeated.model is model assert repeated.state is state assert FakeModelBuilder.instance_count == 2 diff --git a/tests/test_simulation_context.py b/tests/test_simulation_context.py index 9fa517c..69d635e 100644 --- a/tests/test_simulation_context.py +++ b/tests/test_simulation_context.py @@ -1,10 +1,11 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Backend-neutral resource identity and lifetime contracts.""" +"""Shared USD resource identity and lifetime contracts.""" from __future__ import annotations +from pathlib import Path from typing import Any import pytest @@ -13,17 +14,18 @@ class ToyContext(SimulationContext[object, object]): - """Load in-memory resources without any filesystem dependency.""" + """Load resources using the USD assigned by the shared context.""" load_count = 0 def _load(self) -> tuple[object, object]: + assert self.usd_path.read_text() == "#usda 1.0\n" self.load_count += 1 return object(), object() class OtherToyContext(ToyContext): - """Represent an incompatible backend with the same resource key.""" + """Represent an incompatible backend using the same USD.""" @pytest.fixture(autouse=True) @@ -31,10 +33,17 @@ def reset_context(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(SimulationContext, "_instance", None) -def test_path_free_context_loads_once() -> None: - context = ToyContext(resource_key=("toy", 2)) +@pytest.fixture +def usd_path(tmp_path: Path) -> Path: + path = tmp_path / "scene.usda" + path.write_text("#usda 1.0\n") + return path - assert context.resource_key == ("toy", 2) + +def test_usd_context_loads_once(usd_path: Path) -> None: + context = ToyContext(str(usd_path)) + + assert context.usd_path == usd_path.resolve() assert context.load_count == 0 model, state = context.load() assert context.model is model @@ -44,12 +53,13 @@ def test_path_free_context_loads_once() -> None: assert SimulationContext.current() is context -def test_equivalent_resource_keys_reuse_loaded_context() -> None: - context = ToyContext(resource_key=("toy", 2)) +def test_equivalent_usd_paths_reuse_loaded_context(usd_path: Path) -> None: + context = ToyContext(str(usd_path)) model, state = context.load() + alias = usd_path.with_name("alias.usda") + alias.symlink_to(usd_path) - resource_parts = ["toy", 2] - repeated = ToyContext(resource_key=tuple(resource_parts)) + repeated = ToyContext(str(alias)) assert repeated is context assert repeated.model is model @@ -57,44 +67,58 @@ def test_equivalent_resource_keys_reuse_loaded_context() -> None: assert repeated.load_count == 1 -def test_repeated_resource_key_conflicts_leave_original_context_usable() -> None: - context = ToyContext(resource_key=("toy", 2)) +def test_repeated_usd_conflicts_leave_original_context_usable(usd_path: Path) -> None: + context = ToyContext(str(usd_path)) model, state = context.load() + other = usd_path.with_name("other.usda") + other.write_text("#usda 1.0\n") for _ in range(2): with pytest.raises(RuntimeError, match="already uses"): - ToyContext(resource_key=("toy", 3)) + ToyContext(str(other)) - assert ToyContext(resource_key=("toy", 2)) is context + assert ToyContext(str(usd_path)) is context assert context.model is model assert context.state is state assert context.load_count == 1 -def test_repeated_backend_conflicts_leave_original_context_usable() -> None: - context = ToyContext(resource_key=("toy", 2)) +def test_repeated_base_mode_conflicts_preserve_context(usd_path: Path) -> None: + context = ToyContext(str(usd_path), fixed_base=True) + for _ in range(2): + with pytest.raises(RuntimeError, match="different base mode"): + ToyContext(str(usd_path), fixed_base=False) + assert ToyContext(str(usd_path), fixed_base=True) is context + assert context.fixed_base is True + + +def test_repeated_backend_conflicts_leave_original_context_usable( + usd_path: Path, +) -> None: + context = ToyContext(str(usd_path)) for _ in range(2): with pytest.raises(RuntimeError, match="Only one simulation backend"): - OtherToyContext(resource_key=("toy", 2)) + OtherToyContext(str(usd_path)) - assert ToyContext(resource_key=("toy", 2)) is context + assert ToyContext(str(usd_path)) is context assert SimulationContext.current() is context -@pytest.mark.parametrize("resource_key", [["toy", 2], ("toy", [])]) -def test_unhashable_resource_key_does_not_claim_context(resource_key: Any) -> None: - with pytest.raises(TypeError, match="hashable"): - ToyContext(resource_key=resource_key) - - context = ToyContext(resource_key=("toy", 2)) +@pytest.mark.parametrize("directory", [False, True]) +def test_invalid_usd_path_does_not_claim_context( + usd_path: Path, directory: bool +) -> None: + invalid = usd_path.parent if directory else usd_path.with_name("missing.usda") + with pytest.raises(FileNotFoundError, match="USD file does not exist"): + ToyContext(str(invalid)) + context = ToyContext(str(usd_path)) assert SimulationContext.current() is context -def test_resource_key_is_required_keyword_only() -> None: +def test_usd_path_is_required() -> None: context_type: Any = ToyContext - with pytest.raises(TypeError): context_type() with pytest.raises(TypeError): - context_type(("toy", 2)) + context_type(resource_key=("toy", 2)) diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index 27863c2..e8a2a08 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -42,7 +42,7 @@ def toy_registration(name: str = "toy") -> registry.SimulationBackend: sysid=registry.SysIdBackend( config_model=ToyConfig, create_context=lambda config: ToyContext( - resource_key=("toy", config.simulation.physics_freq) + usd_path=config.simulation.usd_path ), create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] ), @@ -59,7 +59,9 @@ def isolated_registry(monkeypatch: pytest.MonkeyPatch): @pytest.fixture -def toy_task_data(): +def toy_task_data(tmp_path): + usd = tmp_path / "scene.usda" + usd.write_text("#usda 1.0\n") return { "type": "actuator_sys_id", "joint_parameters": [ @@ -85,6 +87,7 @@ def toy_task_data(): }, "simulation": { "type": "toy", + "usd_path": str(usd), "gain": 2, "physics_freq": 1000, "control_freq": 200, @@ -186,7 +189,7 @@ class OtherContext(ToyContext): capability = registry.SysIdBackend( config_model=ToyConfig, - create_context=lambda config: OtherContext(resource_key="wrong"), + create_context=lambda config: OtherContext(config.simulation.usd_path), create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] ) registry.register_simulation_backend( @@ -297,3 +300,10 @@ def test_yaml_parser_discovers_before_dispatch(monkeypatch, toy_task_data, tmp_p assert isinstance(config, ActuatorSysIdConfig) assert isinstance(config.simulation, ToyConfig) assert config.simulation.gain == 2 + + +def test_plugin_simulation_requires_usd_input(toy_task_data): + registry.register_simulation_backend(toy_registration()) + toy_task_data["simulation"].pop("usd_path", None) + with pytest.raises(ValidationError, match="usd_path"): + ActuatorSysIdConfig.model_validate(toy_task_data) From 606b9538cfa7556df6c9af40321975377311236a Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 15:27:04 -0700 Subject: [PATCH 09/16] fix: retain simulation context loading API --- anchor_bench/core/simulation/__init__.py | 4 ++-- anchor_bench/core/simulation/newton.py | 3 ++- docs/system-identification.md | 4 ++-- tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py | 4 ++-- tests/test_actuator_sys_id_task.py | 3 ++- tests/test_data_processor_runner.py | 2 +- tests/test_data_processors.py | 2 +- tests/test_newton_simulation_context.py | 2 +- tests/test_simulation_context.py | 5 +++-- tests/test_sysid_backends.py | 2 +- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/anchor_bench/core/simulation/__init__.py b/anchor_bench/core/simulation/__init__.py index ec4cb00..7ee2241 100644 --- a/anchor_bench/core/simulation/__init__.py +++ b/anchor_bench/core/simulation/__init__.py @@ -93,7 +93,7 @@ def load(self) -> Tuple[ModelT, StateT]: """Load and cache the model and state on first use.""" if self._model is None or self._state is None: - model, state = self._load() + model, state = self._load(self._usd_path) self._model = model self._state = state return self._model, self._state @@ -113,6 +113,6 @@ def state(self) -> StateT: return state @abstractmethod - def _load(self) -> Tuple[ModelT, StateT]: + def _load(self, usd_path: Path) -> Tuple[ModelT, StateT]: """Load a backend model and initial state from the assigned USD.""" raise NotImplementedError diff --git a/anchor_bench/core/simulation/newton.py b/anchor_bench/core/simulation/newton.py index 0cc1685..b1584a4 100644 --- a/anchor_bench/core/simulation/newton.py +++ b/anchor_bench/core/simulation/newton.py @@ -7,6 +7,7 @@ import logging from collections.abc import Hashable +from pathlib import Path from typing import Any, Callable, Mapping, Tuple import newton @@ -184,7 +185,7 @@ def step(self, *, dt: float, substeps: int = 1) -> None: self._step_executor.step(dt=dt, substeps=substeps) self._state = self._step_executor.state - def _load(self) -> Tuple[newton.Model, newton.State]: + def _load(self, usd_path: Path) -> Tuple[newton.Model, newton.State]: """Return the owned model and current state, initializing if needed.""" self._ensure_initialized() diff --git a/docs/system-identification.md b/docs/system-identification.md index 8bdcb55..3412ad0 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -112,8 +112,8 @@ and population evaluator. Its configuration extends required `usd_path` and timing fields, and declaring its own `type` and simulator settings. Its context extends `SimulationContext(usd_path, *, fixed_base=False)`. The shared context resolves and validates the USD path and protects reuse by -backend class, resolved path, and base mode. Its parameterless `_load()` reads -`self.usd_path` and returns the model and initial state. +backend class, resolved path, and base mode. Its `_load(usd_path)` receives +the resolved USD path and returns the model and initial state. Register these components through the Python API before validating a task: diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py index bbf380d..7bd017c 100644 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -35,9 +35,9 @@ class ToyConfig(SysIdSimulationConfig): class ToyContext(SimulationContext[float, float]): """Load the scalar response scale from the shared USD input.""" - def _load(self) -> tuple[float, float]: + def _load(self, usd_path: Path) -> tuple[float, float]: usd = import_module("pxr.Usd") - stage = usd.Stage.Open(str(self.usd_path)) + stage = usd.Stage.Open(str(usd_path)) if stage is None: raise ValueError("Could not open the response USD") scale = stage.GetPrimAtPath("/response").GetAttribute("gain_scale").Get() diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 2444044..75e754a 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -5,6 +5,7 @@ import builtins import importlib +from pathlib import Path from typing import Literal from unittest.mock import Mock @@ -96,7 +97,7 @@ class ToySimulationConfig(SysIdSimulationConfig): class ToyContext(SimulationContext[object, object]): - def _load(self): + def _load(self, usd_path: Path): return object(), object() diff --git a/tests/test_data_processor_runner.py b/tests/test_data_processor_runner.py index 0f1d8bb..030583b 100644 --- a/tests/test_data_processor_runner.py +++ b/tests/test_data_processor_runner.py @@ -80,7 +80,7 @@ def numpy(self) -> np.ndarray: class RunnerSimulationContext(SimulationContext): """Provide the shared context required by runner data processors.""" - def _load(self) -> tuple[Any, Any]: + def _load(self, usd_path: Path) -> tuple[Any, Any]: """Return inert model and state objects.""" model = SimpleNamespace( diff --git a/tests/test_data_processors.py b/tests/test_data_processors.py index f76d11e..80a64be 100644 --- a/tests/test_data_processors.py +++ b/tests/test_data_processors.py @@ -44,7 +44,7 @@ def process(self) -> pd.DataFrame: class RecordingSimulationContext(SimulationContext): - def _load(self) -> Tuple[Any, Any]: + def _load(self, usd_path: Path) -> Tuple[Any, Any]: """Provide the model consumed through the current shared context.""" return SimpleNamespace( diff --git a/tests/test_newton_simulation_context.py b/tests/test_newton_simulation_context.py index 68826af..be8507f 100644 --- a/tests/test_newton_simulation_context.py +++ b/tests/test_newton_simulation_context.py @@ -142,7 +142,7 @@ def step(self, **values: Any) -> None: class OtherSimulationContext(SimulationContext): """Represent a second backend for singleton enforcement tests.""" - def _load(self) -> Tuple[Any, Any]: + def _load(self, usd_path: Path) -> Tuple[Any, Any]: """Return placeholder backend objects.""" return object(), object() diff --git a/tests/test_simulation_context.py b/tests/test_simulation_context.py index 69d635e..ce9f578 100644 --- a/tests/test_simulation_context.py +++ b/tests/test_simulation_context.py @@ -18,8 +18,9 @@ class ToyContext(SimulationContext[object, object]): load_count = 0 - def _load(self) -> tuple[object, object]: - assert self.usd_path.read_text() == "#usda 1.0\n" + def _load(self, usd_path: Path) -> tuple[object, object]: + assert usd_path == self.usd_path + assert usd_path.read_text() == "#usda 1.0\n" self.load_count += 1 return object(), object() diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index e8a2a08..1e4db4c 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -31,7 +31,7 @@ class ToyConfig(SysIdSimulationConfig): class ToyContext(SimulationContext[object, object]): - def _load(self) -> tuple[object, object]: + def _load(self, usd_path: Path) -> tuple[object, object]: return object(), object() From b48b2cb3e09085ef9986d21e7f3ac94c4936ab31 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 15:36:04 -0700 Subject: [PATCH 10/16] refactor: retain direct core exports --- anchor_bench/core/__init__.py | 46 ++++++----------------------------- tests/test_sysid_backends.py | 7 ------ 2 files changed, 8 insertions(+), 45 deletions(-) diff --git a/anchor_bench/core/__init__.py b/anchor_bench/core/__init__.py index 65d0a69..f7f729c 100644 --- a/anchor_bench/core/__init__.py +++ b/anchor_bench/core/__init__.py @@ -3,33 +3,14 @@ """Core task-runner and simulation functionality.""" -from importlib import import_module -from typing import TYPE_CHECKING, Any - -if TYPE_CHECKING: - from anchor_bench.core.artifacts import ( - get_or_create_output_folder, - resolve_repo_root, - write_yaml, - ) - from anchor_bench.core.simulation import SimulationContext - from anchor_bench.core.simulation.newton import NewtonSimulationContext - from anchor_bench.core.task_runner import TaskRunner - -_EXPORTS = { - "NewtonSimulationContext": ( - "anchor_bench.core.simulation.newton", - "NewtonSimulationContext", - ), - "SimulationContext": ("anchor_bench.core.simulation", "SimulationContext"), - "TaskRunner": ("anchor_bench.core.task_runner", "TaskRunner"), - "get_or_create_output_folder": ( - "anchor_bench.core.artifacts", - "get_or_create_output_folder", - ), - "resolve_repo_root": ("anchor_bench.core.artifacts", "resolve_repo_root"), - "write_yaml": ("anchor_bench.core.artifacts", "write_yaml"), -} +from anchor_bench.core.artifacts import ( + get_or_create_output_folder, + resolve_repo_root, + write_yaml, +) +from anchor_bench.core.simulation import SimulationContext +from anchor_bench.core.simulation.newton import NewtonSimulationContext +from anchor_bench.core.task_runner import TaskRunner __all__ = [ "NewtonSimulationContext", @@ -39,14 +20,3 @@ "resolve_repo_root", "write_yaml", ] - - -def __getattr__(name: str) -> Any: - """Resolve public exports without importing task or simulator runtimes eagerly.""" - - if name not in _EXPORTS: - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") - module_name, attribute = _EXPORTS[name] - value = getattr(import_module(module_name), attribute) - globals()[name] = value - return value diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index 1e4db4c..5677f61 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -6,8 +6,6 @@ from __future__ import annotations import json -import subprocess -import sys from copy import deepcopy from dataclasses import FrozenInstanceError from pathlib import Path @@ -206,11 +204,6 @@ def test_artifact_is_frozen(): artifact.format = "other" # type: ignore[misc] -def test_neutral_registry_import_does_not_import_newton_task(): - code = "import sys; import anchor_bench.core.simulation.registry; assert 'anchor_bench.tasks.actuator_sys_id.task' not in sys.modules; assert 'newton' not in sys.modules" - subprocess.run([sys.executable, "-c", code], check=True) - - def test_discovery_loads_providers_in_metadata_name_order(monkeypatch): loaded = [] From 4a0460b7732d4683a3ddc03cafa38446bf7e02c8 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 15:47:31 -0700 Subject: [PATCH 11/16] refactor: simplify simulation registration --- anchor_bench/core/simulation/registry.py | 279 ++++++++---------- anchor_bench/schema/actuator_sys_id.py | 10 +- anchor_bench/tasks/actuator_sys_id/task.py | 14 +- docs/system-identification.md | 46 +-- .../toy_sysid_backend/__init__.py | 36 +-- tests/test_actuator_sys_id_task.py | 31 +- tests/test_simulation_registry.py | 7 - tests/test_sysid_backends.py | 58 ++-- 8 files changed, 218 insertions(+), 263 deletions(-) diff --git a/anchor_bench/core/simulation/registry.py b/anchor_bench/core/simulation/registry.py index ce9a7d2..a375734 100644 --- a/anchor_bench/core/simulation/registry.py +++ b/anchor_bench/core/simulation/registry.py @@ -1,18 +1,18 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Simulation resources and typed system-identification capabilities.""" +"""Simulation contexts and their optional system-identification callbacks.""" from __future__ import annotations from collections import Counter -from collections.abc import Callable, Iterator, Mapping -from dataclasses import dataclass +from collections.abc import Callable, Mapping from importlib.metadata import entry_points from pathlib import Path -from typing import TYPE_CHECKING, Any, cast +from typing import TYPE_CHECKING, Any, TypedDict from anchor_bench.core.simulation import SimulationContext +from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.errors import SimulationBackendError if TYPE_CHECKING: @@ -26,10 +26,7 @@ from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace -@dataclass(frozen=True) -class SysIdBackend: - """Typed factories and optional model export for an identification backend.""" - +class _SysIdCallbacks(TypedDict): config_model: type[SysIdSimulationConfig] create_context: Callable[[ActuatorSysIdConfig], SimulationContext[Any, Any]] create_evaluator: Callable[ @@ -42,145 +39,126 @@ class SysIdBackend: IdentifiedModelArtifact | None, ] | None - ) = None - describe_runtime: ( - Callable[[PopulationEvaluator], Mapping[str, JsonValue]] | None - ) = None - - -@dataclass(frozen=True) -class SimulationBackend: - """One registered resource class and its optional identification capability.""" - - name: str - context_type: type[SimulationContext[Any, Any]] - sysid: SysIdBackend | None = None + ) + describe_runtime: Callable[[PopulationEvaluator], Mapping[str, JsonValue]] | None -_BACKENDS: dict[str, SimulationBackend] = {} +SIMULATION_CONTEXTS: dict[str, type[SimulationContext[Any, Any]]] = { + "newton": NewtonSimulationContext, +} +_SYSID_CALLBACKS: dict[str, _SysIdCallbacks] = {} _DISCOVERED = False -_PENDING: dict[str, SimulationBackend] | None = None - - -def _newton_create_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any]: - from anchor_bench.tasks.actuator_sys_id.backends.newton import create_context - - return create_context(config) - - -def _newton_create_evaluator( - config: ActuatorSysIdConfig, - space: ParameterSpace, - context: SimulationContext[Any, Any], -) -> PopulationEvaluator: - from anchor_bench.tasks.actuator_sys_id.backends.newton import create_evaluator - - return create_evaluator(config, space, context) - - -def _newton_export_model( - config: ActuatorSysIdConfig, - best: Candidate, - context: SimulationContext[Any, Any], - output: Path, -) -> IdentifiedModelArtifact | None: - from anchor_bench.tasks.actuator_sys_id.backends.newton import export_model - - return export_model(config, best, context, output) - - -def _newton_describe_runtime(evaluator: PopulationEvaluator) -> Mapping[str, JsonValue]: - from anchor_bench.tasks.actuator_sys_id.backends.newton import describe_runtime - - return describe_runtime(evaluator) +_DISCOVERING = False def _ensure_builtin() -> None: - if "newton" in _BACKENDS: + if "newton" in _SYSID_CALLBACKS: return - from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.schema.simulation import NewtonSimulationConfig + from anchor_bench.tasks.actuator_sys_id.backends import newton - _BACKENDS["newton"] = SimulationBackend( - "newton", - NewtonSimulationContext, - SysIdBackend( - NewtonSimulationConfig, - _newton_create_context, - _newton_create_evaluator, - _newton_export_model, - _newton_describe_runtime, - ), - ) + _SYSID_CALLBACKS["newton"] = { + "config_model": NewtonSimulationConfig, + "create_context": newton.create_context, + "create_evaluator": newton.create_evaluator, + "export_model": newton.export_model, + "describe_runtime": newton.describe_runtime, + } -def _validate_registration(registration: object) -> SimulationBackend: +def register_simulation_backend( + name: str, + context_type: type[SimulationContext[Any, Any]], + *, + config_model: type[SysIdSimulationConfig] | None = None, + create_context: Callable[[ActuatorSysIdConfig], SimulationContext[Any, Any]] + | None = None, + create_evaluator: Callable[ + [ActuatorSysIdConfig, ParameterSpace, SimulationContext[Any, Any]], + PopulationEvaluator, + ] + | None = None, + export_model: Callable[ + [ActuatorSysIdConfig, Candidate, SimulationContext[Any, Any], Path], + IdentifiedModelArtifact | None, + ] + | None = None, + describe_runtime: Callable[[PopulationEvaluator], Mapping[str, JsonValue]] + | None = None, +) -> None: + """Register a context class, optionally with the callbacks needed for sysID.""" from anchor_bench.schema.simulation import SysIdSimulationConfig - if not isinstance(registration, SimulationBackend): + if not isinstance(name, str) or not name.strip(): raise SimulationBackendError( - "Provider must return a SimulationBackend registration." + "Simulation backend name must be a non-empty string." ) - if not isinstance(registration.name, str) or not registration.name.strip(): + if name in SIMULATION_CONTEXTS: raise SimulationBackendError( - "Simulation backend name must be a non-empty string." + f"Simulation backend {name!r} is already registered." ) - if not isinstance(registration.context_type, type) or not issubclass( - registration.context_type, SimulationContext + if not isinstance(context_type, type) or not issubclass( + context_type, SimulationContext ): raise SimulationBackendError( "Backend context_type must extend SimulationContext." ) - capability = registration.sysid - if capability is None: - return registration - if not isinstance(capability, SysIdBackend): - raise SimulationBackendError("Backend sysid capability must be a SysIdBackend.") - if not isinstance(capability.config_model, type) or not issubclass( - capability.config_model, SysIdSimulationConfig - ): - raise SimulationBackendError( - "Backend config_model must extend SysIdSimulationConfig." + callbacks = None + if any( + value is not None + for value in ( + config_model, + create_context, + create_evaluator, + export_model, + describe_runtime, ) - for name in ( - "create_context", - "create_evaluator", - "export_model", - "describe_runtime", ): - factory = getattr(capability, name) - if ( - factory is None and name in ("export_model", "describe_runtime") - ) or callable(factory): - continue - raise SimulationBackendError(f"Backend {name} must be callable.") - return registration - - -def register_simulation_backend(registration: SimulationBackend) -> None: - """Register a backend once, rejecting invalid capabilities and name collisions.""" - - _ensure_builtin() - _validate_registration(registration) - target = _BACKENDS if _PENDING is None else _PENDING - if registration.name in target: - raise SimulationBackendError( - f"Simulation backend {registration.name!r} is already registered." + if config_model is None or create_context is None or create_evaluator is None: + raise SimulationBackendError( + "SysID registration requires config_model, create_context, and create_evaluator." + ) + if not isinstance(config_model, type) or not issubclass( + config_model, SysIdSimulationConfig + ): + raise SimulationBackendError( + "Backend config_model must extend SysIdSimulationConfig." + ) + for label, factory in ( + ("create_context", create_context), + ("create_evaluator", create_evaluator), + ("export_model", export_model), + ("describe_runtime", describe_runtime), + ): + if factory is None and label in ("export_model", "describe_runtime"): + continue + if not callable(factory): + raise SimulationBackendError(f"Backend {label} must be callable.") + callbacks = _SysIdCallbacks( + config_model=config_model, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, + describe_runtime=describe_runtime, ) - target[registration.name] = registration + SIMULATION_CONTEXTS[name] = context_type + if callbacks is not None: + _SYSID_CALLBACKS[name] = callbacks def discover_sysid_backends() -> None: - """Load sorted entry points atomically, allowing a failed discovery to retry.""" - - global _DISCOVERED, _PENDING + """Run installed registration functions, rolling back a failed discovery.""" + global _DISCOVERED, _DISCOVERING if _DISCOVERED: return - if _PENDING is not None: + if _DISCOVERING: raise SimulationBackendError( "Recursive simulation backend discovery is not supported." ) _ensure_builtin() + contexts_before = SIMULATION_CONTEXTS.copy() + callbacks_before = _SYSID_CALLBACKS.copy() + _DISCOVERING = True try: entries = sorted( entry_points(group="anchor_bench.sysid_backends"), @@ -196,60 +174,62 @@ def discover_sysid_backends() -> None: f"Duplicate simulation backend entry-point names: {', '.join(duplicates)}." ) for entry in entries: - if entry.name in _BACKENDS: + if entry.name in SIMULATION_CONTEXTS: raise SimulationBackendError( f"Simulation backend {entry.name!r} is already registered." ) - _PENDING = _BACKENDS.copy() for entry in entries: + names_before = set(SIMULATION_CONTEXTS) try: provider = entry.load() if not callable(provider): raise SimulationBackendError( "Entry-point provider must be callable." ) - registration = _validate_registration(provider()) - if registration.name != entry.name: + if provider() is not None: raise SimulationBackendError( - f"Entry-point name {entry.name!r} does not match registration name {registration.name!r}." + "Entry-point provider must register its context and return None." + ) + if set(SIMULATION_CONTEXTS) - names_before != {entry.name}: + raise SimulationBackendError( + f"Entry-point provider must register exactly its name {entry.name!r}." ) - register_simulation_backend(registration) except Exception as error: raise SimulationBackendError( f"Could not load simulation backend {entry.name!r}: {error}" ) from error - _BACKENDS.update(_PENDING) _DISCOVERED = True - except SimulationBackendError: - raise except Exception as error: + SIMULATION_CONTEXTS.clear() + SIMULATION_CONTEXTS.update(contexts_before) + _SYSID_CALLBACKS.clear() + _SYSID_CALLBACKS.update(callbacks_before) + if isinstance(error, SimulationBackendError): + raise raise SimulationBackendError( f"Could not discover simulation backends: {error}" ) from error finally: - _PENDING = None - + _DISCOVERING = False -def get_sysid_backend(name: str) -> SysIdBackend: - """Return a discovered backend's identification capability or fail early.""" +def get_sysid_callbacks(name: str) -> _SysIdCallbacks: + """Look up the sysID callbacks attached to a registered context.""" discover_sysid_backends() - registration = _BACKENDS.get(name) - if registration is None: + if name not in SIMULATION_CONTEXTS: raise SimulationBackendError(f"Unknown simulation backend {name!r}.") - if registration.sysid is None: + if name not in _SYSID_CALLBACKS: raise SimulationBackendError( f"Simulation backend {name!r} does not support system identification." ) - return registration.sysid + return _SYSID_CALLBACKS[name] def create_sysid_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any]: - """Create and verify the concrete resource promised by a backend registration.""" - - backend = get_sysid_backend(config.simulation.type) - context = backend.create_context(config) - expected = _BACKENDS[config.simulation.type].context_type + """Create and verify the registered context using its sysID factory.""" + callbacks = get_sysid_callbacks(config.simulation.type) + context = callbacks["create_context"](config) + expected = SIMULATION_CONTEXTS[config.simulation.type] if type(context) is not expected: raise SimulationBackendError( f"Backend {config.simulation.type!r} returned context type {type(context).__name__}; expected {expected.__name__}." @@ -257,38 +237,15 @@ def create_sysid_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, return context -class _SimulationContexts(Mapping[str, type[SimulationContext[Any, Any]]]): - """Compatibility view over the single canonical backend registry.""" - - def __getitem__(self, name: str) -> type[SimulationContext[Any, Any]]: - _ensure_builtin() - return _BACKENDS[name].context_type - - def __iter__(self) -> Iterator[str]: - _ensure_builtin() - return iter(_BACKENDS) - - def __len__(self) -> int: - _ensure_builtin() - return len(_BACKENDS) - - -SIMULATION_CONTEXTS: Mapping[str, type[SimulationContext[Any, Any]]] = ( - _SimulationContexts() -) - - def create_simulation_context( backend: str, usd_path: str, *, fixed_base: bool = False, ) -> SimulationContext[Any, Any]: - """Preserve the training adapter's path-based construction API.""" - + """Create the context registered for a configured simulator.""" try: context_type = SIMULATION_CONTEXTS[backend] except KeyError as error: raise ValueError(f"Unknown simulation backend {backend!r}.") from error - constructor = cast(Callable[..., SimulationContext[Any, Any]], context_type) - return constructor(usd_path, fixed_base=fixed_base) + return context_type(usd_path, fixed_base=fixed_base) diff --git a/anchor_bench/schema/actuator_sys_id.py b/anchor_bench/schema/actuator_sys_id.py index 9a63102..23308da 100644 --- a/anchor_bench/schema/actuator_sys_id.py +++ b/anchor_bench/schema/actuator_sys_id.py @@ -137,21 +137,21 @@ class ActuatorSysIdConfig(BaseConfig): @field_validator("simulation", mode="before") @classmethod def dispatch_simulation(cls, value: object) -> SysIdSimulationConfig: - from anchor_bench.core.simulation.registry import get_sysid_backend + from anchor_bench.core.simulation.registry import get_sysid_callbacks if isinstance(value, SysIdSimulationConfig): - backend = get_sysid_backend(value.type) - if type(value) is not backend.config_model: + callbacks = get_sysid_callbacks(value.type) + if type(value) is not callbacks["config_model"]: raise ValueError( "simulation config must use the registered config model" ) - return backend.config_model.model_validate(value.model_dump()) + return callbacks["config_model"].model_validate(value.model_dump()) if not isinstance(value, dict): raise ValueError("simulation must be a configuration object") # noqa: TRY004 - Pydantic validation errors require ValueError backend_name = value.get("type") if not isinstance(backend_name, str): raise ValueError("simulation must define a string type") # noqa: TRY004 - Pydantic validation errors require ValueError - return get_sysid_backend(backend_name).config_model.model_validate(value) + return get_sysid_callbacks(backend_name)["config_model"].model_validate(value) @model_validator(mode="after") def validate_task_invariants(self) -> ActuatorSysIdConfig: diff --git a/anchor_bench/tasks/actuator_sys_id/task.py b/anchor_bench/tasks/actuator_sys_id/task.py index 0181766..be17e7a 100644 --- a/anchor_bench/tasks/actuator_sys_id/task.py +++ b/anchor_bench/tasks/actuator_sys_id/task.py @@ -10,7 +10,7 @@ from anchor_bench.core.simulation.registry import ( create_sysid_context, - get_sysid_backend, + get_sysid_callbacks, ) from anchor_bench.logging_utils import should_log_progress from anchor_bench.mlops import get_active_run @@ -30,7 +30,7 @@ class ActuatorSysIdTask(BaseTask[ActuatorSysIdConfig]): """Fit actuator parameters with the configured simulation backend.""" def run(self, output_directory: Path) -> Path: - backend = get_sysid_backend(self.config.simulation.type) + callbacks = get_sysid_callbacks(self.config.simulation.type) mlops_run = get_active_run() joint_names = [ joint for group in self.config.joint_parameters for joint in group.names @@ -46,7 +46,7 @@ def run(self, output_directory: Path) -> Path: parameter_space = create_parameter_space(self.config) optimizer = create_optimizer(self.config, parameter_space) context = create_sysid_context(self.config) - evaluator = backend.create_evaluator(self.config, parameter_space, context) + evaluator = callbacks["create_evaluator"](self.config, parameter_space, context) objective = ActuatorSysIdObjective( parameter_space, evaluator, @@ -84,15 +84,15 @@ def run(self, output_directory: Path) -> Path: best_parameters = parameter_space.decode(optimizer.best_candidate) model_artifact = ( - backend.export_model( + callbacks["export_model"]( self.config, best_parameters, context, output_directory ) - if backend.export_model is not None + if callbacks["export_model"] is not None else None ) runtime_simulation = ( - backend.describe_runtime(evaluator) - if backend.describe_runtime is not None + callbacks["describe_runtime"](evaluator) + if callbacks["describe_runtime"] is not None else None ) write_artifacts( diff --git a/docs/system-identification.md b/docs/system-identification.md index 3412ad0..8dbb10d 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -118,23 +118,16 @@ the resolved USD path and returns the model and initial state. Register these components through the Python API before validating a task: ```python -from anchor_bench.core.simulation.registry import ( - SimulationBackend, - SysIdBackend, - register_simulation_backend, +from anchor_bench.core.simulation.registry import register_simulation_backend + +register_simulation_backend( + "my_simulator", + MySimulationContext, + config_model=MySimulationConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, ) - -registration = SimulationBackend( - name="my_simulator", - context_type=MySimulationContext, - sysid=SysIdBackend( - config_model=MySimulationConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, - ), -) -register_simulation_backend(registration) ``` The classes and callbacks in this example are supplied by the plugin. @@ -145,15 +138,30 @@ finite position-MSE score per decoded candidate. The evaluator owns its simulator's candidate application, resets, command delay, buffer exclusion, actuation, and stepping. The task retains dataset loading and optimization. -An installed package can expose a zero-argument provider that returns the -`SimulationBackend` registration, using this entry-point group: +An installed package can expose a zero-argument provider that registers its +components with the same function call: + +```python +def provide_backend() -> None: + register_simulation_backend( + "my_simulator", + MySimulationContext, + config_model=MySimulationConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, + ) +``` + +Declare the provider using this entry-point group: ```toml [project.entry-points."anchor_bench.sysid_backends"] my_simulator = "my_package.backend:provide_backend" ``` -The entry-point name, registration name, and configuration `type` must agree. +The provider returns `None`. The entry-point name, registered name, and +configuration `type` must agree. Discovery runs before direct configuration validation and YAML parsing; duplicate names and invalid providers fail before optimization. Select the backend using `simulation.type: my_simulator` and provide its configuration diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py index 7bd017c..54bc2df 100644 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -14,7 +14,7 @@ import numpy as np from anchor_bench.core.simulation import SimulationContext -from anchor_bench.core.simulation.registry import SimulationBackend, SysIdBackend +from anchor_bench.core.simulation.registry import register_simulation_backend from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.schema.simulation import SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id.model import ( @@ -106,26 +106,22 @@ def export_model( return IdentifiedModelArtifact(path=path, format="json") -def provide_json() -> SimulationBackend: - return SimulationBackend( - name="toy-sysid", - context_type=ToyContext, - sysid=SysIdBackend( - config_model=ToyConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, - ), +def provide_json() -> None: + register_simulation_backend( + "toy-sysid", + ToyContext, + config_model=ToyConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, ) -def provide_no_export() -> SimulationBackend: - return SimulationBackend( - name="toy-sysid", - context_type=ToyContext, - sysid=SysIdBackend( - config_model=ToyConfig, - create_context=create_context, - create_evaluator=create_evaluator, - ), +def provide_no_export() -> None: + register_simulation_backend( + "toy-sysid", + ToyContext, + config_model=ToyConfig, + create_context=create_context, + create_evaluator=create_evaluator, ) diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 75e754a..602f1ee 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -15,7 +15,6 @@ import yaml from anchor_bench.core.simulation import SimulationContext, registry -from anchor_bench.core.simulation.registry import SimulationBackend, SysIdBackend from anchor_bench.core.task_runner import TaskRunner from anchor_bench.errors import DatasetAlignmentError, SimulationBackendError from anchor_bench.mlops import MLOpsRun, bind_active_run @@ -104,7 +103,10 @@ def _load(self, usd_path: Path): @pytest.fixture def register_toy(monkeypatch, tmp_path): monkeypatch.setattr(SimulationContext, "_instance", None) - monkeypatch.setattr(registry, "_BACKENDS", registry._BACKENDS.copy()) + monkeypatch.setattr( + registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() + ) + monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) monkeypatch.setattr(registry, "_DISCOVERED", True) def register(create_evaluator, *, export_model=None, describe_runtime=None): @@ -118,17 +120,13 @@ def create_context(config): return context registry.register_simulation_backend( - SimulationBackend( - "task-toy", - ToyContext, - SysIdBackend( - ToySimulationConfig, - create_context, - create_evaluator, - export_model, - describe_runtime, - ), - ) + "task-toy", + ToyContext, + config_model=ToySimulationConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, + describe_runtime=describe_runtime, ) config = _config( tmp_path, @@ -527,9 +525,12 @@ def export_model(*args): def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): config = _config(tmp_path) - monkeypatch.setattr(registry, "_BACKENDS", registry._BACKENDS.copy()) + monkeypatch.setattr( + registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() + ) + monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) monkeypatch.setattr(registry, "_DISCOVERED", True) - registry.register_simulation_backend(SimulationBackend("resource-only", ToyContext)) + registry.register_simulation_backend("resource-only", ToyContext) config.simulation = SysIdSimulationConfig( usd_path=config.simulation.usd_path, type="resource-only", diff --git a/tests/test_simulation_registry.py b/tests/test_simulation_registry.py index 7394542..41c4ef7 100644 --- a/tests/test_simulation_registry.py +++ b/tests/test_simulation_registry.py @@ -30,10 +30,3 @@ def test_rejects_unknown_backend() -> None: with pytest.raises(ValueError, match="Unknown simulation backend 'missing'"): create_simulation_context("missing", "robot.usda") - - -def test_registry_exposes_typed_sysid_registration() -> None: - from anchor_bench.core.simulation import registry - - assert hasattr(registry, "SysIdBackend") - assert hasattr(registry, "register_simulation_backend") diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index 5677f61..4e4ff79 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -33,24 +33,23 @@ def _load(self, usd_path: Path) -> tuple[object, object]: return object(), object() -def toy_registration(name: str = "toy") -> registry.SimulationBackend: - return registry.SimulationBackend( - name=name, - context_type=ToyContext, - sysid=registry.SysIdBackend( - config_model=ToyConfig, - create_context=lambda config: ToyContext( - usd_path=config.simulation.usd_path - ), - create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] - ), +def toy_registration(name: str = "toy") -> None: + registry.register_simulation_backend( + name, + ToyContext, + config_model=ToyConfig, + create_context=lambda config: ToyContext(usd_path=config.simulation.usd_path), + create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] ) @pytest.fixture(autouse=True) def isolated_registry(monkeypatch: pytest.MonkeyPatch): registry.discover_sysid_backends() - monkeypatch.setattr(registry, "_BACKENDS", registry._BACKENDS.copy()) + monkeypatch.setattr( + registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() + ) + monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) monkeypatch.setattr(registry, "_DISCOVERED", False) monkeypatch.setattr(registry, "entry_points", lambda **kwargs: []) monkeypatch.setattr(SimulationContext, "_instance", None) @@ -100,7 +99,7 @@ def toy_task_data(tmp_path): def test_plugin_simulation_roundtrips_without_losing_fields(toy_task_data): - registry.register_simulation_backend(toy_registration()) + toy_registration() config = ActuatorSysIdConfig.model_validate(toy_task_data) assert isinstance(config.simulation, ToyConfig) assert config.simulation.gain == 2 @@ -115,7 +114,7 @@ def test_plugin_simulation_roundtrips_without_losing_fields(toy_task_data): @pytest.mark.parametrize("patch", [{"gain": "2"}, {"extra": 1}, {"control_freq": 300}]) def test_plugin_simulation_is_strict(toy_task_data, patch): - registry.register_simulation_backend(toy_registration()) + toy_registration() toy_task_data["simulation"].update(patch) with pytest.raises(ValidationError): ActuatorSysIdConfig.model_validate(toy_task_data) @@ -130,7 +129,7 @@ def test_discovery_is_idempotent(monkeypatch): registry.discover_sysid_backends() registry.discover_sysid_backends() assert loads == ["load"] - assert registry.get_sysid_backend("toy").config_model is ToyConfig + assert registry.get_sysid_callbacks("toy")["config_model"] is ToyConfig def test_discovery_error_does_not_leave_partial_registration(monkeypatch): @@ -142,6 +141,7 @@ def test_discovery_error_does_not_leave_partial_registration(monkeypatch): with pytest.raises(SimulationBackendError, match="broken"): registry.discover_sysid_backends() assert "toy" not in registry.SIMULATION_CONTEXTS + assert "toy" not in registry._SYSID_CALLBACKS assert not registry._DISCOVERED monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [first]) registry.discover_sysid_backends() @@ -163,20 +163,19 @@ def test_entry_point_name_must_match_registration(monkeypatch): with pytest.raises(SimulationBackendError, match="name"): registry.discover_sysid_backends() assert "toy" not in registry.SIMULATION_CONTEXTS + assert "toy" not in registry._SYSID_CALLBACKS def test_python_registration_rejects_duplicate_names(): - registry.register_simulation_backend(toy_registration()) + toy_registration() with pytest.raises(SimulationBackendError, match="already registered"): - registry.register_simulation_backend(toy_registration()) + toy_registration() with pytest.raises(SimulationBackendError, match="already registered"): - registry.register_simulation_backend(toy_registration("newton")) + toy_registration("newton") def test_registered_backend_without_sysid_fails_early(toy_task_data): - registry.register_simulation_backend( - registry.SimulationBackend("toy", ToyContext, None) - ) + registry.register_simulation_backend("toy", ToyContext) with pytest.raises(SimulationBackendError, match="system identification"): ActuatorSysIdConfig.model_validate(toy_task_data) @@ -185,14 +184,13 @@ def test_wrong_concrete_context_factory_is_rejected(toy_task_data): class OtherContext(ToyContext): pass - capability = registry.SysIdBackend( + registry.register_simulation_backend( + "toy", + ToyContext, config_model=ToyConfig, create_context=lambda config: OtherContext(config.simulation.usd_path), create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] ) - registry.register_simulation_backend( - registry.SimulationBackend("toy", ToyContext, capability) - ) config = ActuatorSysIdConfig.model_validate(toy_task_data) with pytest.raises(SimulationBackendError, match="context type"): registry.create_sysid_context(config) @@ -210,7 +208,7 @@ def test_discovery_loads_providers_in_metadata_name_order(monkeypatch): def entry(name): def load(): loaded.append(name) - return lambda: registry.SimulationBackend(name, ToyContext) + return lambda: registry.register_simulation_backend(name, ToyContext) return SimpleNamespace(name=name, load=load) @@ -226,7 +224,7 @@ def load(): [ None, lambda: object(), - lambda: registry.SimulationBackend("toy", cast(Any, object)), + lambda: registry.register_simulation_backend("toy", cast(Any, object)), ], ) def test_invalid_plugin_capabilities_fail_atomically(monkeypatch, provider): @@ -235,6 +233,7 @@ def test_invalid_plugin_capabilities_fail_atomically(monkeypatch, provider): with pytest.raises(SimulationBackendError): registry.discover_sysid_backends() assert "toy" not in registry.SIMULATION_CONTEXTS + assert "toy" not in registry._SYSID_CALLBACKS assert not registry._DISCOVERED @@ -262,7 +261,7 @@ def broken(**kwargs): def test_provider_registration_side_effects_are_rolled_back(monkeypatch): def broken(): - registry.register_simulation_backend(toy_registration()) + toy_registration() raise RuntimeError("provider failed") entry = SimpleNamespace(name="toy", load=lambda: broken) @@ -270,6 +269,7 @@ def broken(): with pytest.raises(SimulationBackendError, match="provider failed"): registry.discover_sysid_backends() assert "toy" not in registry.SIMULATION_CONTEXTS + assert "toy" not in registry._SYSID_CALLBACKS def test_validation_discovers_before_dispatch(monkeypatch, toy_task_data): @@ -296,7 +296,7 @@ def test_yaml_parser_discovers_before_dispatch(monkeypatch, toy_task_data, tmp_p def test_plugin_simulation_requires_usd_input(toy_task_data): - registry.register_simulation_backend(toy_registration()) + toy_registration() toy_task_data["simulation"].pop("usd_path", None) with pytest.raises(ValidationError, match="usd_path"): ActuatorSysIdConfig.model_validate(toy_task_data) From 8ba3d9deaf6d9d26a78bcb612627b735f65f4715 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 16:00:41 -0700 Subject: [PATCH 12/16] refactor: keep simulator registration explicit --- anchor_bench/__init__.py | 16 +- anchor_bench/core/simulation/registry.py | 220 +++--------------- .../tasks/actuator_sys_id/__init__.py | 29 +-- anchor_bench/tasks/actuator_sys_id/task.py | 7 +- docs/system-identification.md | 46 ++-- tests/fixtures/sysid_backend/run_cli.py | 13 +- .../toy_sysid_backend/__init__.py | 2 +- tests/integration/test_sysid_backend_cli.py | 32 +-- tests/test_actuator_sys_id_task.py | 4 +- tests/test_sysid_backends.py | 156 +------------ 10 files changed, 90 insertions(+), 435 deletions(-) diff --git a/anchor_bench/__init__.py b/anchor_bench/__init__.py index 30f4af5..7e889d4 100644 --- a/anchor_bench/__init__.py +++ b/anchor_bench/__init__.py @@ -3,20 +3,6 @@ """Anchor Bench task runner.""" -from typing import TYPE_CHECKING, Any - -if TYPE_CHECKING: - from anchor_bench.core.task_runner import TaskRunner +from anchor_bench.core.task_runner import TaskRunner __all__ = ["TaskRunner"] - - -def __getattr__(name: str) -> Any: - """Load the runner only when explicitly requested.""" - - if name != "TaskRunner": - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") - from anchor_bench.core.task_runner import TaskRunner - - globals()[name] = TaskRunner - return TaskRunner diff --git a/anchor_bench/core/simulation/registry.py b/anchor_bench/core/simulation/registry.py index a375734..949e525 100644 --- a/anchor_bench/core/simulation/registry.py +++ b/anchor_bench/core/simulation/registry.py @@ -1,14 +1,11 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Simulation contexts and their optional system-identification callbacks.""" +"""Explicit simulation context registration and sysID callbacks.""" from __future__ import annotations -from collections import Counter from collections.abc import Callable, Mapping -from importlib.metadata import entry_points -from pathlib import Path from typing import TYPE_CHECKING, Any, TypedDict from anchor_bench.core.simulation import SimulationContext @@ -16,206 +13,63 @@ from anchor_bench.errors import SimulationBackendError if TYPE_CHECKING: - from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.schema.simulation import JsonValue, SysIdSimulationConfig - from anchor_bench.tasks.actuator_sys_id.model import ( - Candidate, - IdentifiedModelArtifact, - ) + from anchor_bench.tasks.actuator_sys_id.model import IdentifiedModelArtifact from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator - from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace class _SysIdCallbacks(TypedDict): config_model: type[SysIdSimulationConfig] - create_context: Callable[[ActuatorSysIdConfig], SimulationContext[Any, Any]] - create_evaluator: Callable[ - [ActuatorSysIdConfig, ParameterSpace, SimulationContext[Any, Any]], - PopulationEvaluator, - ] - export_model: ( - Callable[ - [ActuatorSysIdConfig, Candidate, SimulationContext[Any, Any], Path], - IdentifiedModelArtifact | None, - ] - | None - ) - describe_runtime: Callable[[PopulationEvaluator], Mapping[str, JsonValue]] | None + create_context: Callable[..., SimulationContext[Any, Any]] + create_evaluator: Callable[..., PopulationEvaluator] + export_model: Callable[..., IdentifiedModelArtifact | None] | None + describe_runtime: Callable[..., Mapping[str, JsonValue]] | None SIMULATION_CONTEXTS: dict[str, type[SimulationContext[Any, Any]]] = { "newton": NewtonSimulationContext, } _SYSID_CALLBACKS: dict[str, _SysIdCallbacks] = {} -_DISCOVERED = False -_DISCOVERING = False - - -def _ensure_builtin() -> None: - if "newton" in _SYSID_CALLBACKS: - return - from anchor_bench.schema.simulation import NewtonSimulationConfig - from anchor_bench.tasks.actuator_sys_id.backends import newton - - _SYSID_CALLBACKS["newton"] = { - "config_model": NewtonSimulationConfig, - "create_context": newton.create_context, - "create_evaluator": newton.create_evaluator, - "export_model": newton.export_model, - "describe_runtime": newton.describe_runtime, - } def register_simulation_backend( name: str, context_type: type[SimulationContext[Any, Any]], *, - config_model: type[SysIdSimulationConfig] | None = None, - create_context: Callable[[ActuatorSysIdConfig], SimulationContext[Any, Any]] - | None = None, - create_evaluator: Callable[ - [ActuatorSysIdConfig, ParameterSpace, SimulationContext[Any, Any]], - PopulationEvaluator, - ] - | None = None, - export_model: Callable[ - [ActuatorSysIdConfig, Candidate, SimulationContext[Any, Any], Path], - IdentifiedModelArtifact | None, - ] - | None = None, - describe_runtime: Callable[[PopulationEvaluator], Mapping[str, JsonValue]] - | None = None, + config_model: type[SysIdSimulationConfig], + create_context: Callable[..., SimulationContext[Any, Any]], + create_evaluator: Callable[..., PopulationEvaluator], + export_model: Callable[..., IdentifiedModelArtifact | None] | None = None, + describe_runtime: Callable[..., Mapping[str, JsonValue]] | None = None, ) -> None: - """Register a context class, optionally with the callbacks needed for sysID.""" - from anchor_bench.schema.simulation import SysIdSimulationConfig - - if not isinstance(name, str) or not name.strip(): - raise SimulationBackendError( - "Simulation backend name must be a non-empty string." - ) + """Register a simulator and the callbacks used to run sysID with it.""" if name in SIMULATION_CONTEXTS: raise SimulationBackendError( f"Simulation backend {name!r} is already registered." ) - if not isinstance(context_type, type) or not issubclass( - context_type, SimulationContext - ): - raise SimulationBackendError( - "Backend context_type must extend SimulationContext." - ) - callbacks = None - if any( - value is not None - for value in ( - config_model, - create_context, - create_evaluator, - export_model, - describe_runtime, - ) - ): - if config_model is None or create_context is None or create_evaluator is None: - raise SimulationBackendError( - "SysID registration requires config_model, create_context, and create_evaluator." - ) - if not isinstance(config_model, type) or not issubclass( - config_model, SysIdSimulationConfig - ): - raise SimulationBackendError( - "Backend config_model must extend SysIdSimulationConfig." - ) - for label, factory in ( - ("create_context", create_context), - ("create_evaluator", create_evaluator), - ("export_model", export_model), - ("describe_runtime", describe_runtime), - ): - if factory is None and label in ("export_model", "describe_runtime"): - continue - if not callable(factory): - raise SimulationBackendError(f"Backend {label} must be callable.") - callbacks = _SysIdCallbacks( - config_model=config_model, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, - describe_runtime=describe_runtime, - ) SIMULATION_CONTEXTS[name] = context_type - if callbacks is not None: - _SYSID_CALLBACKS[name] = callbacks - - -def discover_sysid_backends() -> None: - """Run installed registration functions, rolling back a failed discovery.""" - global _DISCOVERED, _DISCOVERING - if _DISCOVERED: - return - if _DISCOVERING: - raise SimulationBackendError( - "Recursive simulation backend discovery is not supported." - ) - _ensure_builtin() - contexts_before = SIMULATION_CONTEXTS.copy() - callbacks_before = _SYSID_CALLBACKS.copy() - _DISCOVERING = True - try: - entries = sorted( - entry_points(group="anchor_bench.sysid_backends"), - key=lambda entry: entry.name, - ) - duplicates = sorted( - name - for name, count in Counter(entry.name for entry in entries).items() - if count > 1 - ) - if duplicates: - raise SimulationBackendError( - f"Duplicate simulation backend entry-point names: {', '.join(duplicates)}." - ) - for entry in entries: - if entry.name in SIMULATION_CONTEXTS: - raise SimulationBackendError( - f"Simulation backend {entry.name!r} is already registered." - ) - for entry in entries: - names_before = set(SIMULATION_CONTEXTS) - try: - provider = entry.load() - if not callable(provider): - raise SimulationBackendError( - "Entry-point provider must be callable." - ) - if provider() is not None: - raise SimulationBackendError( - "Entry-point provider must register its context and return None." - ) - if set(SIMULATION_CONTEXTS) - names_before != {entry.name}: - raise SimulationBackendError( - f"Entry-point provider must register exactly its name {entry.name!r}." - ) - except Exception as error: - raise SimulationBackendError( - f"Could not load simulation backend {entry.name!r}: {error}" - ) from error - _DISCOVERED = True - except Exception as error: - SIMULATION_CONTEXTS.clear() - SIMULATION_CONTEXTS.update(contexts_before) - _SYSID_CALLBACKS.clear() - _SYSID_CALLBACKS.update(callbacks_before) - if isinstance(error, SimulationBackendError): - raise - raise SimulationBackendError( - f"Could not discover simulation backends: {error}" - ) from error - finally: - _DISCOVERING = False + _SYSID_CALLBACKS[name] = { + "config_model": config_model, + "create_context": create_context, + "create_evaluator": create_evaluator, + "export_model": export_model, + "describe_runtime": describe_runtime, + } def get_sysid_callbacks(name: str) -> _SysIdCallbacks: - """Look up the sysID callbacks attached to a registered context.""" - discover_sysid_backends() + """Return explicitly registered callbacks, including the built-in Newton ones.""" + if name == "newton" and name not in _SYSID_CALLBACKS: + from anchor_bench.schema.simulation import NewtonSimulationConfig + from anchor_bench.tasks.actuator_sys_id.backends import newton + + _SYSID_CALLBACKS[name] = { + "config_model": NewtonSimulationConfig, + "create_context": newton.create_context, + "create_evaluator": newton.create_evaluator, + "export_model": newton.export_model, + "describe_runtime": newton.describe_runtime, + } if name not in SIMULATION_CONTEXTS: raise SimulationBackendError(f"Unknown simulation backend {name!r}.") if name not in _SYSID_CALLBACKS: @@ -225,18 +79,6 @@ def get_sysid_callbacks(name: str) -> _SysIdCallbacks: return _SYSID_CALLBACKS[name] -def create_sysid_context(config: ActuatorSysIdConfig) -> SimulationContext[Any, Any]: - """Create and verify the registered context using its sysID factory.""" - callbacks = get_sysid_callbacks(config.simulation.type) - context = callbacks["create_context"](config) - expected = SIMULATION_CONTEXTS[config.simulation.type] - if type(context) is not expected: - raise SimulationBackendError( - f"Backend {config.simulation.type!r} returned context type {type(context).__name__}; expected {expected.__name__}." - ) - return context - - def create_simulation_context( backend: str, usd_path: str, diff --git a/anchor_bench/tasks/actuator_sys_id/__init__.py b/anchor_bench/tasks/actuator_sys_id/__init__.py index b704a3d..3373409 100644 --- a/anchor_bench/tasks/actuator_sys_id/__init__.py +++ b/anchor_bench/tasks/actuator_sys_id/__init__.py @@ -1,32 +1,9 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Actuator system-identification task and result.""" +"""Native-Newton actuator system-identification task.""" -from importlib import import_module -from typing import TYPE_CHECKING, Any - -if TYPE_CHECKING: - from anchor_bench.tasks.actuator_sys_id.model import SysIdResult - from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask - -_EXPORTS = { - "ActuatorSysIdTask": ( - "anchor_bench.tasks.actuator_sys_id.task", - "ActuatorSysIdTask", - ), - "SysIdResult": ("anchor_bench.tasks.actuator_sys_id.model", "SysIdResult"), -} +from anchor_bench.tasks.actuator_sys_id.model import SysIdResult +from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask __all__ = ["ActuatorSysIdTask", "SysIdResult"] - - -def __getattr__(name: str) -> Any: - """Resolve public exports without importing task or simulator runtimes eagerly.""" - - if name not in _EXPORTS: - raise AttributeError(f"module {__name__!r} has no attribute {name!r}") - module_name, attribute = _EXPORTS[name] - value = getattr(import_module(module_name), attribute) - globals()[name] = value - return value diff --git a/anchor_bench/tasks/actuator_sys_id/task.py b/anchor_bench/tasks/actuator_sys_id/task.py index be17e7a..dde1589 100644 --- a/anchor_bench/tasks/actuator_sys_id/task.py +++ b/anchor_bench/tasks/actuator_sys_id/task.py @@ -8,10 +8,7 @@ import logging from pathlib import Path -from anchor_bench.core.simulation.registry import ( - create_sysid_context, - get_sysid_callbacks, -) +from anchor_bench.core.simulation.registry import get_sysid_callbacks from anchor_bench.logging_utils import should_log_progress from anchor_bench.mlops import get_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig @@ -45,7 +42,7 @@ def run(self, output_directory: Path) -> Path: ) parameter_space = create_parameter_space(self.config) optimizer = create_optimizer(self.config, parameter_space) - context = create_sysid_context(self.config) + context = callbacks["create_context"](self.config) evaluator = callbacks["create_evaluator"](self.config, parameter_space, context) objective = ActuatorSysIdObjective( parameter_space, diff --git a/docs/system-identification.md b/docs/system-identification.md index 8dbb10d..16a081b 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -138,34 +138,36 @@ finite position-MSE score per decoded candidate. The evaluator owns its simulator's candidate application, resets, command delay, buffer exclusion, actuation, and stepping. The task retains dataset loading and optimization. -An installed package can expose a zero-argument provider that registers its -components with the same function call: +To run the command-line task with a custom backend, register it in your own +entry script before invoking the CLI: ```python -def provide_backend() -> None: - register_simulation_backend( - "my_simulator", - MySimulationContext, - config_model=MySimulationConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, - ) -``` +from anchor_bench.cli import main +from anchor_bench.core.simulation.registry import register_simulation_backend -Declare the provider using this entry-point group: +from my_package.backend import ( + MySimulationConfig, + MySimulationContext, + create_context, + create_evaluator, + export_model, +) -```toml -[project.entry-points."anchor_bench.sysid_backends"] -my_simulator = "my_package.backend:provide_backend" +register_simulation_backend( + "my_simulator", + MySimulationContext, + config_model=MySimulationConfig, + create_context=create_context, + create_evaluator=create_evaluator, + export_model=export_model, +) +raise SystemExit(main()) ``` -The provider returns `None`. The entry-point name, registered name, and -configuration `type` must agree. -Discovery runs before direct configuration validation and YAML parsing; -duplicate names and invalid providers fail before optimization. Select the -backend using `simulation.type: my_simulator` and provide its configuration -fields. Plugin fields survive configuration serialization and hashing. +Run this script with the usual `--config` and `--output` arguments. Select the +backend using `simulation.type: my_simulator`; this value must match the +registered name and configuration `type`. Plugin fields survive configuration +serialization and hashing. Model export is optional. An exporter receives `(config, best_parameters, context, output_directory)` and returns an `IdentifiedModelArtifact(path, diff --git a/tests/fixtures/sysid_backend/run_cli.py b/tests/fixtures/sysid_backend/run_cli.py index e72948b..f51fcc1 100644 --- a/tests/fixtures/sysid_backend/run_cli.py +++ b/tests/fixtures/sysid_backend/run_cli.py @@ -1,7 +1,9 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Enter the real CLI with Newton construction forbidden in this process.""" +"""Register a custom backend and enter the CLI with Newton resources forbidden.""" + +import sys import newton @@ -9,13 +11,18 @@ def forbid_newton(*args: object, **kwargs: object) -> None: - raise AssertionError("installed toy backend must not construct Newton resources") + raise AssertionError("custom toy backend must not construct Newton resources") NewtonSimulationContext.__new__ = staticmethod(forbid_newton) # pyright: ignore[reportAttributeAccessIssue] newton.ModelBuilder = forbid_newton # pyright: ignore[reportAssignmentType] -# Import the CLI only after installing the construction guards. +# Import and register the backend only after installing the construction guards. +import toy_sysid_backend + from anchor_bench.cli import main +provider = sys.argv.pop(1) +getattr(toy_sysid_backend, provider)() + raise SystemExit(main()) diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py index 54bc2df..118f895 100644 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""A USD-backed installed backend for exercising the real sysID CLI.""" +"""A USD-backed custom backend for exercising the real sysID CLI.""" from __future__ import annotations diff --git a/tests/integration/test_sysid_backend_cli.py b/tests/integration/test_sysid_backend_cli.py index 144dafe..d6e4d76 100644 --- a/tests/integration/test_sysid_backend_cli.py +++ b/tests/integration/test_sysid_backend_cli.py @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Fresh-process installed-plugin discovery through the complete sysID CLI.""" +"""Fresh-process explicit backend registration through the complete sysID CLI.""" from __future__ import annotations @@ -32,18 +32,12 @@ @pytest.fixture -def installed_backend(tmp_path: Path) -> Path: - """Install an importable package and distribution metadata on a private path.""" - installed = tmp_path / "site-packages" - installed.mkdir() - shutil.copytree(FIXTURE / "toy_sysid_backend", installed / "toy_sysid_backend") - distribution = installed / "anchor_bench_toy_sysid-1.0.dist-info" - distribution.mkdir() - (distribution / "METADATA").write_text( - "Metadata-Version: 2.1\nName: anchor-bench-toy-sysid\nVersion: 1.0\n", - encoding="utf-8", - ) - return installed +def custom_backend(tmp_path: Path) -> Path: + """Copy an importable custom backend package onto a private path.""" + package_path = tmp_path / "custom-backend" + package_path.mkdir() + shutil.copytree(FIXTURE / "toy_sysid_backend", package_path / "toy_sysid_backend") + return package_path def _write_config(tmp_path: Path) -> Path: @@ -114,21 +108,16 @@ def _write_config(tmp_path: Path) -> Path: @pytest.mark.parametrize("export_json", [True, False], ids=["json-export", "no-export"]) -def test_cli_discovers_installed_sysid_backend( +def test_cli_uses_explicitly_registered_sysid_backend( tmp_path: Path, - installed_backend: Path, + custom_backend: Path, export_json: bool, ) -> None: provider = "provide_json" if export_json else "provide_no_export" - distribution = installed_backend / "anchor_bench_toy_sysid-1.0.dist-info" - (distribution / "entry_points.txt").write_text( - f"[anchor_bench.sysid_backends]\ntoy-sysid = toy_sysid_backend:{provider}\n", - encoding="utf-8", - ) config = _write_config(tmp_path) environment = dict(os.environ) environment["PYTHONPATH"] = os.pathsep.join( - [str(installed_backend), str(REPOSITORY), environment.get("PYTHONPATH", "")] + [str(custom_backend), str(REPOSITORY), environment.get("PYTHONPATH", "")] ) outputs = [tmp_path / "first-run", tmp_path / "repeat-run"] for output in outputs: @@ -136,6 +125,7 @@ def test_cli_discovers_installed_sysid_backend( [ sys.executable, str(FIXTURE / "run_cli.py"), + provider, "--config", str(config), "--output", diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 602f1ee..b04973a 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -107,7 +107,6 @@ def register_toy(monkeypatch, tmp_path): registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) - monkeypatch.setattr(registry, "_DISCOVERED", True) def register(create_evaluator, *, export_model=None, describe_runtime=None): usd = tmp_path / "scene.usda" @@ -529,8 +528,7 @@ def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) - monkeypatch.setattr(registry, "_DISCOVERED", True) - registry.register_simulation_backend("resource-only", ToyContext) + registry.SIMULATION_CONTEXTS["resource-only"] = ToyContext config.simulation = SysIdSimulationConfig( usd_path=config.simulation.usd_path, type="resource-only", diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index 4e4ff79..a61fdb8 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Typed plugin registration and transactional discovery boundaries.""" +"""Explicit simulator registration and configuration boundaries.""" from __future__ import annotations @@ -9,8 +9,7 @@ from copy import deepcopy from dataclasses import FrozenInstanceError from pathlib import Path -from types import SimpleNamespace -from typing import Any, Literal, cast +from typing import Literal import pytest from pydantic import StrictInt, ValidationError @@ -45,13 +44,11 @@ def toy_registration(name: str = "toy") -> None: @pytest.fixture(autouse=True) def isolated_registry(monkeypatch: pytest.MonkeyPatch): - registry.discover_sysid_backends() + registry.get_sysid_callbacks("newton") monkeypatch.setattr( registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) - monkeypatch.setattr(registry, "_DISCOVERED", False) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: []) monkeypatch.setattr(SimulationContext, "_instance", None) @@ -120,52 +117,6 @@ def test_plugin_simulation_is_strict(toy_task_data, patch): ActuatorSysIdConfig.model_validate(toy_task_data) -def test_discovery_is_idempotent(monkeypatch): - loads = [] - entry = SimpleNamespace( - name="toy", load=lambda: loads.append("load") or toy_registration - ) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) - registry.discover_sysid_backends() - registry.discover_sysid_backends() - assert loads == ["load"] - assert registry.get_sysid_callbacks("toy")["config_model"] is ToyConfig - - -def test_discovery_error_does_not_leave_partial_registration(monkeypatch): - first = SimpleNamespace(name="toy", load=lambda: toy_registration) - second = SimpleNamespace( - name="zzz", load=lambda: lambda: (_ for _ in ()).throw(RuntimeError("broken")) - ) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [second, first]) - with pytest.raises(SimulationBackendError, match="broken"): - registry.discover_sysid_backends() - assert "toy" not in registry.SIMULATION_CONTEXTS - assert "toy" not in registry._SYSID_CALLBACKS - assert not registry._DISCOVERED - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [first]) - registry.discover_sysid_backends() - assert "toy" in registry.SIMULATION_CONTEXTS - - -def test_duplicate_metadata_names_fail_before_loading(monkeypatch): - loads = [] - entry = SimpleNamespace(name="toy", load=lambda: loads.append(True)) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry, entry]) - with pytest.raises(SimulationBackendError, match="Duplicate"): - registry.discover_sysid_backends() - assert loads == [] - - -def test_entry_point_name_must_match_registration(monkeypatch): - entry = SimpleNamespace(name="other", load=lambda: toy_registration) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) - with pytest.raises(SimulationBackendError, match="name"): - registry.discover_sysid_backends() - assert "toy" not in registry.SIMULATION_CONTEXTS - assert "toy" not in registry._SYSID_CALLBACKS - - def test_python_registration_rejects_duplicate_names(): toy_registration() with pytest.raises(SimulationBackendError, match="already registered"): @@ -175,118 +126,23 @@ def test_python_registration_rejects_duplicate_names(): def test_registered_backend_without_sysid_fails_early(toy_task_data): - registry.register_simulation_backend("toy", ToyContext) + registry.SIMULATION_CONTEXTS["toy"] = ToyContext with pytest.raises(SimulationBackendError, match="system identification"): ActuatorSysIdConfig.model_validate(toy_task_data) -def test_wrong_concrete_context_factory_is_rejected(toy_task_data): - class OtherContext(ToyContext): - pass - - registry.register_simulation_backend( - "toy", - ToyContext, - config_model=ToyConfig, - create_context=lambda config: OtherContext(config.simulation.usd_path), - create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] - ) - config = ActuatorSysIdConfig.model_validate(toy_task_data) - with pytest.raises(SimulationBackendError, match="context type"): - registry.create_sysid_context(config) - - def test_artifact_is_frozen(): artifact = IdentifiedModelArtifact(Path("model.usd"), "usd") with pytest.raises(FrozenInstanceError): artifact.format = "other" # type: ignore[misc] -def test_discovery_loads_providers_in_metadata_name_order(monkeypatch): - loaded = [] - - def entry(name): - def load(): - loaded.append(name) - return lambda: registry.register_simulation_backend(name, ToyContext) - - return SimpleNamespace(name=name, load=load) - - monkeypatch.setattr( - registry, "entry_points", lambda **kwargs: [entry("z-last"), entry("a-first")] - ) - registry.discover_sysid_backends() - assert loaded == ["a-first", "z-last"] - - -@pytest.mark.parametrize( - "provider", - [ - None, - lambda: object(), - lambda: registry.register_simulation_backend("toy", cast(Any, object)), - ], -) -def test_invalid_plugin_capabilities_fail_atomically(monkeypatch, provider): - entry = SimpleNamespace(name="toy", load=lambda: provider) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) - with pytest.raises(SimulationBackendError): - registry.discover_sysid_backends() - assert "toy" not in registry.SIMULATION_CONTEXTS - assert "toy" not in registry._SYSID_CALLBACKS - assert not registry._DISCOVERED - - -def test_entry_point_cannot_replace_builtin_before_loading(monkeypatch): - loads = [] - entry = SimpleNamespace(name="newton", load=lambda: loads.append(True)) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) - with pytest.raises(SimulationBackendError, match="already registered"): - registry.discover_sysid_backends() - assert loads == [] - - -def test_entry_point_enumeration_errors_are_wrapped_and_retryable(monkeypatch): - def broken(**kwargs): - raise RuntimeError("metadata unavailable") - - monkeypatch.setattr(registry, "entry_points", broken) - with pytest.raises(SimulationBackendError, match="metadata unavailable"): - registry.discover_sysid_backends() - assert not registry._DISCOVERED - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: []) - registry.discover_sysid_backends() - assert registry._DISCOVERED - - -def test_provider_registration_side_effects_are_rolled_back(monkeypatch): - def broken(): - toy_registration() - raise RuntimeError("provider failed") - - entry = SimpleNamespace(name="toy", load=lambda: broken) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) - with pytest.raises(SimulationBackendError, match="provider failed"): - registry.discover_sysid_backends() - assert "toy" not in registry.SIMULATION_CONTEXTS - assert "toy" not in registry._SYSID_CALLBACKS - - -def test_validation_discovers_before_dispatch(monkeypatch, toy_task_data): - entry = SimpleNamespace(name="toy", load=lambda: toy_registration) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) - config = ActuatorSysIdConfig.model_validate(toy_task_data) - assert isinstance(config.simulation, ToyConfig) - assert config.simulation.gain == 2 - - -def test_yaml_parser_discovers_before_dispatch(monkeypatch, toy_task_data, tmp_path): +def test_yaml_parser_uses_explicit_registration(toy_task_data, tmp_path): import yaml from anchor_bench.schema.parse import parse - entry = SimpleNamespace(name="toy", load=lambda: toy_registration) - monkeypatch.setattr(registry, "entry_points", lambda **kwargs: [entry]) + toy_registration() path = tmp_path / "task.yaml" path.write_text(yaml.safe_dump(toy_task_data), encoding="utf-8") config = parse(path) From 0984d377b9870079d7d9a0385401391d76da31b6 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 16:54:24 -0700 Subject: [PATCH 13/16] refactor: trim unused sysid artifact inputs --- anchor_bench/errors.py | 2 +- anchor_bench/tasks/actuator_sys_id/artifacts.py | 2 -- anchor_bench/tasks/actuator_sys_id/task.py | 1 - tests/test_actuator_sys_id_task.py | 3 --- tests/test_sysid_backends.py | 8 -------- 5 files changed, 1 insertion(+), 15 deletions(-) diff --git a/anchor_bench/errors.py b/anchor_bench/errors.py index 135dc2e..0382642 100644 --- a/anchor_bench/errors.py +++ b/anchor_bench/errors.py @@ -41,4 +41,4 @@ class MLOpsTrackingError(MLOpsError): class SimulationBackendError(AnchorBenchError): - """Raised when simulation backend registration or discovery fails.""" + """Raised when simulation backend registration or selection fails.""" diff --git a/anchor_bench/tasks/actuator_sys_id/artifacts.py b/anchor_bench/tasks/actuator_sys_id/artifacts.py index 276b7a3..2e6bd09 100644 --- a/anchor_bench/tasks/actuator_sys_id/artifacts.py +++ b/anchor_bench/tasks/actuator_sys_id/artifacts.py @@ -12,7 +12,6 @@ import yaml -from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.schema.simulation import JsonValue from anchor_bench.tasks.actuator_sys_id.model import ( Candidate, @@ -28,7 +27,6 @@ def write_artifacts( best_parameters: Candidate, best_mse: float, history: Sequence[GenerationRecord], - config: ActuatorSysIdConfig, model_artifact: IdentifiedModelArtifact | None = None, runtime_simulation: Mapping[str, JsonValue] | None = None, ) -> SysIdResult: diff --git a/anchor_bench/tasks/actuator_sys_id/task.py b/anchor_bench/tasks/actuator_sys_id/task.py index dde1589..77f2487 100644 --- a/anchor_bench/tasks/actuator_sys_id/task.py +++ b/anchor_bench/tasks/actuator_sys_id/task.py @@ -97,7 +97,6 @@ def run(self, output_directory: Path) -> Path: best_parameters=best_parameters, best_mse=optimizer.best_score, history=history, - config=self.config, model_artifact=model_artifact, runtime_simulation=runtime_simulation, ) diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index b04973a..7468d4a 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -414,7 +414,6 @@ def describe_runtime(selected_evaluator): "json", ) assert written["runtime_simulation"] == {"type": "task-toy", "effective_gain": 2.0} - assert written["config"] is config assert written["best_parameters"]["hip"]["stiffness"] == pytest.approx(20.0) assert written["history"] == [ GenerationRecord(generation=0, best_mse=0.25, population_mean_mse=0.625) @@ -451,7 +450,6 @@ def test_common_artifacts_allow_missing_or_json_model_export( } output_dir = tmp_path / "output" output_dir.mkdir() - config = _config(tmp_path) model_artifact = None if model_format is not None: # Deliberately use the USD suffix for JSON: compatibility depends on format. @@ -473,7 +471,6 @@ def guard_import(name, *args, **kwargs): best_parameters=candidate, best_mse=0.125, history=[GenerationRecord(0, 0.125, 0.5)], - config=config, model_artifact=model_artifact, runtime_simulation={"type": "toy", "solver": {"iterations": 8}}, ) diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index a61fdb8..2c49c30 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -7,7 +7,6 @@ import json from copy import deepcopy -from dataclasses import FrozenInstanceError from pathlib import Path from typing import Literal @@ -19,7 +18,6 @@ from anchor_bench.errors import SimulationBackendError from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.schema.simulation import SysIdSimulationConfig -from anchor_bench.tasks.actuator_sys_id.model import IdentifiedModelArtifact class ToyConfig(SysIdSimulationConfig): @@ -131,12 +129,6 @@ def test_registered_backend_without_sysid_fails_early(toy_task_data): ActuatorSysIdConfig.model_validate(toy_task_data) -def test_artifact_is_frozen(): - artifact = IdentifiedModelArtifact(Path("model.usd"), "usd") - with pytest.raises(FrozenInstanceError): - artifact.format = "other" # type: ignore[misc] - - def test_yaml_parser_uses_explicit_registration(toy_task_data, tmp_path): import yaml From 30fe05c2289bf2f7324c3f43fda282bdb4a3ba6d Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 19:32:39 -0700 Subject: [PATCH 14/16] Use context and evaluator methods for sysid dispatch --- anchor_bench/core/simulation/__init__.py | 20 ++- anchor_bench/core/simulation/newton.py | 21 ++- anchor_bench/core/simulation/registry.py | 77 ++------ anchor_bench/schema/actuator_sys_id.py | 26 +-- .../actuator_sys_id/backends/__init__.py | 4 - .../tasks/actuator_sys_id/backends/newton.py | 74 -------- .../tasks/actuator_sys_id/objective.py | 28 ++- .../tasks/actuator_sys_id/simulation.py | 33 +++- anchor_bench/tasks/actuator_sys_id/task.py | 29 ++- docs/system-identification.md | 60 +++---- .../toy_sysid_backend/__init__.py | 105 +++++------ tests/test_actuator_sys_id_optimization.py | 7 +- tests/test_actuator_sys_id_task.py | 170 ++++++++++++------ tests/test_sysid_backends.py | 25 +-- 14 files changed, 336 insertions(+), 343 deletions(-) delete mode 100644 anchor_bench/tasks/actuator_sys_id/backends/__init__.py delete mode 100644 anchor_bench/tasks/actuator_sys_id/backends/newton.py diff --git a/anchor_bench/core/simulation/__init__.py b/anchor_bench/core/simulation/__init__.py index 7ee2241..d78a840 100644 --- a/anchor_bench/core/simulation/__init__.py +++ b/anchor_bench/core/simulation/__init__.py @@ -7,10 +7,18 @@ from abc import ABC, abstractmethod from pathlib import Path -from typing import Any, ClassVar, Generic, Optional, Tuple, TypeVar, cast +from typing import TYPE_CHECKING, Any, ClassVar, Generic, Optional, Tuple, TypeVar, cast from typing_extensions import Self +from anchor_bench.errors import SimulationBackendError + +if TYPE_CHECKING: + from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig + from anchor_bench.schema.simulation import SysIdSimulationConfig + from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator + from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace + ModelT = TypeVar("ModelT") StateT = TypeVar("StateT") @@ -18,6 +26,8 @@ class SimulationContext(ABC, Generic[ModelT, StateT]): """Own the single lazily loaded simulation model and state.""" + sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = None + _instance: ClassVar[Optional[SimulationContext[Any, Any]]] = None _usd_path: Path _fixed_base: bool @@ -112,6 +122,14 @@ def state(self) -> StateT: _, state = self.load() return state + def create_sysid_evaluator( + self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace + ) -> PopulationEvaluator: + """Create an evaluator when this simulator supports system identification.""" + raise SimulationBackendError( + f"{type(self).__name__} does not support system identification." + ) + @abstractmethod def _load(self, usd_path: Path) -> Tuple[ModelT, StateT]: """Load a backend model and initial state from the assigned USD.""" diff --git a/anchor_bench/core/simulation/newton.py b/anchor_bench/core/simulation/newton.py index b1584a4..9a4cf0e 100644 --- a/anchor_bench/core/simulation/newton.py +++ b/anchor_bench/core/simulation/newton.py @@ -8,12 +8,18 @@ import logging from collections.abc import Hashable from pathlib import Path -from typing import Any, Callable, Mapping, Tuple +from typing import TYPE_CHECKING, Any, Callable, Mapping, Tuple import newton from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor +from anchor_bench.schema.simulation import NewtonSimulationConfig + +if TYPE_CHECKING: + from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig + from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator + from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace logger = logging.getLogger(__name__) @@ -27,6 +33,8 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): count. """ + sysid_config_model = NewtonSimulationConfig + _initialized: bool _world_count: int _configuration_key: Hashable | None @@ -49,6 +57,17 @@ def __init__( if not hasattr(self, "_initialized"): self._initialized = False + def create_sysid_evaluator( + self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace + ) -> PopulationEvaluator: + from anchor_bench.tasks.actuator_sys_id.simulation import ( + NewtonPopulationEvaluator, + ) + + return NewtonPopulationEvaluator( + config, parameter_space, simulation_context=self + ) + def initialize( self, *, diff --git a/anchor_bench/core/simulation/registry.py b/anchor_bench/core/simulation/registry.py index 949e525..c07ab16 100644 --- a/anchor_bench/core/simulation/registry.py +++ b/anchor_bench/core/simulation/registry.py @@ -1,93 +1,40 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Explicit simulation context registration and sysID callbacks.""" +"""Explicit simulation context registration.""" -from __future__ import annotations - -from collections.abc import Callable, Mapping -from typing import TYPE_CHECKING, Any, TypedDict +from typing import Any from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.errors import SimulationBackendError -if TYPE_CHECKING: - from anchor_bench.schema.simulation import JsonValue, SysIdSimulationConfig - from anchor_bench.tasks.actuator_sys_id.model import IdentifiedModelArtifact - from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator - - -class _SysIdCallbacks(TypedDict): - config_model: type[SysIdSimulationConfig] - create_context: Callable[..., SimulationContext[Any, Any]] - create_evaluator: Callable[..., PopulationEvaluator] - export_model: Callable[..., IdentifiedModelArtifact | None] | None - describe_runtime: Callable[..., Mapping[str, JsonValue]] | None - - SIMULATION_CONTEXTS: dict[str, type[SimulationContext[Any, Any]]] = { "newton": NewtonSimulationContext, } -_SYSID_CALLBACKS: dict[str, _SysIdCallbacks] = {} def register_simulation_backend( - name: str, - context_type: type[SimulationContext[Any, Any]], - *, - config_model: type[SysIdSimulationConfig], - create_context: Callable[..., SimulationContext[Any, Any]], - create_evaluator: Callable[..., PopulationEvaluator], - export_model: Callable[..., IdentifiedModelArtifact | None] | None = None, - describe_runtime: Callable[..., Mapping[str, JsonValue]] | None = None, + name: str, context_type: type[SimulationContext[Any, Any]] ) -> None: - """Register a simulator and the callbacks used to run sysID with it.""" + """Register a simulator context class.""" if name in SIMULATION_CONTEXTS: raise SimulationBackendError( f"Simulation backend {name!r} is already registered." ) SIMULATION_CONTEXTS[name] = context_type - _SYSID_CALLBACKS[name] = { - "config_model": config_model, - "create_context": create_context, - "create_evaluator": create_evaluator, - "export_model": export_model, - "describe_runtime": describe_runtime, - } - -def get_sysid_callbacks(name: str) -> _SysIdCallbacks: - """Return explicitly registered callbacks, including the built-in Newton ones.""" - if name == "newton" and name not in _SYSID_CALLBACKS: - from anchor_bench.schema.simulation import NewtonSimulationConfig - from anchor_bench.tasks.actuator_sys_id.backends import newton - _SYSID_CALLBACKS[name] = { - "config_model": NewtonSimulationConfig, - "create_context": newton.create_context, - "create_evaluator": newton.create_evaluator, - "export_model": newton.export_model, - "describe_runtime": newton.describe_runtime, - } - if name not in SIMULATION_CONTEXTS: - raise SimulationBackendError(f"Unknown simulation backend {name!r}.") - if name not in _SYSID_CALLBACKS: - raise SimulationBackendError( - f"Simulation backend {name!r} does not support system identification." - ) - return _SYSID_CALLBACKS[name] +def get_simulation_context_type(name: str) -> type[SimulationContext[Any, Any]]: + """Return the context class registered for a simulator.""" + try: + return SIMULATION_CONTEXTS[name] + except KeyError as error: + raise ValueError(f"Unknown simulation backend {name!r}.") from error def create_simulation_context( - backend: str, - usd_path: str, - *, - fixed_base: bool = False, + backend: str, usd_path: str, *, fixed_base: bool = False ) -> SimulationContext[Any, Any]: """Create the context registered for a configured simulator.""" - try: - context_type = SIMULATION_CONTEXTS[backend] - except KeyError as error: - raise ValueError(f"Unknown simulation backend {backend!r}.") from error - return context_type(usd_path, fixed_base=fixed_base) + return get_simulation_context_type(backend)(usd_path, fixed_base=fixed_base) diff --git a/anchor_bench/schema/actuator_sys_id.py b/anchor_bench/schema/actuator_sys_id.py index 23308da..d7ee76c 100644 --- a/anchor_bench/schema/actuator_sys_id.py +++ b/anchor_bench/schema/actuator_sys_id.py @@ -137,21 +137,27 @@ class ActuatorSysIdConfig(BaseConfig): @field_validator("simulation", mode="before") @classmethod def dispatch_simulation(cls, value: object) -> SysIdSimulationConfig: - from anchor_bench.core.simulation.registry import get_sysid_callbacks + from anchor_bench.core.simulation.registry import get_simulation_context_type + from anchor_bench.errors import SimulationBackendError if isinstance(value, SysIdSimulationConfig): - callbacks = get_sysid_callbacks(value.type) - if type(value) is not callbacks["config_model"]: + backend_name = value.type + elif isinstance(value, dict) and isinstance(value.get("type"), str): + backend_name = value["type"] + else: + raise ValueError("simulation must define a string type") # noqa: TRY004 - Pydantic validation errors require ValueError + config_model = get_simulation_context_type(backend_name).sysid_config_model + if config_model is None: + raise SimulationBackendError( + f"Simulation backend {backend_name!r} does not support system identification." + ) + if isinstance(value, SysIdSimulationConfig): + if type(value) is not config_model: raise ValueError( "simulation config must use the registered config model" ) - return callbacks["config_model"].model_validate(value.model_dump()) - if not isinstance(value, dict): - raise ValueError("simulation must be a configuration object") # noqa: TRY004 - Pydantic validation errors require ValueError - backend_name = value.get("type") - if not isinstance(backend_name, str): - raise ValueError("simulation must define a string type") # noqa: TRY004 - Pydantic validation errors require ValueError - return get_sysid_callbacks(backend_name)["config_model"].model_validate(value) + value = value.model_dump() + return config_model.model_validate(value) @model_validator(mode="after") def validate_task_invariants(self) -> ActuatorSysIdConfig: diff --git a/anchor_bench/tasks/actuator_sys_id/backends/__init__.py b/anchor_bench/tasks/actuator_sys_id/backends/__init__.py deleted file mode 100644 index 8e74906..0000000 --- a/anchor_bench/tasks/actuator_sys_id/backends/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Backend-specific actuator identification adapters, imported on demand.""" diff --git a/anchor_bench/tasks/actuator_sys_id/backends/newton.py b/anchor_bench/tasks/actuator_sys_id/backends/newton.py deleted file mode 100644 index bae718e..0000000 --- a/anchor_bench/tasks/actuator_sys_id/backends/newton.py +++ /dev/null @@ -1,74 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Newton evaluation and native USD export for system identification.""" - -from __future__ import annotations - -from collections.abc import Mapping -from pathlib import Path -from typing import Any - -from anchor_bench.core.simulation import SimulationContext -from anchor_bench.core.simulation.newton import NewtonSimulationContext -from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import JsonValue, NewtonSimulationConfig -from anchor_bench.tasks.actuator_sys_id.model import Candidate, IdentifiedModelArtifact -from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator -from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace -from anchor_bench.tasks.actuator_sys_id.simulation import NewtonPopulationEvaluator - - -def _simulation_config(config: ActuatorSysIdConfig) -> NewtonSimulationConfig: - if not isinstance(config.simulation, NewtonSimulationConfig): - raise TypeError("Newton backend requires NewtonSimulationConfig") - return config.simulation - - -def create_context(config: ActuatorSysIdConfig) -> NewtonSimulationContext: - """Resolve the fixed-base Newton resource selected by the run.""" - simulation = _simulation_config(config) - return NewtonSimulationContext(simulation.usd_path, fixed_base=True) - - -def create_evaluator( - config: ActuatorSysIdConfig, - space: ParameterSpace, - context: SimulationContext[Any, Any], -) -> NewtonPopulationEvaluator: - """Reuse the selected context for population evaluation.""" - if not isinstance(context, NewtonSimulationContext): - raise TypeError("Newton backend requires a Newton simulation context") - return NewtonPopulationEvaluator(config, space, simulation_context=context) - - -def export_model( - config: ActuatorSysIdConfig, - best: Candidate, - context: SimulationContext[Any, Any], - output: Path, -) -> IdentifiedModelArtifact: - """Author fitted actuator properties as the existing native USD layer.""" - from anchor_bench.tasks.actuator_sys_id.usd import write_identified_usd_layer - - simulation = _simulation_config(config) - path = output / "identified.usda" - write_identified_usd_layer( - simulation.usd_path, - path, - best, - { - joint: group.controller.clamps - for group in config.joint_parameters - for joint in group.names - }, - config.model_dump_json(), - ) - return IdentifiedModelArtifact(path, "usd") - - -def describe_runtime(evaluator: PopulationEvaluator) -> Mapping[str, JsonValue]: - """Describe Newton timing and solver configuration used by the evaluator.""" - if not isinstance(evaluator, NewtonPopulationEvaluator): - raise TypeError("Newton runtime description requires its population evaluator") - return evaluator.simulation_config.model_dump(mode="json") diff --git a/anchor_bench/tasks/actuator_sys_id/objective.py b/anchor_bench/tasks/actuator_sys_id/objective.py index 2b51166..c1fadbd 100644 --- a/anchor_bench/tasks/actuator_sys_id/objective.py +++ b/anchor_bench/tasks/actuator_sys_id/objective.py @@ -5,23 +5,43 @@ from __future__ import annotations -from typing import Protocol, Sequence +from abc import ABC, abstractmethod +from collections.abc import Mapping +from pathlib import Path +from typing import Sequence import numpy as np -from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory +from anchor_bench.schema.simulation import JsonValue +from anchor_bench.tasks.actuator_sys_id.model import ( + Candidate, + IdentifiedModelArtifact, + Trajectory, +) from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace -class PopulationEvaluator(Protocol): +class PopulationEvaluator(ABC): """Score decoded actuator candidates against recorded trajectories.""" + @abstractmethod def evaluate( self, population: Sequence[Candidate], trajectories: Sequence[Trajectory], - ) -> FloatArray: ... + ) -> FloatArray: + raise NotImplementedError + + def export_model( + self, best: Candidate, output: Path + ) -> IdentifiedModelArtifact | None: + """Optionally export the fitted simulator model.""" + return None + + def describe_runtime(self) -> Mapping[str, JsonValue] | None: + """Optionally report the simulation settings used for evaluation.""" + return None class ActuatorSysIdObjective: diff --git a/anchor_bench/tasks/actuator_sys_id/simulation.py b/anchor_bench/tasks/actuator_sys_id/simulation.py index 23299ab..d217a11 100644 --- a/anchor_bench/tasks/actuator_sys_id/simulation.py +++ b/anchor_bench/tasks/actuator_sys_id/simulation.py @@ -6,7 +6,9 @@ from __future__ import annotations import logging +from collections.abc import Mapping from math import isclose +from pathlib import Path from typing import ClassVar, Dict, List, Sequence, Tuple import newton @@ -16,8 +18,13 @@ from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.core.simulation.registry import create_simulation_context from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import NewtonSimulationConfig -from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory +from anchor_bench.schema.simulation import JsonValue, NewtonSimulationConfig +from anchor_bench.tasks.actuator_sys_id.model import ( + Candidate, + IdentifiedModelArtifact, + Trajectory, +) +from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace logger = logging.getLogger(__name__) @@ -57,7 +64,7 @@ def _accumulate_position_error( score_sums[world_index] += error_sum -class NewtonPopulationEvaluator: +class NewtonPopulationEvaluator(PopulationEvaluator): """Evaluate one candidate per replicated Newton world.""" _MODEL_ARRAYS: ClassVar[Dict[str, str]] = { @@ -261,6 +268,26 @@ def evaluate( raise RuntimeError("Newton produced non-finite position error") return scores + def export_model(self, best: Candidate, output: Path) -> IdentifiedModelArtifact: + from anchor_bench.tasks.actuator_sys_id.usd import write_identified_usd_layer + + path = output / "identified.usda" + write_identified_usd_layer( + self.simulation_config.usd_path, + path, + best, + { + joint: group.controller.clamps + for group in self.config.joint_parameters + for joint in group.names + }, + self.config.model_dump_json(), + ) + return IdentifiedModelArtifact(path, "usd") + + def describe_runtime(self) -> Mapping[str, JsonValue]: + return self.simulation_config.model_dump(mode="json") + def _apply_population(self, population: Sequence[Candidate]) -> None: for parameter_name, model_array_name in self._MODEL_ARRAYS.items(): model_array = getattr(self._simulation_context.model, model_array_name) diff --git a/anchor_bench/tasks/actuator_sys_id/task.py b/anchor_bench/tasks/actuator_sys_id/task.py index 77f2487..d484788 100644 --- a/anchor_bench/tasks/actuator_sys_id/task.py +++ b/anchor_bench/tasks/actuator_sys_id/task.py @@ -8,7 +8,10 @@ import logging from pathlib import Path -from anchor_bench.core.simulation.registry import get_sysid_callbacks +from anchor_bench.core.simulation.registry import ( + get_simulation_context_type, +) +from anchor_bench.errors import SimulationBackendError from anchor_bench.logging_utils import should_log_progress from anchor_bench.mlops import get_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig @@ -27,7 +30,11 @@ class ActuatorSysIdTask(BaseTask[ActuatorSysIdConfig]): """Fit actuator parameters with the configured simulation backend.""" def run(self, output_directory: Path) -> Path: - callbacks = get_sysid_callbacks(self.config.simulation.type) + context_type = get_simulation_context_type(self.config.simulation.type) + if context_type.sysid_config_model is None: + raise SimulationBackendError( + f"Simulation backend {self.config.simulation.type!r} does not support system identification." + ) mlops_run = get_active_run() joint_names = [ joint for group in self.config.joint_parameters for joint in group.names @@ -42,8 +49,8 @@ def run(self, output_directory: Path) -> Path: ) parameter_space = create_parameter_space(self.config) optimizer = create_optimizer(self.config, parameter_space) - context = callbacks["create_context"](self.config) - evaluator = callbacks["create_evaluator"](self.config, parameter_space, context) + context = context_type(self.config.simulation.usd_path, fixed_base=True) + evaluator = context.create_sysid_evaluator(self.config, parameter_space) objective = ActuatorSysIdObjective( parameter_space, evaluator, @@ -80,18 +87,8 @@ def run(self, output_directory: Path) -> Path: ) best_parameters = parameter_space.decode(optimizer.best_candidate) - model_artifact = ( - callbacks["export_model"]( - self.config, best_parameters, context, output_directory - ) - if callbacks["export_model"] is not None - else None - ) - runtime_simulation = ( - callbacks["describe_runtime"](evaluator) - if callbacks["describe_runtime"] is not None - else None - ) + model_artifact = evaluator.export_model(best_parameters, output_directory) + runtime_simulation = evaluator.describe_runtime() write_artifacts( output_directory, best_parameters=best_parameters, diff --git a/docs/system-identification.md b/docs/system-identification.md index 16a081b..6c2c25b 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -115,52 +115,33 @@ The shared context resolves and validates the USD path and protects reuse by backend class, resolved path, and base mode. Its `_load(usd_path)` receives the resolved USD path and returns the model and initial state. -Register these components through the Python API before validating a task: +The context declares its configuration class in `sysid_config_model` and +implements `create_sysid_evaluator(config, parameter_space)`. The task creates +the registered context with `fixed_base=True` and calls this method on that +context. The factory returns a `PopulationEvaluator` subclass whose +`evaluate(population, trajectories)` method produces one finite position-MSE +score per decoded candidate. The evaluator owns its simulator's candidate +application, resets, command delay, buffer exclusion, actuation, and stepping. +The task retains dataset loading and optimization. + +Register the context through the Python API before validating a task: ```python from anchor_bench.core.simulation.registry import register_simulation_backend +from my_package.backend import MySimulationContext -register_simulation_backend( - "my_simulator", - MySimulationContext, - config_model=MySimulationConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, -) +register_simulation_backend("my_simulator", MySimulationContext) ``` -The classes and callbacks in this example are supplied by the plugin. -`create_context(config)` returns the registered context type. -`create_evaluator(config, parameter_space, context)` receives that same context -and returns an object implementing `evaluate(population, trajectories)`: one -finite position-MSE score per decoded candidate. The evaluator owns its -simulator's candidate application, resets, command delay, buffer exclusion, -actuation, and stepping. The task retains dataset loading and optimization. - To run the command-line task with a custom backend, register it in your own entry script before invoking the CLI: ```python from anchor_bench.cli import main from anchor_bench.core.simulation.registry import register_simulation_backend +from my_package.backend import MySimulationContext -from my_package.backend import ( - MySimulationConfig, - MySimulationContext, - create_context, - create_evaluator, - export_model, -) - -register_simulation_backend( - "my_simulator", - MySimulationContext, - config_model=MySimulationConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, -) +register_simulation_backend("my_simulator", MySimulationContext) raise SystemExit(main()) ``` @@ -169,13 +150,14 @@ backend using `simulation.type: my_simulator`; this value must match the registered name and configuration `type`. Plugin fields survive configuration serialization and hashing. -Model export is optional. An exporter receives `(config, best_parameters, -context, output_directory)` and returns an `IdentifiedModelArtifact(path, -format)` or `None`. The result exposes the returned path through +Model export is optional. An evaluator can override +`export_model(best_parameters, output_directory)` to return an +`IdentifiedModelArtifact(path, format)`. The default implementation returns +`None`. The result exposes the returned path through `SysIdResult.identified_model_path`; only an explicit `format="usd"` also -supplies the compatibility `identified_usd_path`. An optional -`describe_runtime(evaluator)` callback returns -JSON-compatible runtime settings for `run_summary.yaml`. +supplies the compatibility `identified_usd_path`. An evaluator can also override +`describe_runtime()` to return JSON-compatible runtime settings for +`run_summary.yaml`; its default implementation returns `None`. ## Artifacts diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py index 118f895..66a8c6d 100644 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -9,7 +9,7 @@ from collections.abc import Sequence from importlib import import_module from pathlib import Path -from typing import Any, Literal +from typing import ClassVar, Literal import numpy as np @@ -22,6 +22,7 @@ IdentifiedModelArtifact, Trajectory, ) +from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace @@ -35,6 +36,15 @@ class ToyConfig(SysIdSimulationConfig): class ToyContext(SimulationContext[float, float]): """Load the scalar response scale from the shared USD input.""" + sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ToyConfig + + def create_sysid_evaluator( + self, + config: ActuatorSysIdConfig, + parameter_space: ParameterSpace, + ) -> PopulationEvaluator: + return ToyEvaluator(self, config) + def _load(self, usd_path: Path) -> tuple[float, float]: usd = import_module("pxr.Usd") stage = usd.Stage.Open(str(usd_path)) @@ -44,9 +54,13 @@ def _load(self, usd_path: Path) -> tuple[float, float]: return float(scale), 0.0 -class ToyEvaluator: - def __init__(self, context: ToyContext, gain: float) -> None: - self._gain = context.model * gain +class ToyEvaluator(PopulationEvaluator): + def __init__(self, context: ToyContext, config: ActuatorSysIdConfig) -> None: + if not isinstance(config.simulation, ToyConfig): + raise TypeError("toy evaluator requires its registered config model") + self._context = context + self._config = config + self._gain = context.model * config.simulation.gain def evaluate( self, @@ -66,62 +80,39 @@ def evaluate( return np.asarray(scores, dtype=np.float64) -def create_context(config: ActuatorSysIdConfig) -> ToyContext: - simulation = config.simulation - if not isinstance(simulation, ToyConfig): - raise TypeError("toy backend requires its registered config model") - return ToyContext(simulation.usd_path) - - -def create_evaluator( - config: ActuatorSysIdConfig, - space: ParameterSpace, - context: SimulationContext[Any, Any], -) -> ToyEvaluator: - if not isinstance(context, ToyContext): - raise TypeError("toy evaluator requires its registered context") - if not isinstance(config.simulation, ToyConfig): - raise TypeError("toy evaluator requires its registered config model") - return ToyEvaluator(context, config.simulation.gain) - - -def export_model( - config: ActuatorSysIdConfig, - best: Candidate, - context: SimulationContext[Any, Any], - output: Path, -) -> IdentifiedModelArtifact: - path = output / "identified.json" - path.write_text( - json.dumps( - { - "parameters": best, - "simulation": config.simulation.model_dump(mode="json"), - "gain_scale": context.model, - }, - sort_keys=True, - ), - encoding="utf-8", - ) - return IdentifiedModelArtifact(path=path, format="json") +class JsonToyEvaluator(ToyEvaluator): + def export_model( + self, + best: Candidate, + output: Path, + ) -> IdentifiedModelArtifact: + path = output / "identified.json" + path.write_text( + json.dumps( + { + "parameters": best, + "simulation": self._config.simulation.model_dump(mode="json"), + "gain_scale": self._context.model, + }, + sort_keys=True, + ), + encoding="utf-8", + ) + return IdentifiedModelArtifact(path=path, format="json") + + +class JsonToyContext(ToyContext): + def create_sysid_evaluator( + self, + config: ActuatorSysIdConfig, + parameter_space: ParameterSpace, + ) -> PopulationEvaluator: + return JsonToyEvaluator(self, config) def provide_json() -> None: - register_simulation_backend( - "toy-sysid", - ToyContext, - config_model=ToyConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, - ) + register_simulation_backend("toy-sysid", JsonToyContext) def provide_no_export() -> None: - register_simulation_backend( - "toy-sysid", - ToyContext, - config_model=ToyConfig, - create_context=create_context, - create_evaluator=create_evaluator, - ) + register_simulation_backend("toy-sysid", ToyContext) diff --git a/tests/test_actuator_sys_id_optimization.py b/tests/test_actuator_sys_id_optimization.py index 61c68d9..5175345 100644 --- a/tests/test_actuator_sys_id_optimization.py +++ b/tests/test_actuator_sys_id_optimization.py @@ -10,7 +10,10 @@ from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory -from anchor_bench.tasks.actuator_sys_id.objective import ActuatorSysIdObjective +from anchor_bench.tasks.actuator_sys_id.objective import ( + ActuatorSysIdObjective, + PopulationEvaluator, +) from anchor_bench.tasks.actuator_sys_id.optimizer import ( CmaEsOptimizer, FloatArray, @@ -127,7 +130,7 @@ def test_objective_decodes_population_before_evaluation(tmp_path): measured_position=np.asarray([[0.1], [0.8]]), ) - class RecordingEvaluator: + class RecordingEvaluator(PopulationEvaluator): def __init__(self) -> None: self.population: Optional[Sequence[Candidate]] = None self.trajectories: Optional[Sequence[Trajectory]] = None diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 7468d4a..5a93635 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -5,8 +5,9 @@ import builtins import importlib +from collections.abc import Mapping, Sequence from pathlib import Path -from typing import Literal +from typing import ClassVar, Literal from unittest.mock import Mock import numpy as np @@ -19,18 +20,21 @@ from anchor_bench.errors import DatasetAlignmentError, SimulationBackendError from anchor_bench.mlops import MLOpsRun, bind_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import SysIdSimulationConfig +from anchor_bench.schema.simulation import JsonValue, SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id import artifacts as artifacts_module from anchor_bench.tasks.actuator_sys_id import task as task_module from anchor_bench.tasks.actuator_sys_id.artifacts import write_artifacts from anchor_bench.tasks.actuator_sys_id.dataset import load_trajectories from anchor_bench.tasks.actuator_sys_id.model import ( + Candidate, GenerationRecord, IdentifiedModelArtifact, SysIdResult, Trajectory, ) -from anchor_bench.tasks.actuator_sys_id.optimizer import OptimizationStep +from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator +from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray, OptimizationStep +from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask @@ -95,38 +99,29 @@ class ToySimulationConfig(SysIdSimulationConfig): gain: float = 2.0 -class ToyContext(SimulationContext[object, object]): +class ResourceOnlyContext(SimulationContext[object, object]): def _load(self, usd_path: Path): return object(), object() +class ToyContext(ResourceOnlyContext): + sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ( + ToySimulationConfig + ) + + @pytest.fixture def register_toy(monkeypatch, tmp_path): monkeypatch.setattr(SimulationContext, "_instance", None) monkeypatch.setattr( registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) - monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) - def register(create_evaluator, *, export_model=None, describe_runtime=None): + def register(context_type: type[ToyContext]): usd = tmp_path / "scene.usda" usd.write_text("#usda 1.0\n") - context = ToyContext(str(usd)) - - def create_context(config): - assert isinstance(config.simulation, ToySimulationConfig) - assert config.simulation.gain == 2.0 - return context - - registry.register_simulation_backend( - "task-toy", - ToyContext, - config_model=ToySimulationConfig, - create_context=create_context, - create_evaluator=create_evaluator, - export_model=export_model, - describe_runtime=describe_runtime, - ) + context = context_type(str(usd), fixed_base=True) + registry.register_simulation_backend("task-toy", context_type) config = _config( tmp_path, simulation={ @@ -331,12 +326,49 @@ def test_task_uses_registered_evaluator_and_context( measured_position=np.asarray([[0.1], [0.8]]), ) - class FakeEvaluator: - def evaluate(self, population, trajectories): + class FakeEvaluator(PopulationEvaluator): + def __init__(self, selected_context: ToyContext) -> None: + self.context = selected_context + + def evaluate( + self, + population: Sequence[Candidate], + trajectories: Sequence[Trajectory], + ) -> FloatArray: + assert received["evaluator"] is self + assert self.context is context assert len(population) == config.num_envs assert trajectories == (trajectory,) return np.asarray([1.0, 0.25]) + def export_model( + self, best: Candidate, output: Path + ) -> IdentifiedModelArtifact: + assert received["evaluator"] is self + assert self.context is context + assert output == output_directory + assert best["hip"]["stiffness"] == pytest.approx(20.0) + path = output / "identified.json" + path.write_text('{"model": "toy"}') + return IdentifiedModelArtifact(path, "json") + + def describe_runtime(self) -> Mapping[str, JsonValue]: + assert received["evaluator"] is self + assert self.context is context + return {"type": "task-toy", "effective_gain": 2.0} + + class TaskToyContext(ToyContext): + def create_sysid_evaluator( + self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace + ) -> PopulationEvaluator: + assert isinstance(config.simulation, ToySimulationConfig) + assert config.simulation.gain == 2.0 + evaluator = FakeEvaluator(self) + received.update( + config=config, context=self, space=parameter_space, evaluator=evaluator + ) + return evaluator + class FakeOptimizer: def __init__(self): self.converged = False @@ -374,31 +406,8 @@ def write(output_dir, **values): task_module, "load_trajectories", lambda *args, **kwargs: [trajectory] ) monkeypatch.setattr(task_module, "create_optimizer", lambda *args: FakeOptimizer()) - evaluator = FakeEvaluator() received = {} - - def create_evaluator(selected_config, space, selected_context): - received.update(config=selected_config, context=selected_context, space=space) - return evaluator - - def export_model(selected_config, best, selected_context, output): - assert selected_config is config - assert selected_context is context - assert output == output_directory - assert best["hip"]["stiffness"] == pytest.approx(20.0) - path = output / "identified.json" - path.write_text('{"model": "toy"}') - return IdentifiedModelArtifact(path, "json") - - def describe_runtime(selected_evaluator): - assert selected_evaluator is evaluator - return {"type": "task-toy", "effective_gain": 2.0} - - config, context = register_toy( - create_evaluator, - export_model=export_model, - describe_runtime=describe_runtime, - ) + config, context = register_toy(TaskToyContext) monkeypatch.setattr(task_module, "write_artifacts", write) mlops_run = Mock(spec=MLOpsRun) @@ -409,6 +418,8 @@ def describe_runtime(selected_evaluator): assert written["best_mse"] == pytest.approx(0.25) assert received["config"] is config assert received["context"] is context + assert context.fixed_base is True + assert received["space"].dimension == 5 assert written["model_artifact"] == IdentifiedModelArtifact( output_directory / "identified.json", "json", @@ -494,14 +505,26 @@ def guard_import(name, *args, **kwargs): def test_export_failure_prevents_completion(tmp_path, monkeypatch, register_toy): - class Evaluator: - def evaluate(self, population, trajectories): + class Evaluator(PopulationEvaluator): + def evaluate( + self, + population: Sequence[Candidate], + trajectories: Sequence[Trajectory], + ) -> FloatArray: return np.asarray([1.0] * len(population)) - def export_model(*args): - raise RuntimeError("toy export failed") + def export_model( + self, best: Candidate, output: Path + ) -> IdentifiedModelArtifact | None: + raise RuntimeError("toy export failed") + + class ExportFailureContext(ToyContext): + def create_sysid_evaluator( + self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace + ) -> PopulationEvaluator: + return Evaluator() - config, _ = register_toy(lambda *args: Evaluator(), export_model=export_model) + config, _ = register_toy(ExportFailureContext) config.num_envs = 4 monkeypatch.setattr( task_module, @@ -524,8 +547,7 @@ def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): monkeypatch.setattr( registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) - monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) - registry.SIMULATION_CONTEXTS["resource-only"] = ToyContext + registry.register_simulation_backend("resource-only", ResourceOnlyContext) config.simulation = SysIdSimulationConfig( usd_path=config.simulation.usd_path, type="resource-only", @@ -543,3 +565,41 @@ def unexpected(*args, **kwargs): SimulationBackendError, match="does not support system identification" ): ActuatorSysIdTask(config).run(tmp_path) + + +def test_task_accepts_inherited_optional_evaluator_methods( + tmp_path, monkeypatch, register_toy +): + class Evaluator(PopulationEvaluator): + def evaluate( + self, + population: Sequence[Candidate], + trajectories: Sequence[Trajectory], + ) -> FloatArray: + return np.ones(len(population), dtype=np.float64) + + class EvaluationOnlyContext(ToyContext): + def create_sysid_evaluator( + self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace + ) -> PopulationEvaluator: + return Evaluator() + + config, _ = register_toy(EvaluationOnlyContext) + config.num_envs = 4 + monkeypatch.setattr( + task_module, + "load_trajectories", + lambda *args, **kwargs: [ + Trajectory("wave", ["hip"], np.zeros((2, 1)), np.zeros((2, 1))) + ], + ) + output = tmp_path / "evaluation-only" + output.mkdir() + + assert ActuatorSysIdTask(config).run(output) == output + + summary = yaml.safe_load((output / "run_summary.yaml").read_text()) + assert summary["best_mse"] == pytest.approx(1.0) + assert "runtime_simulation" not in summary + assert (output / "best_params.yaml").is_file() + assert not (output / "identified.usda").exists() diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index 2c49c30..20f4013 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -8,7 +8,7 @@ import json from copy import deepcopy from pathlib import Path -from typing import Literal +from typing import ClassVar, Literal import pytest from pydantic import StrictInt, ValidationError @@ -25,28 +25,24 @@ class ToyConfig(SysIdSimulationConfig): gain: StrictInt -class ToyContext(SimulationContext[object, object]): +class ResourceOnlyContext(SimulationContext[object, object]): def _load(self, usd_path: Path) -> tuple[object, object]: return object(), object() +class ToyContext(ResourceOnlyContext): + sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ToyConfig + + def toy_registration(name: str = "toy") -> None: - registry.register_simulation_backend( - name, - ToyContext, - config_model=ToyConfig, - create_context=lambda config: ToyContext(usd_path=config.simulation.usd_path), - create_evaluator=lambda config, space, context: None, # type: ignore[arg-type] - ) + registry.register_simulation_backend(name, ToyContext) @pytest.fixture(autouse=True) def isolated_registry(monkeypatch: pytest.MonkeyPatch): - registry.get_sysid_callbacks("newton") monkeypatch.setattr( registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) - monkeypatch.setattr(registry, "_SYSID_CALLBACKS", registry._SYSID_CALLBACKS.copy()) monkeypatch.setattr(SimulationContext, "_instance", None) @@ -124,7 +120,7 @@ def test_python_registration_rejects_duplicate_names(): def test_registered_backend_without_sysid_fails_early(toy_task_data): - registry.SIMULATION_CONTEXTS["toy"] = ToyContext + registry.register_simulation_backend("toy", ResourceOnlyContext) with pytest.raises(SimulationBackendError, match="system identification"): ActuatorSysIdConfig.model_validate(toy_task_data) @@ -148,3 +144,8 @@ def test_plugin_simulation_requires_usd_input(toy_task_data): toy_task_data["simulation"].pop("usd_path", None) with pytest.raises(ValidationError, match="usd_path"): ActuatorSysIdConfig.model_validate(toy_task_data) + + +def test_unknown_backend_fails_at_context_lookup(): + with pytest.raises(ValueError, match="Unknown simulation backend"): + registry.get_simulation_context_type("missing-backend") From 2e951d1181b78dbd15def04551c70be75ae1a357 Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 19:50:52 -0700 Subject: [PATCH 15/16] Select sysid simulators from the context mapping --- anchor_bench/core/simulation/registry.py | 18 ++-------- docs/system-identification.md | 36 +++++++------------ tests/fixtures/sysid_backend/run_cli.py | 9 ++--- .../toy_sysid_backend/__init__.py | 9 ----- tests/integration/test_sysid_backend_cli.py | 6 ++-- tests/test_actuator_sys_id_task.py | 22 ++++++------ tests/test_sysid_backends.py | 28 ++++----------- 7 files changed, 42 insertions(+), 86 deletions(-) diff --git a/anchor_bench/core/simulation/registry.py b/anchor_bench/core/simulation/registry.py index c07ab16..0f34042 100644 --- a/anchor_bench/core/simulation/registry.py +++ b/anchor_bench/core/simulation/registry.py @@ -1,32 +1,20 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Explicit simulation context registration.""" +"""Supported simulation context implementations.""" from typing import Any from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton import NewtonSimulationContext -from anchor_bench.errors import SimulationBackendError SIMULATION_CONTEXTS: dict[str, type[SimulationContext[Any, Any]]] = { "newton": NewtonSimulationContext, } -def register_simulation_backend( - name: str, context_type: type[SimulationContext[Any, Any]] -) -> None: - """Register a simulator context class.""" - if name in SIMULATION_CONTEXTS: - raise SimulationBackendError( - f"Simulation backend {name!r} is already registered." - ) - SIMULATION_CONTEXTS[name] = context_type - - def get_simulation_context_type(name: str) -> type[SimulationContext[Any, Any]]: - """Return the context class registered for a simulator.""" + """Return the context class configured for a simulator.""" try: return SIMULATION_CONTEXTS[name] except KeyError as error: @@ -36,5 +24,5 @@ def get_simulation_context_type(name: str) -> type[SimulationContext[Any, Any]]: def create_simulation_context( backend: str, usd_path: str, *, fixed_base: bool = False ) -> SimulationContext[Any, Any]: - """Create the context registered for a configured simulator.""" + """Create the context selected for a configured simulator.""" return get_simulation_context_type(backend)(usd_path, fixed_base=fixed_base) diff --git a/docs/system-identification.md b/docs/system-identification.md index 6c2c25b..d8d40b7 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -104,7 +104,7 @@ The runtime loads the configured trajectories, evaluates optimizer candidates with the selected simulator backend, and stops when the optimizer reaches its iteration or convergence condition. -## Register another simulator +## Add another simulator A backend supplies its own strict simulation configuration, resource context, and population evaluator. Its configuration extends @@ -117,38 +117,28 @@ the resolved USD path and returns the model and initial state. The context declares its configuration class in `sysid_config_model` and implements `create_sysid_evaluator(config, parameter_space)`. The task creates -the registered context with `fixed_base=True` and calls this method on that +the selected context with `fixed_base=True` and calls this method on that context. The factory returns a `PopulationEvaluator` subclass whose `evaluate(population, trajectories)` method produces one finite position-MSE score per decoded candidate. The evaluator owns its simulator's candidate application, resets, command delay, buffer exclusion, actuation, and stepping. The task retains dataset loading and optimization. -Register the context through the Python API before validating a task: +Add the implementation beside Newton in +`anchor_bench/core/simulation/registry.py`: ```python -from anchor_bench.core.simulation.registry import register_simulation_backend -from my_package.backend import MySimulationContext - -register_simulation_backend("my_simulator", MySimulationContext) -``` - -To run the command-line task with a custom backend, register it in your own -entry script before invoking the CLI: - -```python -from anchor_bench.cli import main -from anchor_bench.core.simulation.registry import register_simulation_backend -from my_package.backend import MySimulationContext - -register_simulation_backend("my_simulator", MySimulationContext) -raise SystemExit(main()) +SIMULATION_CONTEXTS = { + "newton": NewtonSimulationContext, + "my_simulator": MySimulationContext, +} ``` -Run this script with the usual `--config` and `--output` arguments. Select the -backend using `simulation.type: my_simulator`; this value must match the -registered name and configuration `type`. Plugin fields survive configuration -serialization and hashing. +Select it with `simulation.type: my_simulator` in the YAML and run the normal +CLI. The dictionary key and the configuration's `type` must match. Each +implementation supplies its context and evaluator methods; no registration +function or custom entry script is required. Simulator-specific fields survive +configuration serialization and hashing. Model export is optional. An evaluator can override `export_model(best_parameters, output_directory)` to return an diff --git a/tests/fixtures/sysid_backend/run_cli.py b/tests/fixtures/sysid_backend/run_cli.py index f51fcc1..980c8a9 100644 --- a/tests/fixtures/sysid_backend/run_cli.py +++ b/tests/fixtures/sysid_backend/run_cli.py @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Register a custom backend and enter the CLI with Newton resources forbidden.""" +"""Select a test context and enter the CLI with Newton resources forbidden.""" import sys @@ -17,12 +17,13 @@ def forbid_newton(*args: object, **kwargs: object) -> None: NewtonSimulationContext.__new__ = staticmethod(forbid_newton) # pyright: ignore[reportAttributeAccessIssue] newton.ModelBuilder = forbid_newton # pyright: ignore[reportAssignmentType] -# Import and register the backend only after installing the construction guards. +# Add the test context to the supported implementations after guarding Newton. import toy_sysid_backend from anchor_bench.cli import main +from anchor_bench.core.simulation.registry import SIMULATION_CONTEXTS -provider = sys.argv.pop(1) -getattr(toy_sysid_backend, provider)() +context_name = sys.argv.pop(1) +SIMULATION_CONTEXTS["toy-sysid"] = getattr(toy_sysid_backend, context_name) raise SystemExit(main()) diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py index 66a8c6d..4e8c0f2 100644 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py @@ -14,7 +14,6 @@ import numpy as np from anchor_bench.core.simulation import SimulationContext -from anchor_bench.core.simulation.registry import register_simulation_backend from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.schema.simulation import SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id.model import ( @@ -108,11 +107,3 @@ def create_sysid_evaluator( parameter_space: ParameterSpace, ) -> PopulationEvaluator: return JsonToyEvaluator(self, config) - - -def provide_json() -> None: - register_simulation_backend("toy-sysid", JsonToyContext) - - -def provide_no_export() -> None: - register_simulation_backend("toy-sysid", ToyContext) diff --git a/tests/integration/test_sysid_backend_cli.py b/tests/integration/test_sysid_backend_cli.py index d6e4d76..b9b0cd1 100644 --- a/tests/integration/test_sysid_backend_cli.py +++ b/tests/integration/test_sysid_backend_cli.py @@ -108,12 +108,12 @@ def _write_config(tmp_path: Path) -> Path: @pytest.mark.parametrize("export_json", [True, False], ids=["json-export", "no-export"]) -def test_cli_uses_explicitly_registered_sysid_backend( +def test_cli_uses_configured_sysid_context( tmp_path: Path, custom_backend: Path, export_json: bool, ) -> None: - provider = "provide_json" if export_json else "provide_no_export" + context_name = "JsonToyContext" if export_json else "ToyContext" config = _write_config(tmp_path) environment = dict(os.environ) environment["PYTHONPATH"] = os.pathsep.join( @@ -125,7 +125,7 @@ def test_cli_uses_explicitly_registered_sysid_backend( [ sys.executable, str(FIXTURE / "run_cli.py"), - provider, + context_name, "--config", str(config), "--output", diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 5a93635..1ad730a 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -111,17 +111,17 @@ class ToyContext(ResourceOnlyContext): @pytest.fixture -def register_toy(monkeypatch, tmp_path): +def use_toy_context(monkeypatch, tmp_path): monkeypatch.setattr(SimulationContext, "_instance", None) monkeypatch.setattr( registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) - def register(context_type: type[ToyContext]): + def select_context(context_type: type[ToyContext]): usd = tmp_path / "scene.usda" usd.write_text("#usda 1.0\n") context = context_type(str(usd), fixed_base=True) - registry.register_simulation_backend("task-toy", context_type) + registry.SIMULATION_CONTEXTS["task-toy"] = context_type config = _config( tmp_path, simulation={ @@ -135,7 +135,7 @@ def register(context_type: type[ToyContext]): ) return config, context - return register + return select_context def test_sysid_result_preserves_eight_positional_argument_signature(tmp_path): @@ -317,7 +317,7 @@ def test_load_trajectories_rejects_an_episode_without_a_transition( def test_task_uses_registered_evaluator_and_context( - tmp_path, monkeypatch, register_toy + tmp_path, monkeypatch, use_toy_context ): trajectory = Trajectory( experiment="wave", @@ -407,7 +407,7 @@ def write(output_dir, **values): ) monkeypatch.setattr(task_module, "create_optimizer", lambda *args: FakeOptimizer()) received = {} - config, context = register_toy(TaskToyContext) + config, context = use_toy_context(TaskToyContext) monkeypatch.setattr(task_module, "write_artifacts", write) mlops_run = Mock(spec=MLOpsRun) @@ -504,7 +504,7 @@ def guard_import(name, *args, **kwargs): assert not (output_dir / "identified.usda").exists() -def test_export_failure_prevents_completion(tmp_path, monkeypatch, register_toy): +def test_export_failure_prevents_completion(tmp_path, monkeypatch, use_toy_context): class Evaluator(PopulationEvaluator): def evaluate( self, @@ -524,7 +524,7 @@ def create_sysid_evaluator( ) -> PopulationEvaluator: return Evaluator() - config, _ = register_toy(ExportFailureContext) + config, _ = use_toy_context(ExportFailureContext) config.num_envs = 4 monkeypatch.setattr( task_module, @@ -547,7 +547,7 @@ def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): monkeypatch.setattr( registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() ) - registry.register_simulation_backend("resource-only", ResourceOnlyContext) + registry.SIMULATION_CONTEXTS["resource-only"] = ResourceOnlyContext config.simulation = SysIdSimulationConfig( usd_path=config.simulation.usd_path, type="resource-only", @@ -568,7 +568,7 @@ def unexpected(*args, **kwargs): def test_task_accepts_inherited_optional_evaluator_methods( - tmp_path, monkeypatch, register_toy + tmp_path, monkeypatch, use_toy_context ): class Evaluator(PopulationEvaluator): def evaluate( @@ -584,7 +584,7 @@ def create_sysid_evaluator( ) -> PopulationEvaluator: return Evaluator() - config, _ = register_toy(EvaluationOnlyContext) + config, _ = use_toy_context(EvaluationOnlyContext) config.num_envs = 4 monkeypatch.setattr( task_module, diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py index 20f4013..a471086 100644 --- a/tests/test_sysid_backends.py +++ b/tests/test_sysid_backends.py @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Explicit simulator registration and configuration boundaries.""" +"""Simulator selection and configuration boundaries.""" from __future__ import annotations @@ -34,14 +34,12 @@ class ToyContext(ResourceOnlyContext): sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ToyConfig -def toy_registration(name: str = "toy") -> None: - registry.register_simulation_backend(name, ToyContext) - - @pytest.fixture(autouse=True) def isolated_registry(monkeypatch: pytest.MonkeyPatch): monkeypatch.setattr( - registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() + registry, + "SIMULATION_CONTEXTS", + {**registry.SIMULATION_CONTEXTS, "toy": ToyContext}, ) monkeypatch.setattr(SimulationContext, "_instance", None) @@ -90,7 +88,6 @@ def toy_task_data(tmp_path): def test_plugin_simulation_roundtrips_without_losing_fields(toy_task_data): - toy_registration() config = ActuatorSysIdConfig.model_validate(toy_task_data) assert isinstance(config.simulation, ToyConfig) assert config.simulation.gain == 2 @@ -105,32 +102,22 @@ def test_plugin_simulation_roundtrips_without_losing_fields(toy_task_data): @pytest.mark.parametrize("patch", [{"gain": "2"}, {"extra": 1}, {"control_freq": 300}]) def test_plugin_simulation_is_strict(toy_task_data, patch): - toy_registration() toy_task_data["simulation"].update(patch) with pytest.raises(ValidationError): ActuatorSysIdConfig.model_validate(toy_task_data) -def test_python_registration_rejects_duplicate_names(): - toy_registration() - with pytest.raises(SimulationBackendError, match="already registered"): - toy_registration() - with pytest.raises(SimulationBackendError, match="already registered"): - toy_registration("newton") - - -def test_registered_backend_without_sysid_fails_early(toy_task_data): - registry.register_simulation_backend("toy", ResourceOnlyContext) +def test_context_without_sysid_fails_early(toy_task_data): + registry.SIMULATION_CONTEXTS["toy"] = ResourceOnlyContext with pytest.raises(SimulationBackendError, match="system identification"): ActuatorSysIdConfig.model_validate(toy_task_data) -def test_yaml_parser_uses_explicit_registration(toy_task_data, tmp_path): +def test_yaml_parser_uses_configured_context(toy_task_data, tmp_path): import yaml from anchor_bench.schema.parse import parse - toy_registration() path = tmp_path / "task.yaml" path.write_text(yaml.safe_dump(toy_task_data), encoding="utf-8") config = parse(path) @@ -140,7 +127,6 @@ def test_yaml_parser_uses_explicit_registration(toy_task_data, tmp_path): def test_plugin_simulation_requires_usd_input(toy_task_data): - toy_registration() toy_task_data["simulation"].pop("usd_path", None) with pytest.raises(ValidationError, match="usd_path"): ActuatorSysIdConfig.model_validate(toy_task_data) From 47da88067454e055e0a90203ca2d1d2951d0edca Mon Sep 17 00:00:00 2001 From: Vidur Vij Date: Thu, 29 Oct 2026 23:36:08 -0700 Subject: [PATCH 16/16] Slim sysID simulator dispatch to context and evaluator methods System identification now creates the context registered for simulation.type and asks it for an evaluator through SimulationContext.create_sysid_evaluator(). The evaluator owns optional model export through PopulationEvaluator.export_model(), so Newton keeps writing identified.usda while other simulators may write nothing. Remove the open-ended plugin machinery: the separate simulation schema module and config dispatch validator, SimulationBackendError, IdentifiedModelArtifact and format handling, describe_runtime() and the runtime summary field, the toy backend fixture and CLI integration test, and test churn unrelated to the feature. Co-Authored-By: Claude Opus 5.5 --- anchor_bench/core/simulation/__init__.py | 20 +- anchor_bench/core/simulation/newton.py | 8 +- anchor_bench/core/simulation/registry.py | 26 +- anchor_bench/errors.py | 4 - anchor_bench/schema/actuator_sys_id.py | 75 ++--- anchor_bench/schema/simulation.py | 51 --- .../tasks/actuator_sys_id/artifacts.py | 18 +- anchor_bench/tasks/actuator_sys_id/model.py | 13 +- .../tasks/actuator_sys_id/objective.py | 23 +- .../tasks/actuator_sys_id/simulation.py | 46 +-- anchor_bench/tasks/actuator_sys_id/task.py | 25 +- docs/system-identification.md | 56 +--- tests/fixtures/sysid_backend/run_cli.py | 29 -- .../toy_sysid_backend/__init__.py | 109 ------- .../integration/test_newton_native_runtime.py | 16 +- tests/integration/test_sysid_backend_cli.py | 186 ----------- tests/test_actuator_sys_id_config.py | 15 - tests/test_actuator_sys_id_simulation.py | 67 ++-- tests/test_actuator_sys_id_task.py | 303 ++---------------- tests/test_data_processor_runner.py | 6 +- tests/test_data_processors.py | 17 +- tests/test_newton_simulation_context.py | 22 -- tests/test_simulation_context.py | 125 -------- tests/test_sysid_backends.py | 137 -------- 24 files changed, 172 insertions(+), 1225 deletions(-) delete mode 100644 anchor_bench/schema/simulation.py delete mode 100644 tests/fixtures/sysid_backend/run_cli.py delete mode 100644 tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py delete mode 100644 tests/integration/test_sysid_backend_cli.py delete mode 100644 tests/test_simulation_context.py delete mode 100644 tests/test_sysid_backends.py diff --git a/anchor_bench/core/simulation/__init__.py b/anchor_bench/core/simulation/__init__.py index d78a840..923bc57 100644 --- a/anchor_bench/core/simulation/__init__.py +++ b/anchor_bench/core/simulation/__init__.py @@ -7,15 +7,21 @@ from abc import ABC, abstractmethod from pathlib import Path -from typing import TYPE_CHECKING, Any, ClassVar, Generic, Optional, Tuple, TypeVar, cast +from typing import ( + TYPE_CHECKING, + Any, + ClassVar, + Generic, + Optional, + Tuple, + TypeVar, + cast, +) from typing_extensions import Self -from anchor_bench.errors import SimulationBackendError - if TYPE_CHECKING: from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig - from anchor_bench.schema.simulation import SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace @@ -26,8 +32,6 @@ class SimulationContext(ABC, Generic[ModelT, StateT]): """Own the single lazily loaded simulation model and state.""" - sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = None - _instance: ClassVar[Optional[SimulationContext[Any, Any]]] = None _usd_path: Path _fixed_base: bool @@ -125,8 +129,8 @@ def state(self) -> StateT: def create_sysid_evaluator( self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace ) -> PopulationEvaluator: - """Create an evaluator when this simulator supports system identification.""" - raise SimulationBackendError( + """Create the population evaluator used by actuator system identification.""" + raise NotImplementedError( f"{type(self).__name__} does not support system identification." ) diff --git a/anchor_bench/core/simulation/newton.py b/anchor_bench/core/simulation/newton.py index 9a4cf0e..2063eb9 100644 --- a/anchor_bench/core/simulation/newton.py +++ b/anchor_bench/core/simulation/newton.py @@ -14,7 +14,6 @@ from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor -from anchor_bench.schema.simulation import NewtonSimulationConfig if TYPE_CHECKING: from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig @@ -33,8 +32,6 @@ class NewtonSimulationContext(SimulationContext[newton.Model, newton.State]): count. """ - sysid_config_model = NewtonSimulationConfig - _initialized: bool _world_count: int _configuration_key: Hashable | None @@ -60,13 +57,12 @@ def __init__( def create_sysid_evaluator( self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace ) -> PopulationEvaluator: + # Imported here because the evaluator module depends on this one. from anchor_bench.tasks.actuator_sys_id.simulation import ( NewtonPopulationEvaluator, ) - return NewtonPopulationEvaluator( - config, parameter_space, simulation_context=self - ) + return NewtonPopulationEvaluator(config, parameter_space, self) def initialize( self, diff --git a/anchor_bench/core/simulation/registry.py b/anchor_bench/core/simulation/registry.py index 0f34042..d7fbf5a 100644 --- a/anchor_bench/core/simulation/registry.py +++ b/anchor_bench/core/simulation/registry.py @@ -1,7 +1,9 @@ # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -"""Supported simulation context implementations.""" +"""Simulation backend registry.""" + +from __future__ import annotations from typing import Any @@ -13,16 +15,16 @@ } -def get_simulation_context_type(name: str) -> type[SimulationContext[Any, Any]]: - """Return the context class configured for a simulator.""" - try: - return SIMULATION_CONTEXTS[name] - except KeyError as error: - raise ValueError(f"Unknown simulation backend {name!r}.") from error - - def create_simulation_context( - backend: str, usd_path: str, *, fixed_base: bool = False + backend: str, + usd_path: str, + *, + fixed_base: bool = False, ) -> SimulationContext[Any, Any]: - """Create the context selected for a configured simulator.""" - return get_simulation_context_type(backend)(usd_path, fixed_base=fixed_base) + """Create the simulation context registered for a configured backend.""" + + try: + context_type = SIMULATION_CONTEXTS[backend] + except KeyError as error: + raise ValueError(f"Unknown simulation backend {backend!r}.") from error + return context_type(usd_path, fixed_base=fixed_base) diff --git a/anchor_bench/errors.py b/anchor_bench/errors.py index 0382642..bdbba63 100644 --- a/anchor_bench/errors.py +++ b/anchor_bench/errors.py @@ -38,7 +38,3 @@ class MLOpsBackendNotFoundError(MLOpsError): class MLOpsTrackingError(MLOpsError): """Raised when an MLOps backend cannot create or update a tracked run.""" - - -class SimulationBackendError(AnchorBenchError): - """Raised when simulation backend registration or selection fails.""" diff --git a/anchor_bench/schema/actuator_sys_id.py b/anchor_bench/schema/actuator_sys_id.py index d7ee76c..c8401bd 100644 --- a/anchor_bench/schema/actuator_sys_id.py +++ b/anchor_bench/schema/actuator_sys_id.py @@ -8,36 +8,12 @@ from math import isclose from typing import Annotated, List, Literal, Optional, Union -from pydantic import ( - Field, - SerializeAsAny, - StrictFloat, - StrictInt, - field_validator, - model_validator, -) +from pydantic import Field, StrictFloat, StrictInt, field_validator, model_validator from typing_extensions import TypeAlias from anchor_bench.schema.base import BaseConfig, StrictBaseModel from anchor_bench.schema.dataset import ParquetDatasetConfig from anchor_bench.schema.mlops import MLOpsConfig -from anchor_bench.schema.simulation import ( - NewtonSimulationConfig, - SysIdSimulationConfig, - WarpMujocoSolverConfig, -) - -__all__ = [ - "ActuatorSysIdConfig", - "Bound", - "CmaesOptimizerConfig", - "ControllerClamps", - "JointParameterGroup", - "JointParameters", - "NewtonSimulationConfig", - "PdControllerConfig", - "WarpMujocoSolverConfig", -] JsonNumber: TypeAlias = Union[StrictInt, StrictFloat] NonEmptyString: TypeAlias = Annotated[str, Field(min_length=1)] @@ -117,6 +93,28 @@ def physical_parameter_bounds_must_be_nonnegative(self) -> JointParameterGroup: return self +class WarpMujocoSolverConfig(StrictBaseModel): + type: Literal["warp_mujoco"] + integrator: NonEmptyString = "implicitfast" + solver_iterations: PositiveInteger + line_search_iterations: NonNegativeInteger + + +class NewtonSimulationConfig(StrictBaseModel): + type: Literal["newton"] + usd_path: NonEmptyString + physics_freq: PositiveInteger + control_freq: PositiveInteger + render_freq: PositiveInteger + solver: WarpMujocoSolverConfig + + @model_validator(mode="after") + def validate_frequencies(self) -> NewtonSimulationConfig: + if self.physics_freq % self.control_freq != 0: + raise ValueError("physics_freq must be divisible by control_freq") + return self + + class ActuatorSysIdConfig(BaseConfig): type: Literal["actuator_sys_id"] # pyright: ignore[reportIncompatibleVariableOverride] description: Optional[str] = None @@ -127,38 +125,13 @@ class ActuatorSysIdConfig(BaseConfig): ) joint_parameters: Annotated[List[JointParameterGroup], Field(min_length=1)] optimizer: CmaesOptimizerConfig - simulation: SerializeAsAny[SysIdSimulationConfig] + simulation: NewtonSimulationConfig num_envs: CmaesPopulationSize = 64 buffer_time: NonNegativeNumber = 0.0 seed: NonNegativeInteger = 0 output_dir: NonEmptyString = "outputs/actuator_sys_id" dataset: ParquetDatasetConfig - @field_validator("simulation", mode="before") - @classmethod - def dispatch_simulation(cls, value: object) -> SysIdSimulationConfig: - from anchor_bench.core.simulation.registry import get_simulation_context_type - from anchor_bench.errors import SimulationBackendError - - if isinstance(value, SysIdSimulationConfig): - backend_name = value.type - elif isinstance(value, dict) and isinstance(value.get("type"), str): - backend_name = value["type"] - else: - raise ValueError("simulation must define a string type") # noqa: TRY004 - Pydantic validation errors require ValueError - config_model = get_simulation_context_type(backend_name).sysid_config_model - if config_model is None: - raise SimulationBackendError( - f"Simulation backend {backend_name!r} does not support system identification." - ) - if isinstance(value, SysIdSimulationConfig): - if type(value) is not config_model: - raise ValueError( - "simulation config must use the registered config model" - ) - value = value.model_dump() - return config_model.model_validate(value) - @model_validator(mode="after") def validate_task_invariants(self) -> ActuatorSysIdConfig: names = [ diff --git a/anchor_bench/schema/simulation.py b/anchor_bench/schema/simulation.py deleted file mode 100644 index 4a691f6..0000000 --- a/anchor_bench/schema/simulation.py +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Backend-neutral system-identification simulation configuration.""" - -from __future__ import annotations - -from typing import Annotated, Literal - -from pydantic import Field, JsonValue, StrictInt, model_validator - -from anchor_bench.schema.base import StrictBaseModel - -__all__ = [ - "JsonValue", - "NewtonSimulationConfig", - "SysIdSimulationConfig", - "WarpMujocoSolverConfig", -] - -PositiveInteger = Annotated[StrictInt, Field(ge=1)] -NonNegativeInteger = Annotated[StrictInt, Field(ge=0)] -NonEmptyString = Annotated[str, Field(min_length=1)] - - -class SysIdSimulationConfig(StrictBaseModel): - """Required USD input and timing shared by identification backends.""" - - type: NonEmptyString - physics_freq: PositiveInteger - control_freq: PositiveInteger - render_freq: PositiveInteger - usd_path: NonEmptyString - - @model_validator(mode="after") - def validate_frequencies(self) -> SysIdSimulationConfig: - if self.physics_freq % self.control_freq != 0: - raise ValueError("physics_freq must be divisible by control_freq") - return self - - -class WarpMujocoSolverConfig(StrictBaseModel): - type: Literal["warp_mujoco"] - integrator: NonEmptyString = "implicitfast" - solver_iterations: PositiveInteger - line_search_iterations: NonNegativeInteger - - -class NewtonSimulationConfig(SysIdSimulationConfig): - type: Literal["newton"] # pyright: ignore[reportIncompatibleVariableOverride] - solver: WarpMujocoSolverConfig diff --git a/anchor_bench/tasks/actuator_sys_id/artifacts.py b/anchor_bench/tasks/actuator_sys_id/artifacts.py index 2e6bd09..27c170d 100644 --- a/anchor_bench/tasks/actuator_sys_id/artifacts.py +++ b/anchor_bench/tasks/actuator_sys_id/artifacts.py @@ -6,17 +6,15 @@ from __future__ import annotations import csv -from collections.abc import Mapping, Sequence from datetime import datetime, timezone from pathlib import Path +from typing import Optional, Sequence import yaml -from anchor_bench.schema.simulation import JsonValue from anchor_bench.tasks.actuator_sys_id.model import ( Candidate, GenerationRecord, - IdentifiedModelArtifact, SysIdResult, ) @@ -27,10 +25,9 @@ def write_artifacts( best_parameters: Candidate, best_mse: float, history: Sequence[GenerationRecord], - model_artifact: IdentifiedModelArtifact | None = None, - runtime_simulation: Mapping[str, JsonValue] | None = None, + identified_usd_path: Optional[Path] = None, ) -> SysIdResult: - """Write common results and record an optional backend-native model export.""" + """Write the fitted parameters, log, and resolved run summary.""" best_parameters_path = output_dir / "best_params.yaml" optimization_log_path = output_dir / "optimization_log.csv" @@ -66,8 +63,6 @@ def write_artifacts( "best_mse": best_mse, "generations": len(history), } - if runtime_simulation is not None: - summary["runtime_simulation"] = dict(runtime_simulation) run_summary_path.write_text( yaml.safe_dump(summary, sort_keys=False), encoding="utf-8", @@ -80,10 +75,5 @@ def write_artifacts( best_parameters_path=best_parameters_path, optimization_log_path=optimization_log_path, run_summary_path=run_summary_path, - identified_model_path=model_artifact.path if model_artifact else None, - identified_usd_path=( - model_artifact.path - if model_artifact is not None and model_artifact.format == "usd" - else None - ), + identified_usd_path=identified_usd_path, ) diff --git a/anchor_bench/tasks/actuator_sys_id/model.py b/anchor_bench/tasks/actuator_sys_id/model.py index c05437b..b3c17f3 100644 --- a/anchor_bench/tasks/actuator_sys_id/model.py +++ b/anchor_bench/tasks/actuator_sys_id/model.py @@ -7,21 +7,13 @@ from dataclasses import dataclass from pathlib import Path -from typing import Dict, List +from typing import Dict, List, Optional import numpy as np Candidate = Dict[str, Dict[str, float]] -@dataclass(frozen=True) -class IdentifiedModelArtifact: - """A backend-native model exported after identification.""" - - path: Path - format: str - - @dataclass(frozen=True) class Trajectory: """One aligned command/measurement episode.""" @@ -77,5 +69,4 @@ class SysIdResult: best_parameters_path: Path optimization_log_path: Path run_summary_path: Path - identified_usd_path: Path | None = None - identified_model_path: Path | None = None + identified_usd_path: Optional[Path] = None diff --git a/anchor_bench/tasks/actuator_sys_id/objective.py b/anchor_bench/tasks/actuator_sys_id/objective.py index c1fadbd..e89cde4 100644 --- a/anchor_bench/tasks/actuator_sys_id/objective.py +++ b/anchor_bench/tasks/actuator_sys_id/objective.py @@ -6,18 +6,12 @@ from __future__ import annotations from abc import ABC, abstractmethod -from collections.abc import Mapping from pathlib import Path -from typing import Sequence +from typing import Optional, Sequence import numpy as np -from anchor_bench.schema.simulation import JsonValue -from anchor_bench.tasks.actuator_sys_id.model import ( - Candidate, - IdentifiedModelArtifact, - Trajectory, -) +from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace @@ -30,17 +24,10 @@ def evaluate( self, population: Sequence[Candidate], trajectories: Sequence[Trajectory], - ) -> FloatArray: - raise NotImplementedError + ) -> FloatArray: ... - def export_model( - self, best: Candidate, output: Path - ) -> IdentifiedModelArtifact | None: - """Optionally export the fitted simulator model.""" - return None - - def describe_runtime(self) -> Mapping[str, JsonValue] | None: - """Optionally report the simulation settings used for evaluation.""" + def export_model(self, best: Candidate, output_dir: Path) -> Optional[Path]: + """Write the fitted simulator model, if the simulator supports it.""" return None diff --git a/anchor_bench/tasks/actuator_sys_id/simulation.py b/anchor_bench/tasks/actuator_sys_id/simulation.py index d217a11..171423b 100644 --- a/anchor_bench/tasks/actuator_sys_id/simulation.py +++ b/anchor_bench/tasks/actuator_sys_id/simulation.py @@ -6,7 +6,6 @@ from __future__ import annotations import logging -from collections.abc import Mapping from math import isclose from pathlib import Path from typing import ClassVar, Dict, List, Sequence, Tuple @@ -16,14 +15,8 @@ import warp as wp from anchor_bench.core.simulation.newton import NewtonSimulationContext -from anchor_bench.core.simulation.registry import create_simulation_context from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import JsonValue, NewtonSimulationConfig -from anchor_bench.tasks.actuator_sys_id.model import ( - Candidate, - IdentifiedModelArtifact, - Trajectory, -) +from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace @@ -79,12 +72,8 @@ def __init__( self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace, - *, - simulation_context: NewtonSimulationContext | None = None, + simulation_context: NewtonSimulationContext, ) -> None: - if not isinstance(config.simulation, NewtonSimulationConfig): - raise TypeError("Newton evaluator requires NewtonSimulationConfig") - self.simulation_config = config.simulation self.config = config self.parameter_space = parameter_space self.joint_names = _joint_names(config) @@ -112,27 +101,15 @@ def __init__( substeps=self.control_substeps, ) - def _initialize_simulation( - self, - simulation_context: NewtonSimulationContext | None = None, - ) -> None: + def _initialize_simulation(self, context: NewtonSimulationContext) -> None: initial = self.parameter_space.decode(self.parameter_space.initial_normalized) - context = simulation_context - if context is None: - context = create_simulation_context( - self.simulation_config.type, - self.simulation_config.usd_path, - fixed_base=True, - ) - if not isinstance(context, NewtonSimulationContext): - raise TypeError("actuator_sys_id requires a Newton simulation context") self._simulation_context = context def configure_template(template: newton.ModelBuilder) -> None: template_indices = _builder_joint_indices(template, self.joint_names) self._configure_template(template, template_indices, initial) - solver_config = self.simulation_config.solver + solver_config = self.config.simulation.solver context.initialize( world_count=self.num_envs, configure_builder=configure_template, @@ -268,25 +245,22 @@ def evaluate( raise RuntimeError("Newton produced non-finite position error") return scores - def export_model(self, best: Candidate, output: Path) -> IdentifiedModelArtifact: + def export_model(self, best: Candidate, output_dir: Path) -> Path: from anchor_bench.tasks.actuator_sys_id.usd import write_identified_usd_layer - path = output / "identified.usda" + path = output_dir / "identified.usda" write_identified_usd_layer( - self.simulation_config.usd_path, + self.config.simulation.usd_path, path, best, { - joint: group.controller.clamps + joint_name: group.controller.clamps for group in self.config.joint_parameters - for joint in group.names + for joint_name in group.names }, self.config.model_dump_json(), ) - return IdentifiedModelArtifact(path, "usd") - - def describe_runtime(self) -> Mapping[str, JsonValue]: - return self.simulation_config.model_dump(mode="json") + return path def _apply_population(self, population: Sequence[Candidate]) -> None: for parameter_name, model_array_name in self._MODEL_ARRAYS.items(): diff --git a/anchor_bench/tasks/actuator_sys_id/task.py b/anchor_bench/tasks/actuator_sys_id/task.py index d484788..2cb60da 100644 --- a/anchor_bench/tasks/actuator_sys_id/task.py +++ b/anchor_bench/tasks/actuator_sys_id/task.py @@ -8,10 +8,7 @@ import logging from pathlib import Path -from anchor_bench.core.simulation.registry import ( - get_simulation_context_type, -) -from anchor_bench.errors import SimulationBackendError +from anchor_bench.core.simulation.registry import create_simulation_context from anchor_bench.logging_utils import should_log_progress from anchor_bench.mlops import get_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig @@ -27,14 +24,9 @@ class ActuatorSysIdTask(BaseTask[ActuatorSysIdConfig]): - """Fit actuator parameters with the configured simulation backend.""" + """Fit actuator parameters by replaying recorded commands in simulation.""" def run(self, output_directory: Path) -> Path: - context_type = get_simulation_context_type(self.config.simulation.type) - if context_type.sysid_config_model is None: - raise SimulationBackendError( - f"Simulation backend {self.config.simulation.type!r} does not support system identification." - ) mlops_run = get_active_run() joint_names = [ joint for group in self.config.joint_parameters for joint in group.names @@ -49,7 +41,11 @@ def run(self, output_directory: Path) -> Path: ) parameter_space = create_parameter_space(self.config) optimizer = create_optimizer(self.config, parameter_space) - context = context_type(self.config.simulation.usd_path, fixed_base=True) + context = create_simulation_context( + self.config.simulation.type, + self.config.simulation.usd_path, + fixed_base=True, + ) evaluator = context.create_sysid_evaluator(self.config, parameter_space) objective = ActuatorSysIdObjective( parameter_space, @@ -87,15 +83,14 @@ def run(self, output_directory: Path) -> Path: ) best_parameters = parameter_space.decode(optimizer.best_candidate) - model_artifact = evaluator.export_model(best_parameters, output_directory) - runtime_simulation = evaluator.describe_runtime() write_artifacts( output_directory, best_parameters=best_parameters, best_mse=optimizer.best_score, history=history, - model_artifact=model_artifact, - runtime_simulation=runtime_simulation, + identified_usd_path=evaluator.export_model( + best_parameters, output_directory + ), ) # Upload only after every SysID output file is finalized. TaskRunner # separately owns the completion marker and tracked-run status. diff --git a/docs/system-identification.md b/docs/system-identification.md index d8d40b7..6818db6 100644 --- a/docs/system-identification.md +++ b/docs/system-identification.md @@ -101,53 +101,21 @@ uv run anchor-bench \ ``` The runtime loads the configured trajectories, evaluates optimizer candidates -with the selected simulator backend, and stops when the optimizer reaches its -iteration or convergence condition. +in the simulator selected by `simulation.type`, and stops when the optimizer +reaches its iteration or convergence condition. ## Add another simulator -A backend supplies its own strict simulation configuration, resource context, -and population evaluator. Its configuration extends -`anchor_bench.schema.simulation.SysIdSimulationConfig`, retaining the shared -required `usd_path` and timing fields, and declaring its own `type` and simulator -settings. Its context extends `SimulationContext(usd_path, *, fixed_base=False)`. -The shared context resolves and validates the USD path and protects reuse by -backend class, resolved path, and base mode. Its `_load(usd_path)` receives -the resolved USD path and returns the model and initial state. - -The context declares its configuration class in `sysid_config_model` and -implements `create_sysid_evaluator(config, parameter_space)`. The task creates -the selected context with `fixed_base=True` and calls this method on that -context. The factory returns a `PopulationEvaluator` subclass whose -`evaluate(population, trajectories)` method produces one finite position-MSE -score per decoded candidate. The evaluator owns its simulator's candidate -application, resets, command delay, buffer exclusion, actuation, and stepping. -The task retains dataset loading and optimization. - -Add the implementation beside Newton in -`anchor_bench/core/simulation/registry.py`: - -```python -SIMULATION_CONTEXTS = { - "newton": NewtonSimulationContext, - "my_simulator": MySimulationContext, -} -``` +System identification creates the `SimulationContext` registered for +`simulation.type` in `anchor_bench.core.simulation.registry.SIMULATION_CONTEXTS` +and asks it for an evaluator. To support another simulator: -Select it with `simulation.type: my_simulator` in the YAML and run the normal -CLI. The dictionary key and the configuration's `type` must match. Each -implementation supplies its context and evaluator methods; no registration -function or custom entry script is required. Simulator-specific fields survive -configuration serialization and hashing. - -Model export is optional. An evaluator can override -`export_model(best_parameters, output_directory)` to return an -`IdentifiedModelArtifact(path, format)`. The default implementation returns -`None`. The result exposes the returned path through -`SysIdResult.identified_model_path`; only an explicit `format="usd"` also -supplies the compatibility `identified_usd_path`. An evaluator can also override -`describe_runtime()` to return JSON-compatible runtime settings for -`run_summary.yaml`; its default implementation returns `None`. +1. Subclass `SimulationContext` and override `create_sysid_evaluator()` to + return a `PopulationEvaluator` that scores candidates in that simulator. +2. Optionally override `PopulationEvaluator.export_model()` to write the fitted + model; the default writes nothing. +3. Add the context class to `SIMULATION_CONTEXTS` and its configuration to the + `simulation` field of `ActuatorSysIdConfig`. ## Artifacts @@ -159,7 +127,7 @@ run writes: | `best_params.yaml` | Best candidate, position MSE, and result schema metadata. | | `optimization_log.csv` | Best and population-mean MSE for each generation. | | `run_summary.yaml` | Timestamp, best MSE, metric name, and generation count. | -| `identified.usda` | Newton's USD layer containing the fitted actuator opinions. Other backends can export a different format or omit model export. | +| `identified.usda` | USD layer containing the fitted actuator opinions (Newton). | When MLOps tracking is enabled, the task also reports per-generation metrics and uploads the finalized directory as the `sysid-output` artifact collection. diff --git a/tests/fixtures/sysid_backend/run_cli.py b/tests/fixtures/sysid_backend/run_cli.py deleted file mode 100644 index 980c8a9..0000000 --- a/tests/fixtures/sysid_backend/run_cli.py +++ /dev/null @@ -1,29 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Select a test context and enter the CLI with Newton resources forbidden.""" - -import sys - -import newton - -from anchor_bench.core.simulation.newton import NewtonSimulationContext - - -def forbid_newton(*args: object, **kwargs: object) -> None: - raise AssertionError("custom toy backend must not construct Newton resources") - - -NewtonSimulationContext.__new__ = staticmethod(forbid_newton) # pyright: ignore[reportAttributeAccessIssue] -newton.ModelBuilder = forbid_newton # pyright: ignore[reportAssignmentType] - -# Add the test context to the supported implementations after guarding Newton. -import toy_sysid_backend - -from anchor_bench.cli import main -from anchor_bench.core.simulation.registry import SIMULATION_CONTEXTS - -context_name = sys.argv.pop(1) -SIMULATION_CONTEXTS["toy-sysid"] = getattr(toy_sysid_backend, context_name) - -raise SystemExit(main()) diff --git a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py b/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py deleted file mode 100644 index 4e8c0f2..0000000 --- a/tests/fixtures/sysid_backend/toy_sysid_backend/__init__.py +++ /dev/null @@ -1,109 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""A USD-backed custom backend for exercising the real sysID CLI.""" - -from __future__ import annotations - -import json -from collections.abc import Sequence -from importlib import import_module -from pathlib import Path -from typing import ClassVar, Literal - -import numpy as np - -from anchor_bench.core.simulation import SimulationContext -from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import SysIdSimulationConfig -from anchor_bench.tasks.actuator_sys_id.model import ( - Candidate, - IdentifiedModelArtifact, - Trajectory, -) -from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator -from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray -from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace - - -class ToyConfig(SysIdSimulationConfig): - type: Literal["toy-sysid"] = "toy-sysid" # pyright: ignore[reportIncompatibleVariableOverride] - gain: float - model_name: str - - -class ToyContext(SimulationContext[float, float]): - """Load the scalar response scale from the shared USD input.""" - - sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ToyConfig - - def create_sysid_evaluator( - self, - config: ActuatorSysIdConfig, - parameter_space: ParameterSpace, - ) -> PopulationEvaluator: - return ToyEvaluator(self, config) - - def _load(self, usd_path: Path) -> tuple[float, float]: - usd = import_module("pxr.Usd") - stage = usd.Stage.Open(str(usd_path)) - if stage is None: - raise ValueError("Could not open the response USD") - scale = stage.GetPrimAtPath("/response").GetAttribute("gain_scale").Get() - return float(scale), 0.0 - - -class ToyEvaluator(PopulationEvaluator): - def __init__(self, context: ToyContext, config: ActuatorSysIdConfig) -> None: - if not isinstance(config.simulation, ToyConfig): - raise TypeError("toy evaluator requires its registered config model") - self._context = context - self._config = config - self._gain = context.model * config.simulation.gain - - def evaluate( - self, - population: Sequence[Candidate], - trajectories: Sequence[Trajectory], - ) -> FloatArray: - scores = [] - for candidate in population: - squared_errors = [] - for trajectory in trajectories: - stiffness = candidate[trajectory.joint_names[0]]["stiffness"] - predicted = trajectory.commanded_position * stiffness / self._gain - squared_errors.extend( - np.square(predicted - trajectory.measured_position).ravel() - ) - scores.append(float(np.mean(squared_errors))) - return np.asarray(scores, dtype=np.float64) - - -class JsonToyEvaluator(ToyEvaluator): - def export_model( - self, - best: Candidate, - output: Path, - ) -> IdentifiedModelArtifact: - path = output / "identified.json" - path.write_text( - json.dumps( - { - "parameters": best, - "simulation": self._config.simulation.model_dump(mode="json"), - "gain_scale": self._context.model, - }, - sort_keys=True, - ), - encoding="utf-8", - ) - return IdentifiedModelArtifact(path=path, format="json") - - -class JsonToyContext(ToyContext): - def create_sysid_evaluator( - self, - config: ActuatorSysIdConfig, - parameter_space: ParameterSpace, - ) -> PopulationEvaluator: - return JsonToyEvaluator(self, config) diff --git a/tests/integration/test_newton_native_runtime.py b/tests/integration/test_newton_native_runtime.py index 2e99279..3da0123 100644 --- a/tests/integration/test_newton_native_runtime.py +++ b/tests/integration/test_newton_native_runtime.py @@ -14,6 +14,7 @@ from anchor_bench.core.simulation import SimulationContext from anchor_bench.core.simulation.newton_stepper import NewtonStepExecutor +from anchor_bench.core.simulation.registry import create_simulation_context from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory from anchor_bench.tasks.actuator_sys_id.parameter_space import create_parameter_space @@ -67,6 +68,15 @@ def PhysicsPrismaticJoint "slide" { return asset +def _evaluator(config: ActuatorSysIdConfig) -> NewtonPopulationEvaluator: + context = create_simulation_context( + config.simulation.type, config.simulation.usd_path, fixed_base=True + ) + evaluator = context.create_sysid_evaluator(config, create_parameter_space(config)) + assert isinstance(evaluator, NewtonPopulationEvaluator) + return evaluator + + def _config( asset: Path, *, delay_ms: int = 0, buffer_time: float = 0.0 ) -> ActuatorSysIdConfig: @@ -157,7 +167,7 @@ def test_native_mujoco_candidate_updates_change_each_world_response( # first population must change these physical scores and final positions. config = _config(scalar_asset) with wp.ScopedDevice("cpu"): - evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + evaluator = _evaluator(config) episode = _trajectory(0.6, 0.0) # CPU Warp arrays expose borrowed NumPy storage; retain a snapshot # before the next evaluation reuses the score buffer. @@ -185,7 +195,7 @@ def test_native_mujoco_repeated_trajectory_reset_is_deterministic( # leaking solver state across episodes breaks A/B/A repeatability. config = _config(scalar_asset, delay_ms=20, buffer_time=0.02) with wp.ScopedDevice("cpu"): - evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + evaluator = _evaluator(config) population = [_candidate(), _candidate(stiffness=80.0, armature=0.4)] a = _trajectory(0.6, 0.23) b = _trajectory(-0.7, -0.47, samples=13) @@ -283,7 +293,7 @@ def test_native_mujoco_delay_and_buffer_match_explicit_physical_rollout( ), ) with wp.ScopedDevice("cpu"): - evaluator = NewtonPopulationEvaluator(config, create_parameter_space(config)) + evaluator = _evaluator(config) scores = evaluator.evaluate([_candidate(), _candidate()], [episode]) model, solver, control, executor = _native_runtime(scalar_asset, "cpu") _reset_native(model, solver, executor, q=0.15) diff --git a/tests/integration/test_sysid_backend_cli.py b/tests/integration/test_sysid_backend_cli.py deleted file mode 100644 index b9b0cd1..0000000 --- a/tests/integration/test_sysid_backend_cli.py +++ /dev/null @@ -1,186 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Fresh-process explicit backend registration through the complete sysID CLI.""" - -from __future__ import annotations - -import csv -import json -import math -import os -import shutil -import subprocess -import sys -from pathlib import Path - -import pandas as pd -import pytest -import yaml - -pytestmark = pytest.mark.integration - -REPOSITORY = Path(__file__).resolve().parents[2] -FIXTURE = REPOSITORY / "tests" / "fixtures" / "sysid_backend" -COMMON_OUTPUTS = ( - ".completed", - "config.yaml", - "best_params.yaml", - "optimization_log.csv", - "run_summary.yaml", -) - - -@pytest.fixture -def custom_backend(tmp_path: Path) -> Path: - """Copy an importable custom backend package onto a private path.""" - package_path = tmp_path / "custom-backend" - package_path.mkdir() - shutil.copytree(FIXTURE / "toy_sysid_backend", package_path / "toy_sysid_backend") - return package_path - - -def _write_config(tmp_path: Path) -> Path: - rows = [ - { - "time_ns": timestamp, - "experiment": "toy-wave", - "field": field, - "value": value, - } - for field, values in ( - ("hip/command_q", [0.0, 1.0, -0.5, 0.75]), - ("hip/actual_q", [0.0, 0.65, -0.325, 0.4875]), - ) - for timestamp, value in zip((0, 10_000_000, 20_000_000, 30_000_000), values) - ] - parquet = tmp_path / "recording.parquet" - pd.DataFrame(rows).to_parquet(parquet, index=False) - usd = tmp_path / "response.usda" - usd.write_text( - '#usda 1.0\ndef Xform "response" {\n custom double gain_scale = 2.0\n}\n', - encoding="utf-8", - ) - document = { - "type": "actuator_sys_id", - "joint_parameters": [ - { - "names": ["hip"], - "controller": { - "type": "pd", - "clamps": {"effort_limit": 10.0, "velocity_limit": 10.0}, - "stiffness": {"lower": 0.5, "upper": 3.0}, - "damping": {"lower": 0.0, "upper": 1.0}, - }, - "parameters": { - "dry_friction": {"lower": 0.0, "upper": 0.1}, - "viscous_friction": {"lower": 0.0, "upper": 0.1}, - "armature": {"lower": 0.0, "upper": 0.1}, - }, - } - ], - "optimizer": { - "type": "python-cmaes", - "sigma": 0.4, - "max_iterations": 3, - "epsilon": 0.0001, - }, - "simulation": { - "type": "toy-sysid", - "usd_path": str(usd), - "physics_freq": 200, - "control_freq": 100, - "render_freq": 50, - "gain": 2.5, - "model_name": "usd-response", - }, - "num_envs": 6, - "seed": 17, - "dataset": { - "type": "parquet", - "source": str(parquet), - "resampling": {"type": "uniform", "dt": 0.01}, - }, - } - config = tmp_path / "config.yaml" - config.write_text(yaml.safe_dump(document), encoding="utf-8") - return config - - -@pytest.mark.parametrize("export_json", [True, False], ids=["json-export", "no-export"]) -def test_cli_uses_configured_sysid_context( - tmp_path: Path, - custom_backend: Path, - export_json: bool, -) -> None: - context_name = "JsonToyContext" if export_json else "ToyContext" - config = _write_config(tmp_path) - environment = dict(os.environ) - environment["PYTHONPATH"] = os.pathsep.join( - [str(custom_backend), str(REPOSITORY), environment.get("PYTHONPATH", "")] - ) - outputs = [tmp_path / "first-run", tmp_path / "repeat-run"] - for output in outputs: - result = subprocess.run( - [ - sys.executable, - str(FIXTURE / "run_cli.py"), - context_name, - "--config", - str(config), - "--output", - str(output), - ], - cwd=tmp_path, - env=environment, - capture_output=True, - text=True, - timeout=120, - check=False, - ) - assert result.returncode == 0, result.stdout + result.stderr - assert all((output / filename).is_file() for filename in COMMON_OUTPUTS) - assert not (output / "identified.usda").exists() - assert (output / "identified.json").exists() is export_json - - resolved = yaml.safe_load((output / "config.yaml").read_text()) - assert resolved["simulation"] == { - "type": "toy-sysid", - "usd_path": str(tmp_path / "response.usda"), - "physics_freq": 200, - "control_freq": 100, - "render_freq": 50, - "gain": 2.5, - "model_name": "usd-response", - } - best = yaml.safe_load((output / "best_params.yaml").read_text()) - summary = yaml.safe_load((output / "run_summary.yaml").read_text()) - assert summary["generations"] == 3 - assert summary["best_mse"] == best["best_mse"] - assert math.isfinite(best["best_mse"]) - # Mean command square is (1 + 0.25 + 0.5625) / 4 for this recording. - # The USD scale 2.0 and configured gain 2.5 give an effective gain of 5.0. - stiffness = best["parameters"]["hip"]["stiffness"] - assert best["best_mse"] == pytest.approx( - 0.453125 * (stiffness / 5.0 - 0.65) ** 2 - ) - with (output / "optimization_log.csv").open(newline="") as stream: - history = list(csv.DictReader(stream)) - assert len(history) == 3 - assert [int(row["generation"]) for row in history] == [0, 1, 2] - assert all( - math.isfinite(float(row[column])) - for row in history - for column in ("best_mse", "population_mean_mse") - ) - assert float(history[-1]["best_mse"]) == best["best_mse"] - if export_json: - model = json.loads((output / "identified.json").read_text()) - assert model["parameters"] == best["parameters"] - assert model["simulation"] == resolved["simulation"] - assert model["gain_scale"] == 2.0 - - for filename in ("best_params.yaml", "optimization_log.csv"): - assert (outputs[0] / filename).read_text() == ( - outputs[1] / filename - ).read_text() diff --git a/tests/test_actuator_sys_id_config.py b/tests/test_actuator_sys_id_config.py index 41297d3..9ef71bf 100644 --- a/tests/test_actuator_sys_id_config.py +++ b/tests/test_actuator_sys_id_config.py @@ -8,7 +8,6 @@ from anchor_bench.schema.actuator_sys_id import ( ActuatorSysIdConfig, - NewtonSimulationConfig, PdControllerConfig, ) from anchor_bench.schema.dataset import ParquetDatasetConfig @@ -79,7 +78,6 @@ def test_model_matches_schema_and_applies_defaults(valid_config_data): assert config.dataset.resampling.dt == 0.005 assert isinstance(config.joint_parameters[0].controller, PdControllerConfig) assert config.joint_parameters[0].controller.delay_duration_ms == 0 - assert isinstance(config.simulation, NewtonSimulationConfig) assert config.simulation.solver.integrator == "implicitfast" assert config.mlops is None @@ -191,16 +189,3 @@ def test_model_rejects_non_finite_numbers(valid_config_data): with pytest.raises(ValidationError): ActuatorSysIdConfig.model_validate(data) - - -def test_legacy_newton_config_names_reexport_neutral_models(): - from anchor_bench.schema.actuator_sys_id import WarpMujocoSolverConfig - from anchor_bench.schema.simulation import ( - NewtonSimulationConfig as NeutralNewtonConfig, - ) - from anchor_bench.schema.simulation import ( - WarpMujocoSolverConfig as NeutralSolverConfig, - ) - - assert NewtonSimulationConfig is NeutralNewtonConfig - assert WarpMujocoSolverConfig is NeutralSolverConfig diff --git a/tests/test_actuator_sys_id_simulation.py b/tests/test_actuator_sys_id_simulation.py index 29d9e60..f30ea53 100644 --- a/tests/test_actuator_sys_id_simulation.py +++ b/tests/test_actuator_sys_id_simulation.py @@ -14,8 +14,8 @@ from anchor_bench.core.simulation.newton import NewtonSimulationContext from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import SysIdSimulationConfig from anchor_bench.tasks.actuator_sys_id import simulation as simulation_module +from anchor_bench.tasks.actuator_sys_id import usd as usd_module from anchor_bench.tasks.actuator_sys_id.model import Candidate, Trajectory from anchor_bench.tasks.actuator_sys_id.parameter_space import create_parameter_space from anchor_bench.tasks.actuator_sys_id.simulation import ( @@ -155,12 +155,10 @@ def test_actuator_config_rejects_dataset_timestep_mismatch(tmp_path): _config(tmp_path, dataset_dt=0.01) -@pytest.mark.parametrize("inject_context", [False, True]) def test_newton_evaluator_uses_shared_simulation_context( tmp_path, monkeypatch, caplog, - inject_context, ): class FakeArray: def __init__(self, values): @@ -217,23 +215,6 @@ def capture_step_graph(self, *, dt, substeps): context = FakeContext() config = _config(tmp_path) - monkeypatch.setattr(simulation_module, "NewtonSimulationContext", FakeContext) - requested_context = {} - - def create_context(backend, usd_path, *, fixed_base): - assert not inject_context, "injected context must be reused" - requested_context.update( - backend=backend, - usd_path=usd_path, - fixed_base=fixed_base, - ) - return context - - monkeypatch.setattr( - simulation_module, - "create_simulation_context", - create_context, - ) monkeypatch.setattr( simulation_module, "_builder_joint_indices", @@ -251,21 +232,13 @@ def create_context(backend, usd_path, *, fixed_base): with caplog.at_level(logging.DEBUG, logger=simulation_module.__name__): evaluator = NewtonPopulationEvaluator( - config, - create_parameter_space(config), - **( - {"simulation_context": cast(NewtonSimulationContext, context)} - if inject_context - else {} - ), + config, create_parameter_space(config), cast(Any, context) ) assert evaluator._simulation_context is context assert evaluator._simulation_context.control is context.control np.testing.assert_allclose(evaluator._base_targets, [1.0, 2.0]) assert context.created_world_count == config.num_envs - if not inject_context: - assert requested_context["fixed_base"] is True assert context.template.joint_target_ke == [15.0] assert context.captured_step == (pytest.approx(0.005), 5) assert context.solver_options == { @@ -279,6 +252,22 @@ def create_context(backend, usd_path, *, fixed_base): in caplog.text ) + candidate: Candidate = {"hip": {"stiffness": 20.0}} + + def write_usd(source, output, parameters, controller_clamps, config_metadata): + assert source == config.simulation.usd_path + assert parameters == candidate + assert controller_clamps == { + "hip": config.joint_parameters[0].controller.clamps + } + assert config_metadata == config.model_dump_json() + output.write_text("#usda 1.0\n", encoding="utf-8") + + monkeypatch.setattr(usd_module, "write_identified_usd_layer", write_usd) + exported = evaluator.export_model(candidate, tmp_path) + assert exported == tmp_path / "identified.usda" + assert exported.is_file() + def test_newton_evaluator_weights_episode_mse_by_transition_count(monkeypatch): class FakeScoreArray: @@ -601,23 +590,3 @@ def launch_position_error(measured_positions, sample_index): assert score_sums.numpy_calls == 1 assert context.solver.reset_states == [context.state] assert len(context.solver.changed_flags) == 1 - - -def test_newton_evaluator_rejects_non_newton_config_before_loading( - tmp_path, monkeypatch -): - config = _config(tmp_path) - config.simulation = SysIdSimulationConfig( - usd_path=config.simulation.usd_path, - type="other", - physics_freq=1000, - control_freq=200, - render_freq=60, - ) - - def unexpected(*args, **kwargs): - raise AssertionError("must validate backend config before loading resources") - - monkeypatch.setattr(simulation_module, "create_simulation_context", unexpected) - with pytest.raises(TypeError, match="NewtonSimulationConfig"): - NewtonPopulationEvaluator(config, create_parameter_space(config)) diff --git a/tests/test_actuator_sys_id_task.py b/tests/test_actuator_sys_id_task.py index 1ad730a..341a0ee 100644 --- a/tests/test_actuator_sys_id_task.py +++ b/tests/test_actuator_sys_id_task.py @@ -3,11 +3,6 @@ from __future__ import annotations -import builtins -import importlib -from collections.abc import Mapping, Sequence -from pathlib import Path -from typing import ClassVar, Literal from unittest.mock import Mock import numpy as np @@ -15,26 +10,15 @@ import pytest import yaml -from anchor_bench.core.simulation import SimulationContext, registry -from anchor_bench.core.task_runner import TaskRunner -from anchor_bench.errors import DatasetAlignmentError, SimulationBackendError +from anchor_bench.errors import DatasetAlignmentError from anchor_bench.mlops import MLOpsRun, bind_active_run from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import JsonValue, SysIdSimulationConfig -from anchor_bench.tasks.actuator_sys_id import artifacts as artifacts_module from anchor_bench.tasks.actuator_sys_id import task as task_module from anchor_bench.tasks.actuator_sys_id.artifacts import write_artifacts from anchor_bench.tasks.actuator_sys_id.dataset import load_trajectories -from anchor_bench.tasks.actuator_sys_id.model import ( - Candidate, - GenerationRecord, - IdentifiedModelArtifact, - SysIdResult, - Trajectory, -) +from anchor_bench.tasks.actuator_sys_id.model import GenerationRecord, Trajectory from anchor_bench.tasks.actuator_sys_id.objective import PopulationEvaluator -from anchor_bench.tasks.actuator_sys_id.optimizer import FloatArray, OptimizationStep -from anchor_bench.tasks.actuator_sys_id.parameter_space import ParameterSpace +from anchor_bench.tasks.actuator_sys_id.optimizer import OptimizationStep from anchor_bench.tasks.actuator_sys_id.task import ActuatorSysIdTask @@ -94,68 +78,6 @@ def _config(tmp_path, **overrides): return ActuatorSysIdConfig.model_validate(data) -class ToySimulationConfig(SysIdSimulationConfig): - type: Literal["task-toy"] = "task-toy" # pyright: ignore[reportIncompatibleVariableOverride] - gain: float = 2.0 - - -class ResourceOnlyContext(SimulationContext[object, object]): - def _load(self, usd_path: Path): - return object(), object() - - -class ToyContext(ResourceOnlyContext): - sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ( - ToySimulationConfig - ) - - -@pytest.fixture -def use_toy_context(monkeypatch, tmp_path): - monkeypatch.setattr(SimulationContext, "_instance", None) - monkeypatch.setattr( - registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() - ) - - def select_context(context_type: type[ToyContext]): - usd = tmp_path / "scene.usda" - usd.write_text("#usda 1.0\n") - context = context_type(str(usd), fixed_base=True) - registry.SIMULATION_CONTEXTS["task-toy"] = context_type - config = _config( - tmp_path, - simulation={ - "type": "task-toy", - "usd_path": str(usd), - "gain": 2.0, - "physics_freq": 1000, - "control_freq": 200, - "render_freq": 60, - }, - ) - return config, context - - return select_context - - -def test_sysid_result_preserves_eight_positional_argument_signature(tmp_path): - usd_path = tmp_path / "identified.usda" - - result = SysIdResult( - {"hip": {"armature": 0.05}}, - 0.25, - 2, - tmp_path, - tmp_path / "best_parameters.yaml", - tmp_path / "optimization_log.csv", - tmp_path / "run_summary.yaml", - usd_path, - ) - - assert result.identified_usd_path == usd_path - assert result.identified_model_path is None - - def test_load_trajectories_aligns_commanded_and_measured_data( tmp_path, monkeypatch, @@ -316,9 +238,8 @@ def test_load_trajectories_rejects_an_episode_without_a_transition( load_trajectories(_config(tmp_path).dataset, joint_names=["hip"]) -def test_task_uses_registered_evaluator_and_context( - tmp_path, monkeypatch, use_toy_context -): +def test_task_runs_optimization_and_writes_artifacts(tmp_path, monkeypatch): + config = _config(tmp_path) trajectory = Trajectory( experiment="wave", joint_names=["hip"], @@ -327,48 +248,11 @@ def test_task_uses_registered_evaluator_and_context( ) class FakeEvaluator(PopulationEvaluator): - def __init__(self, selected_context: ToyContext) -> None: - self.context = selected_context - - def evaluate( - self, - population: Sequence[Candidate], - trajectories: Sequence[Trajectory], - ) -> FloatArray: - assert received["evaluator"] is self - assert self.context is context + def evaluate(self, population, trajectories): assert len(population) == config.num_envs assert trajectories == (trajectory,) return np.asarray([1.0, 0.25]) - def export_model( - self, best: Candidate, output: Path - ) -> IdentifiedModelArtifact: - assert received["evaluator"] is self - assert self.context is context - assert output == output_directory - assert best["hip"]["stiffness"] == pytest.approx(20.0) - path = output / "identified.json" - path.write_text('{"model": "toy"}') - return IdentifiedModelArtifact(path, "json") - - def describe_runtime(self) -> Mapping[str, JsonValue]: - assert received["evaluator"] is self - assert self.context is context - return {"type": "task-toy", "effective_gain": 2.0} - - class TaskToyContext(ToyContext): - def create_sysid_evaluator( - self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace - ) -> PopulationEvaluator: - assert isinstance(config.simulation, ToySimulationConfig) - assert config.simulation.gain == 2.0 - evaluator = FakeEvaluator(self) - received.update( - config=config, context=self, space=parameter_space, evaluator=evaluator - ) - return evaluator - class FakeOptimizer: def __init__(self): self.converged = False @@ -406,8 +290,20 @@ def write(output_dir, **values): task_module, "load_trajectories", lambda *args, **kwargs: [trajectory] ) monkeypatch.setattr(task_module, "create_optimizer", lambda *args: FakeOptimizer()) - received = {} - config, context = use_toy_context(TaskToyContext) + requested_context = {} + + class FakeContext: + def create_sysid_evaluator(self, task_config, parameter_space): + assert task_config is config + return FakeEvaluator() + + def create_context(backend, usd_path, *, fixed_base): + requested_context.update( + backend=backend, usd_path=usd_path, fixed_base=fixed_base + ) + return FakeContext() + + monkeypatch.setattr(task_module, "create_simulation_context", create_context) monkeypatch.setattr(task_module, "write_artifacts", write) mlops_run = Mock(spec=MLOpsRun) @@ -416,15 +312,13 @@ def write(output_dir, **values): assert result == output_directory assert written["best_mse"] == pytest.approx(0.25) - assert received["config"] is config - assert received["context"] is context - assert context.fixed_base is True - assert received["space"].dimension == 5 - assert written["model_artifact"] == IdentifiedModelArtifact( - output_directory / "identified.json", - "json", - ) - assert written["runtime_simulation"] == {"type": "task-toy", "effective_gain": 2.0} + assert requested_context == { + "backend": "newton", + "usd_path": config.simulation.usd_path, + "fixed_base": True, + } + # The base evaluator exports no model unless the simulator overrides it. + assert written["identified_usd_path"] is None assert written["best_parameters"]["hip"]["stiffness"] == pytest.approx(20.0) assert written["history"] == [ GenerationRecord(generation=0, best_mse=0.25, population_mean_mse=0.625) @@ -444,12 +338,7 @@ def write(output_dir, **values): ) -@pytest.mark.parametrize("model_format", [None, "json", "usd"]) -def test_common_artifacts_allow_missing_or_json_model_export( - tmp_path, - monkeypatch, - model_format, -): +def test_writes_fitted_parameters_and_generation_history(tmp_path): candidate = { "hip": { "stiffness": 20.0, @@ -459,147 +348,21 @@ def test_common_artifacts_allow_missing_or_json_model_export( "viscous_friction": 1.0, } } + output_dir = tmp_path / "output" output_dir.mkdir() - model_artifact = None - if model_format is not None: - # Deliberately use the USD suffix for JSON: compatibility depends on format. - path = output_dir / "identified.usda" - path.write_text("exported") - model_artifact = IdentifiedModelArtifact(path, model_format) - - original_import = builtins.__import__ - - def guard_import(name, *args, **kwargs): - if name.endswith("actuator_sys_id.usd"): - raise AssertionError("common artifacts must not import USD support") - return original_import(name, *args, **kwargs) - - monkeypatch.setattr(builtins, "__import__", guard_import) - importlib.reload(artifacts_module) + identified_usd_path = output_dir / "identified.usda" result = write_artifacts( output_dir, best_parameters=candidate, best_mse=0.125, history=[GenerationRecord(0, 0.125, 0.5)], - model_artifact=model_artifact, - runtime_simulation={"type": "toy", "solver": {"iterations": 8}}, + identified_usd_path=identified_usd_path, ) document = yaml.safe_load(result.best_parameters_path.read_text()) assert document["metric"] == "position_mse" assert document["parameters"] == candidate assert "0,0.125,0.5" in result.optimization_log_path.read_text() - summary = yaml.safe_load(result.run_summary_path.read_text()) - assert summary["best_mse"] == 0.125 - assert summary["generations"] == 1 - assert summary["runtime_simulation"] == {"type": "toy", "solver": {"iterations": 8}} - assert result.identified_model_path == ( - model_artifact.path if model_artifact else None - ) - assert result.identified_usd_path == ( - model_artifact.path if model_artifact and model_format == "usd" else None - ) - if model_artifact is None: - assert not (output_dir / "identified.usda").exists() - - -def test_export_failure_prevents_completion(tmp_path, monkeypatch, use_toy_context): - class Evaluator(PopulationEvaluator): - def evaluate( - self, - population: Sequence[Candidate], - trajectories: Sequence[Trajectory], - ) -> FloatArray: - return np.asarray([1.0] * len(population)) - - def export_model( - self, best: Candidate, output: Path - ) -> IdentifiedModelArtifact | None: - raise RuntimeError("toy export failed") - - class ExportFailureContext(ToyContext): - def create_sysid_evaluator( - self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace - ) -> PopulationEvaluator: - return Evaluator() - - config, _ = use_toy_context(ExportFailureContext) - config.num_envs = 4 - monkeypatch.setattr( - task_module, - "load_trajectories", - lambda *args, **kwargs: [ - Trajectory("wave", ["hip"], np.zeros((2, 1)), np.zeros((2, 1))) - ], - ) - config_path = tmp_path / "config.yaml" - config_path.write_text(yaml.safe_dump(config.model_dump(mode="json"))) - output = tmp_path / "failed" - with pytest.raises(RuntimeError, match="toy export failed"): - TaskRunner().run(str(config_path), output=output) - assert not (output / ".completed").exists() - assert not (output / "best_params.yaml").exists() - - -def test_missing_sysid_capability_fails_before_optimizer(tmp_path, monkeypatch): - config = _config(tmp_path) - monkeypatch.setattr( - registry, "SIMULATION_CONTEXTS", registry.SIMULATION_CONTEXTS.copy() - ) - registry.SIMULATION_CONTEXTS["resource-only"] = ResourceOnlyContext - config.simulation = SysIdSimulationConfig( - usd_path=config.simulation.usd_path, - type="resource-only", - physics_freq=1000, - control_freq=200, - render_freq=60, - ) - - def unexpected(*args, **kwargs): - raise AssertionError("must fail before optimization or dataset loading") - - monkeypatch.setattr(task_module, "load_trajectories", unexpected) - monkeypatch.setattr(task_module, "create_optimizer", unexpected) - with pytest.raises( - SimulationBackendError, match="does not support system identification" - ): - ActuatorSysIdTask(config).run(tmp_path) - - -def test_task_accepts_inherited_optional_evaluator_methods( - tmp_path, monkeypatch, use_toy_context -): - class Evaluator(PopulationEvaluator): - def evaluate( - self, - population: Sequence[Candidate], - trajectories: Sequence[Trajectory], - ) -> FloatArray: - return np.ones(len(population), dtype=np.float64) - - class EvaluationOnlyContext(ToyContext): - def create_sysid_evaluator( - self, config: ActuatorSysIdConfig, parameter_space: ParameterSpace - ) -> PopulationEvaluator: - return Evaluator() - - config, _ = use_toy_context(EvaluationOnlyContext) - config.num_envs = 4 - monkeypatch.setattr( - task_module, - "load_trajectories", - lambda *args, **kwargs: [ - Trajectory("wave", ["hip"], np.zeros((2, 1)), np.zeros((2, 1))) - ], - ) - output = tmp_path / "evaluation-only" - output.mkdir() - - assert ActuatorSysIdTask(config).run(output) == output - - summary = yaml.safe_load((output / "run_summary.yaml").read_text()) - assert summary["best_mse"] == pytest.approx(1.0) - assert "runtime_simulation" not in summary - assert (output / "best_params.yaml").is_file() - assert not (output / "identified.usda").exists() + assert result.run_summary_path.is_file() + assert result.identified_usd_path == identified_usd_path diff --git a/tests/test_data_processor_runner.py b/tests/test_data_processor_runner.py index 030583b..1e450ed 100644 --- a/tests/test_data_processor_runner.py +++ b/tests/test_data_processor_runner.py @@ -94,14 +94,14 @@ def _load(self, usd_path: Path) -> tuple[Any, Any]: @pytest.fixture(autouse=True) def simulation_context( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, ) -> RunnerSimulationContext: """Create the shared simulation context before running data processors.""" monkeypatch.setattr(SimulationContext, "_instance", None) - source = tmp_path / "scene.usda" - source.write_text("#usda 1.0\n") + source = tmp_path / "robot.usda" + source.write_text("#usda 1.0", encoding="utf-8") return RunnerSimulationContext(str(source)) diff --git a/tests/test_data_processors.py b/tests/test_data_processors.py index 80a64be..387208e 100644 --- a/tests/test_data_processors.py +++ b/tests/test_data_processors.py @@ -5,7 +5,7 @@ from pathlib import Path from types import SimpleNamespace -from typing import Any, Tuple +from typing import Any, Optional, Tuple import numpy as np import pandas as pd @@ -44,9 +44,12 @@ def process(self) -> pd.DataFrame: class RecordingSimulationContext(SimulationContext): + loaded_path: Optional[str] = None + def _load(self, usd_path: Path) -> Tuple[Any, Any]: - """Provide the model consumed through the current shared context.""" + """Record the USD selected by the current context.""" + self.loaded_path = str(usd_path) return SimpleNamespace( joint_label=["shoulder", "elbow"], joint_qd_start=FakeNewtonArray([0, 1, 2]), @@ -59,8 +62,8 @@ def _load(self, usd_path: Path) -> Tuple[Any, Any]: @pytest.fixture(autouse=True) def simulation_context( - tmp_path: Path, monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, ) -> RecordingSimulationContext: """Create one process-wide context for every data processor test.""" @@ -69,8 +72,8 @@ def simulation_context( "_instance", None, ) - source = tmp_path / "scene.usda" - source.write_text("#usda 1.0\n") + source = tmp_path / "robot.usda" + source.write_text("#usda 1.0", encoding="utf-8") return RecordingSimulationContext(str(source)) @@ -107,10 +110,10 @@ def test_simulation_context_cannot_be_instantiated( tmp_path: Path, monkeypatch: pytest.MonkeyPatch, ) -> None: + source = tmp_path / "robot.usda" + source.write_text("#usda 1.0", encoding="utf-8") monkeypatch.setattr(SimulationContext, "_instance", None) - source = tmp_path / "scene.usda" - source.write_text("#usda 1.0\n") with pytest.raises(TypeError): SimulationContext(str(source)) # pyright: ignore[reportAbstractUsage] diff --git a/tests/test_newton_simulation_context.py b/tests/test_newton_simulation_context.py index be8507f..04d5f9e 100644 --- a/tests/test_newton_simulation_context.py +++ b/tests/test_newton_simulation_context.py @@ -438,25 +438,3 @@ def test_rejects_different_import_configuration(tmp_path: Path) -> None: with pytest.raises(RuntimeError, match="different base mode"): NewtonSimulationContext(str(source), fixed_base=False) - - -def test_resolved_usd_alias_reuses_newton_resources( - fake_newton_usd: Path, - monkeypatch: pytest.MonkeyPatch, -) -> None: - """Canonicalize backend-owned paths before assigning resource identity.""" - - monkeypatch.chdir(fake_newton_usd.parent) - alias = fake_newton_usd.parent / "alias.usda" - alias.symlink_to(fake_newton_usd) - context = NewtonSimulationContext("robot.usda", fixed_base=True) - model, state = context.load() - - repeated = NewtonSimulationContext(str(alias), fixed_base=True) - - assert repeated is context - assert context.usd_path == fake_newton_usd.resolve() - assert context.fixed_base is True - assert repeated.model is model - assert repeated.state is state - assert FakeModelBuilder.instance_count == 2 diff --git a/tests/test_simulation_context.py b/tests/test_simulation_context.py deleted file mode 100644 index ce9f578..0000000 --- a/tests/test_simulation_context.py +++ /dev/null @@ -1,125 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Shared USD resource identity and lifetime contracts.""" - -from __future__ import annotations - -from pathlib import Path -from typing import Any - -import pytest - -from anchor_bench.core.simulation import SimulationContext - - -class ToyContext(SimulationContext[object, object]): - """Load resources using the USD assigned by the shared context.""" - - load_count = 0 - - def _load(self, usd_path: Path) -> tuple[object, object]: - assert usd_path == self.usd_path - assert usd_path.read_text() == "#usda 1.0\n" - self.load_count += 1 - return object(), object() - - -class OtherToyContext(ToyContext): - """Represent an incompatible backend using the same USD.""" - - -@pytest.fixture(autouse=True) -def reset_context(monkeypatch: pytest.MonkeyPatch) -> None: - monkeypatch.setattr(SimulationContext, "_instance", None) - - -@pytest.fixture -def usd_path(tmp_path: Path) -> Path: - path = tmp_path / "scene.usda" - path.write_text("#usda 1.0\n") - return path - - -def test_usd_context_loads_once(usd_path: Path) -> None: - context = ToyContext(str(usd_path)) - - assert context.usd_path == usd_path.resolve() - assert context.load_count == 0 - model, state = context.load() - assert context.model is model - assert context.state is state - assert context.load() == (model, state) - assert context.load_count == 1 - assert SimulationContext.current() is context - - -def test_equivalent_usd_paths_reuse_loaded_context(usd_path: Path) -> None: - context = ToyContext(str(usd_path)) - model, state = context.load() - alias = usd_path.with_name("alias.usda") - alias.symlink_to(usd_path) - - repeated = ToyContext(str(alias)) - - assert repeated is context - assert repeated.model is model - assert repeated.state is state - assert repeated.load_count == 1 - - -def test_repeated_usd_conflicts_leave_original_context_usable(usd_path: Path) -> None: - context = ToyContext(str(usd_path)) - model, state = context.load() - other = usd_path.with_name("other.usda") - other.write_text("#usda 1.0\n") - - for _ in range(2): - with pytest.raises(RuntimeError, match="already uses"): - ToyContext(str(other)) - - assert ToyContext(str(usd_path)) is context - assert context.model is model - assert context.state is state - assert context.load_count == 1 - - -def test_repeated_base_mode_conflicts_preserve_context(usd_path: Path) -> None: - context = ToyContext(str(usd_path), fixed_base=True) - for _ in range(2): - with pytest.raises(RuntimeError, match="different base mode"): - ToyContext(str(usd_path), fixed_base=False) - assert ToyContext(str(usd_path), fixed_base=True) is context - assert context.fixed_base is True - - -def test_repeated_backend_conflicts_leave_original_context_usable( - usd_path: Path, -) -> None: - context = ToyContext(str(usd_path)) - - for _ in range(2): - with pytest.raises(RuntimeError, match="Only one simulation backend"): - OtherToyContext(str(usd_path)) - - assert ToyContext(str(usd_path)) is context - assert SimulationContext.current() is context - - -@pytest.mark.parametrize("directory", [False, True]) -def test_invalid_usd_path_does_not_claim_context( - usd_path: Path, directory: bool -) -> None: - invalid = usd_path.parent if directory else usd_path.with_name("missing.usda") - with pytest.raises(FileNotFoundError, match="USD file does not exist"): - ToyContext(str(invalid)) - context = ToyContext(str(usd_path)) - assert SimulationContext.current() is context - - -def test_usd_path_is_required() -> None: - context_type: Any = ToyContext - with pytest.raises(TypeError): - context_type() - with pytest.raises(TypeError): - context_type(resource_key=("toy", 2)) diff --git a/tests/test_sysid_backends.py b/tests/test_sysid_backends.py deleted file mode 100644 index a471086..0000000 --- a/tests/test_sysid_backends.py +++ /dev/null @@ -1,137 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Simulator selection and configuration boundaries.""" - -from __future__ import annotations - -import json -from copy import deepcopy -from pathlib import Path -from typing import ClassVar, Literal - -import pytest -from pydantic import StrictInt, ValidationError - -from anchor_bench.core.artifacts import _hash_name -from anchor_bench.core.simulation import SimulationContext, registry -from anchor_bench.errors import SimulationBackendError -from anchor_bench.schema.actuator_sys_id import ActuatorSysIdConfig -from anchor_bench.schema.simulation import SysIdSimulationConfig - - -class ToyConfig(SysIdSimulationConfig): - type: Literal["toy"] = "toy" # pyright: ignore[reportIncompatibleVariableOverride] - gain: StrictInt - - -class ResourceOnlyContext(SimulationContext[object, object]): - def _load(self, usd_path: Path) -> tuple[object, object]: - return object(), object() - - -class ToyContext(ResourceOnlyContext): - sysid_config_model: ClassVar[type[SysIdSimulationConfig] | None] = ToyConfig - - -@pytest.fixture(autouse=True) -def isolated_registry(monkeypatch: pytest.MonkeyPatch): - monkeypatch.setattr( - registry, - "SIMULATION_CONTEXTS", - {**registry.SIMULATION_CONTEXTS, "toy": ToyContext}, - ) - monkeypatch.setattr(SimulationContext, "_instance", None) - - -@pytest.fixture -def toy_task_data(tmp_path): - usd = tmp_path / "scene.usda" - usd.write_text("#usda 1.0\n") - return { - "type": "actuator_sys_id", - "joint_parameters": [ - { - "names": ["joint"], - "controller": { - "type": "pd", - "clamps": {"effort_limit": 1, "velocity_limit": 1}, - "stiffness": {"lower": 0, "upper": 1}, - "damping": {"lower": 0, "upper": 1}, - }, - "parameters": { - key: {"lower": 0, "upper": 1} - for key in ("dry_friction", "viscous_friction", "armature") - }, - } - ], - "optimizer": { - "type": "python-cmaes", - "sigma": 1, - "max_iterations": 1, - "epsilon": 0.1, - }, - "simulation": { - "type": "toy", - "usd_path": str(usd), - "gain": 2, - "physics_freq": 1000, - "control_freq": 200, - "render_freq": 60, - }, - "dataset": { - "type": "parquet", - "source": "toy.parquet", - "resampling": {"type": "uniform", "dt": 0.005}, - }, - } - - -def test_plugin_simulation_roundtrips_without_losing_fields(toy_task_data): - config = ActuatorSysIdConfig.model_validate(toy_task_data) - assert isinstance(config.simulation, ToyConfig) - assert config.simulation.gain == 2 - assert json.loads(config.model_dump_json())["simulation"]["gain"] == 2 - restored = ActuatorSysIdConfig.model_validate_json(config.model_dump_json()) - assert restored == config - assert _hash_name(restored) == _hash_name(config) - changed = deepcopy(toy_task_data) - changed["simulation"]["gain"] = 3 - assert _hash_name(ActuatorSysIdConfig.model_validate(changed)) != _hash_name(config) - - -@pytest.mark.parametrize("patch", [{"gain": "2"}, {"extra": 1}, {"control_freq": 300}]) -def test_plugin_simulation_is_strict(toy_task_data, patch): - toy_task_data["simulation"].update(patch) - with pytest.raises(ValidationError): - ActuatorSysIdConfig.model_validate(toy_task_data) - - -def test_context_without_sysid_fails_early(toy_task_data): - registry.SIMULATION_CONTEXTS["toy"] = ResourceOnlyContext - with pytest.raises(SimulationBackendError, match="system identification"): - ActuatorSysIdConfig.model_validate(toy_task_data) - - -def test_yaml_parser_uses_configured_context(toy_task_data, tmp_path): - import yaml - - from anchor_bench.schema.parse import parse - - path = tmp_path / "task.yaml" - path.write_text(yaml.safe_dump(toy_task_data), encoding="utf-8") - config = parse(path) - assert isinstance(config, ActuatorSysIdConfig) - assert isinstance(config.simulation, ToyConfig) - assert config.simulation.gain == 2 - - -def test_plugin_simulation_requires_usd_input(toy_task_data): - toy_task_data["simulation"].pop("usd_path", None) - with pytest.raises(ValidationError, match="usd_path"): - ActuatorSysIdConfig.model_validate(toy_task_data) - - -def test_unknown_backend_fails_at_context_lookup(): - with pytest.raises(ValueError, match="Unknown simulation backend"): - registry.get_simulation_context_type("missing-backend")