test-python-binding
Build and test the NeMo Relay Python binding and worker plugin SDK; use for python/nemo_relay, python/plugin, or crates/python changes
- License 许可
- Apache-2.0
- 所属仓库
- dawsonblock/NEMO
- 最近更新
- 2026-09-30
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- test-python-binding
- author
- NVIDIA Corporation and Affiliates
- license
- Apache-2.0
- description
- Build and test the NeMo Relay Python binding and worker plugin SDK; use for python/nemo_relay, python/plugin, or crates/python changes
03 SKILL.md 正文
Build And Test Python Binding
Companion Guidance
Use karpathy-guidelines alongside this skill for implementation or review
work. Keep changes scoped, surface assumptions, and define focused validation
before editing.
Use this skill when the change is primarily in python/nemo_relay,
python/plugin, python/tests, crates/python, or Python-facing
docs/examples.
Default Path
- Format changed Python wrapper and test files with
uv run ruff format python python/plugin. - Run focused
pytestfirst when you know the affected area. - Run
just test-python-pluginwhen the Python worker SDK changed. - Run the full Python suite with
just test-pythonbefore review. - If any Rust files changed as part of the Python work, also run
cargo fmt --all,just test-rust, andcargo clippy --workspace --all-targets -- -D warnings. - Use
just build-pythonwhen you want an explicit build-only pass. - Use
just build-python-pluginwhen the Python worker SDK changed. - If the native Rust bridge changed, add the Rust crate tests for
nemo-relay-python.
Python Test Style
- Pytest is used to run tests.
- Do not add
@pytest.mark.asyncioto any test. Async tests are automatically detected and run by the async runner; the decorator is unnecessary clutter. - Do not add a
-> Nonereturn type annotation to test functions. This is not a common convention in pytest and adds unnecessary verbosity. - When mocking a class, do not define a new class. Use
unittest.mock.MagicMockorunittest.mock.AsyncMock, with thespecconstructor argument when necessary. - The name of the mocked class should be prefixed with
mock, notfake. - Prefer pytest fixtures over helper methods.
- Do not repeat fixtures, if a fixture is needed in multiple test files, place it in a
conftest.pyfile. - When creating a fixture follow this pattern:
Only specify the scope argument when the value is something other than "function".@pytest.fixture(name="<fixture_name>"[, scope="<scope>"]) def <fixture_name>_fixture() -> <return_type>: ... - Prefer
pytest.mark.parametrizeover creating individual tests for different input types.
Common Commands
# Focused test loop
uv run pytest -k "<pattern>"
# Required first for focused dynamic-plugin host tests
just build-test-plugin-fixtures
uv run pytest python/tests/test_dynamic_plugin_host.py
# Focused Python worker plugin SDK suite
just test-python-plugin
# Format Python files
uv run ruff format python python/plugin
# Full Python suite
just test-python
# Required when the Python change also touched Rust code
cargo fmt --all
just test-rust
cargo clippy --workspace --all-targets -- -D warnings
# Rebuild the editable package plus native extension
just build-python
# Rebuild/install the Python worker plugin SDK
just build-python-plugin
# Native extension crate when crates/python changed
cargo test -p nemo-relay-python
When To Escalate
- If
crates/core,crates/adaptive, or shared runtime semantics changed, also usevalidate-change. - If
python/pluginor worker protocol behavior changed, also usemaintain-dynamic-plugins. - If the change is actually about docs only, prefer
contribute-docsplus targeted command checks.
References
pyproject.tomlcrates/python/Cargo.tomlcrates/python/README.mdpython/nemo_relay/README.mdpython/plugin/pyproject.tomlpython/plugin/src/nemo_relay_pluginpython/tests/plugindocs/getting-started/quick-start/python.mdxdocs/contribute/testing-and-docs.mdxvalidate-change
04 同仓库更多 Skills
nemo-relay-plugin-observability
Use this skill when choosing or configuring NeMo Relay 0.6 or 0.7 observability through the built-in plugin, subscribers, or exporters, including raw ATOF events, ATIF trajectories, OpenTelemetry, OpenInference, or custom event handling.
nemo-relay-plugin-build
Use this skill when building or packaging reusable NeMo Relay runtime behavior as an embedded configuration component or a manifest-backed `rust_dynamic` native or `worker` gRPC plugin, with deterministic validation and rollback-safe registration.
nemo-relay-plugin-adaptive-tuning
Use this skill when baseline NeMo Relay instrumentation exists and the user wants to configure or evaluate adaptive plugin behavior, including telemetry, state, adaptive_hints, tool_parallelism, ACG, hint consumption, or measured rollout.
nemo-relay-migrate-from-flow
Use this skill when migrating applications, examples, integrations, documentation, manifests, or repository code from NeMo Flow to NeMo Relay across Python, Rust, Node.js, Go, C FFI, CLI, configuration, and observability surfaces.
nemo-relay-integrate-upstream
Use this skill when assessing, extending, or implementing NeMo Relay support in an agent harness or agent framework, including coding agents and orchestration runtimes, when the host lacks Relay support or an existing integration needs deeper coverage. It identifies the host's execution boundaries and extension points, selects an appropriate attachment method for each boundary, and verifies the resulting coverage.
nemo-relay-instrument-typed-wrappers
Use this skill when adding NeMo Relay typed wrappers, domain types, or provider codecs while preserving JSON middleware semantics and caller-visible behavior.