Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

benzene-mesh

The mesh module for the Benzene Python port. Make a Python Benzene service a first-class citizen of a Benzene mesh: it registers its self-description with a collector, traces every invocation, and reports heartbeats, traces and issues — all optional and additive. The receiving side, MeshCollector, ships here too.

Depends only on benzene-core.

pip install benzene-mesh

Describe the service once — and register that

A service describes itself with its Contract Document, derived at the composition root from the handler registry and the outbound declarations, and served on the reserved benzene:spec topic (and GET /benzene/spec). The mesh has no self-description of its own: the benzene:mesh:register body is that document, so what the mesh knows can never drift from what the service serves.

from benzene.core import AppDefinition, ContractInfo, OutboundRegistry, Registry, application_from
from benzene.mesh import registration_document

definition = AppDefinition(
    registry=Registry(),  # ... your handlers, e.g. .add(place_order)
    outbound=OutboundRegistry().register_send("payments:capture", CapturePayment),
    contract=ContractInfo("orders", service_version="1.4.2", version_scheme="semver",
                          placement={"cloud": "aws"}),
)
app = application_from(definition)               # benzene:spec answers with the document
document = registration_document(definition)     # ...and this is the very same document

Trace every invocation

trace_middleware emits exactly one TraceEvent per invocation — joining an inbound W3C traceparent trace or starting a fresh one, and recording the topic, the semantic status, and the duration. Export is asynchronous, non-blocking, and lossy: tracing never breaks the request.

from benzene.mesh import QueueTraceExporter, trace_middleware

exporter = QueueTraceExporter()
definition.middleware.insert(0, trace_middleware(exporter, service="orders"))  # outermost, before application_from

Report into a collector

MeshFeedSender pushes a service's mesh feeds to a collector over any outbound MessageSender (Pub/Sub, SNS, Service Bus, or an HTTP POST) — register announces the Contract Document once, and publish_heartbeat / publish_traces / publish_issues stream the ongoing telemetry:

from benzene.mesh import Heartbeat, IssueAggregator, MeshFeedSender

feeds = MeshFeedSender(outbound_client)
await feeds.register(document)                                   # benzene:mesh:register
await feeds.publish_heartbeat(Heartbeat.for_document(            # registrationHash + serviceVersion
    document, sent_at="2026-07-31T12:00:00Z", instance_id="orders-7f9c"))
await feeds.publish_traces(exporter.drain())                     # any iterable of TraceEvent

issues = IssueAggregator(service="orders")
issues.record(topic="order:create", status="service-unavailable", exception_type="HttpError")
issues.record(topic="order:create", status=result.status, errors=result.errors)  # (field, code) detail
await feeds.publish_issues(issues.flush())   # deduplicated failure signatures; count is a delta

Passing a failing result's errors gives its issue an errors detail — each error's field and code counted, never its message, bounded to the ten most frequent pairs at the flush (mesh.md §4.1).

Mirrors .NET's Benzene.Mesh, and contributes the benzene.mesh subpackage to the shared benzene namespace. The wire shapes (the registration, heartbeat, TraceEvent and collector topics) are the cross-language mesh contract — a Python service and a .NET/Go/TypeScript one show up in the same mesh.

Metadata

Release files for benzene-mesh 0.1.0b2

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

Source distribution (sdist)

Source distribution for benzene-mesh 0.1.0b2
File Size Uploaded Provenance Actions
benzene_mesh-0.1.0b2.tar.gz 51.2 kB With provenance Details for benzene_mesh-0.1.0b2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for benzene-mesh 0.1.0b2
File Interpreter ABI Platform Actions
benzene_mesh-0.1.0b2-py3-none-any.whl Python 3 none any Details for benzene_mesh-0.1.0b2-py3-none-any.whl

Total release size: 112.7 kB

Release files / benzene_mesh-0.1.0b2.tar.gz

Download URL benzene_mesh-0.1.0b2.tar.gz
Size 51.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5147d14d2a55c4d2745e00b6073479a17085a22bca4d9d4e86b5aa5681b061f2
BLAKE2b-256 checksum
How to use checksums
af2a6bb03c53166b0bc3a580149e27bcd87a65503718d6d77de2de2207984f2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Release files / benzene_mesh-0.1.0b2-py3-none-any.whl

Download URL benzene_mesh-0.1.0b2-py3-none-any.whl
Size 61.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ac2a3fbe1eb5b32e49312743e68c0cb8bd2767c6cbb35d5a790eb261803da20
BLAKE2b-256 checksum
How to use checksums
1dfe80f2c929e12953a3073f797f3ae70525a89e647bf70e4f45b16f84ff8efa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 16, 2026.

Transparency log

Security for benzene-mesh 0.1.0b2

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for benzene_mesh-0.1.0b2.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 Oct 16, 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