bayeswire
Bayeswire is the stdlib-only model declaration language and wire format for the
Bayescycle toolchain. It owns authoring semantics, resolved ModelMeta,
bayeswire_ir serialization, dimension sidecars, the wire-related documents in
root spec/, and the golden conformance corpus.
It contains no arrays, log-density math, binding, inference, plotting, or workflow orchestration.
Declare a model
from bayeswire import Data, Observed, Param, model
from bayeswire.constraints import Positive
from bayeswire.distributions import Normal, Truncated
@model
class LinearRegression:
alpha = Param(Normal(0.0, 1.0))
beta = Param(Normal(0.0, 1.0))
sigma = Param(
Truncated(Normal(0.0, 1.0), lower=0.0),
constraint=Positive(),
)
x = Data.vector()
mu = alpha + beta * x
y = Observed(Normal(mu, sigma))
Resolve and serialize without binding data:
from bayeswire.ir import canonical_bytes, meta_from_dict, meta_to_dict
from bayeswire.model import model_meta
meta = model_meta(LinearRegression)
document = meta_to_dict(meta)
wire_bytes = canonical_bytes(meta)
restored = meta_from_dict(document)
ModelMeta is the serialization boundary. Decoding executes no user code.
Canonical bytes are stable input to model hashes and downstream conformance.
Dimension labels and coordinates travel in a separate sidecar and do not change
the model hash.
Composition
Submodel(Model) reuses a complete model under an explicit namespace. It
prefixes and flattens the child's parameters, data, dimensions, expressions,
and stochastic factors before serialization; hierarchy is not an IR concept.
with_prior(Target, prior=Source) returns a new closed model with a complete
same-name replacement prior:
from bayeswire import Param, model, with_prior
from bayeswire.constraints import Positive
from bayeswire.distributions import HalfNormal, Normal
@model
class SimulationPrior:
alpha = Param(Normal(0.0, 0.25))
beta = Param(Normal(1.0, 0.2))
sigma = Param(HalfNormal(0.5), constraint=Positive())
SimulationModel = with_prior(LinearRegression, prior=SimulationPrior)
The source must be structurally prior-only and provide every target parameter
with the same name, constraint, size, and dimensions. Composition is immutable
and closes to ordinary flat bayeswire_ir v1. The precise durable rules are in
docs/invariants.md.
Contracts and corpus
The root spec/ defines the shared interoperability formats.
The corpus under
src/bayeswire/corpus/ contains golden IR documents,
canonical hashes, data documents, and Bayesjax-oracle evaluation fixtures.
Producers reproduce its bytes; consumers evaluate it within the spec tolerance.
Any tag, field, or canonical-byte change requires an explicit IR-version decision and deliberate corpus regeneration.
Development
uv run ruff format --check .
uv run ruff check .
uv run ty check
uv run pytest
The suite includes a no-JAX import walk and produce-conformance. See
AGENTS.md for working rules.
Metadata
Release files for bayeswire 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bayeswire-0.7.0.tar.gz | 213.9 kB | Without provenance | Details for bayeswire-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bayeswire-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for bayeswire-0.7.0-py3-none-any.whl |
Total release size: 463.1 kB
Release files / bayeswire-0.7.0.tar.gz
| Download URL | bayeswire-0.7.0.tar.gz |
|---|---|
| Size | 213.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3019036dbc35f8e592e282a919dc8857a45173c765270468f81960e9f24caaff
|
|
BLAKE2b-256 checksum How to use checksums |
305c882bc31f1b60884b9ac594d4f6f026423841a9f2520150de27fad48f5774
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bayeswire-0.7.0-py3-none-any.whl
| Download URL | bayeswire-0.7.0-py3-none-any.whl |
|---|---|
| Size | 249.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbbc65792ed34e266dea6a9ce6dc05cecdb56f66aa9bf31d706afeedf4d41750
|
|
BLAKE2b-256 checksum How to use checksums |
5a1aad38800bd2e7d4d18866679b23c1f27fc3cd5c3052c74ca82b1331886cca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for bayeswire 0.7.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.