Skip to main content

Metewand Python package

Define benchmarks with ordinary functions and small scientific result objects. The package requires Python 3.11 or later and has no third-party runtime dependencies. The separate CLI supplies worker adapters, measures execution, validates outputs, computes file hashes, and publishes canonical artifacts.

Install and run

From a checkout, install the CLI and package in the selected worker environment:

cargo install --locked --path .
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install ./packages/python
metewand init my-benchmark
cd my-benchmark
metewand check --workers
metewand run --output-dir run

On Windows, activate the environment with .\.venv\Scripts\Activate.ps1. Building the CLI from source requires Rust's MSVC toolchain and Visual Studio C++ build tools; installing the Python package does not. See getting started for binary CLI installation, platform requirements, and local NTFS storage requirements.

The package and CLI have independent releases. Compatibility follows binding API version 1, rather than equal release numbers. Upgrade the CLI without reinstalling a compatible package. Pin scientific dependencies and source revisions when retaining benchmark evidence.

Author benchmarks

Ordinary functions use generate(context), solve(data, context), and evaluate(data, result, context). Select them in YAML with function: benchmark.py:solve. Evaluators may return plain metric dictionaries when no scientific rules are declared; otherwise return Evaluation(metrics, verdict).

For separate preparation and solving, register functions:

from metewand import read_json, serve_implementation


def prepare(context):
    return read_json(context.dataset_dir / "data.json")


def execute(state, context):
    return {"answer": sum(state["values"])}


serve_implementation(prepare=prepare, execute=execute,
                     reset=lambda state, context: None)

Select protocol-transport: socket for lifecycle workers. Context supplies parameters, problem_parameters, seed, semantics, assigned directories, and optional observation_control. Optional fields can be added without changing signatures. Path fields are pathlib.Path values. The CLI never sets scientific random generators automatically.

Cooperative solvers can register execute_stream(state, context) and use context.stream.checkpoint(progress, snapshot) to pause for an independently evaluated decision. The CLI supplies this helper within binding API 1. See the streaming example for bounded policies, result snapshots, stopping, and clean-state retries.

Optional result(output, context) converts solver output after diagnostic solve timing. statistics(output, context) returns diagnostics. reset(state, context) releases slot state, and shutdown(state, context) releases resources. Execution consumes preparation even when it fails; the original preparation state remains available for cleanup.

Dataset(data, files) and Result(data, files) describe JSON data and completed files. Write files beneath context.output_dir, close them, and declare them with Artifact(path, media_type, representation). The CLI owns envelopes, inventories, canonicalization, and hashes. Native workers may still implement the public process protocol and write completed artifacts directly.

For configuration-dependent support, register check_applicability(context) and declare capabilities: [one_shot, applicability]. Return a dictionary with outcome (applicable or not_applicable), nonempty code and reason, and optional details. The callback can inspect context.dataset_dir and context.dataset_manifest before preparation and must preserve those inputs.

Buffered workers register execute_buffered(state, context) and use the CLI-provided context.observer for observe, record, finish, or native buffer adoption. Observer implementations and profile policy handling ship with the CLI. No per-point process exchange is added.

The pre-MVP migration replaces implementation subclasses with named callbacks, positional arguments with contexts, and manifest writers with output values. Protocol, canonicalization, and observer implementation classes are no longer exported from the package. Constructors and JSON utilities work without the CLI; serving requires its adapter and never downloads code.

See the authoring guide, Python example, and buffered profile example. Package tests run with:

python -m unittest discover -s packages/python/tests -v

The runtime's adapter tests retain canonicalization, identity, lifecycle, and profile conformance coverage. CI checks installed wheels and source distributions on Linux, macOS, and Windows.

Metadata

Release files for metewand 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metewand 0.3.0
File Size Uploaded Provenance Actions
metewand-0.3.0.tar.gz 9.9 kB With provenance Details for metewand-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metewand 0.3.0
File Interpreter ABI Platform Actions
metewand-0.3.0-py3-none-any.whl Python 3 none any Details for metewand-0.3.0-py3-none-any.whl

Total release size: 20.0 kB

Release files / metewand-0.3.0.tar.gz

Download URL metewand-0.3.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c4ced63fd194ef51b150dc481ae79ad0f80682b0090912cf4b6418ab8a965cf3
BLAKE2b-256 checksum
How to use checksums
b8219d38cce2828c5b4c248f6767927dd7ec582fdf54f6cdb97d6c1c62692d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / metewand-0.3.0-py3-none-any.whl

Download URL metewand-0.3.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73c7194cfd030e244302f116ad3a9561d0c14a527474320cf26665a2081b3adb
BLAKE2b-256 checksum
How to use checksums
935fe82ae2114a61118672aaaa2f653c5bb2119b1761836e6039faf3e8025a75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for metewand 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for metewand-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page