This release is a pre-release and may not be stable for production use.
benzene-results
The bottom layer of the Benzene Python port:
the Result type and the status vocabulary. Zero dependencies.
A domain handler returns a value, never raising for an expected outcome:
from benzene.results import Result
def create_order(request) -> Result:
if not request.get("sku"):
return Result.bad_request("sku is required")
return Result.created({"id": "ord_123"})
Errors that carry a field and a code
The failure factories take plain strings, and that stays the short path. When the producer knows more than a sentence — a validator knows which field failed and which rule rejected it — say so, and it travels all the way to the caller's RFC 9457 problem document instead of being flattened into prose the caller has to parse:
from benzene.results import BenzeneError, Result
return Result.validation_error(
BenzeneError("sku is required", field="sku", code="missing"),
)
# → {"type": "https://benzene.app/problems/validation-error", "title": "Validation failed",
# "detail": "sku is required", "benzeneStatus": "validation-error",
# "errors": [{"message": "sku is required", "field": "sku", "code": "missing"}]}
Every factory takes strings and structured errors interchangeably, so mixing them is fine and
nothing needs a second *_with variant. benzene-pydantic's @validated emits these
automatically: pydantic already knows each error's location and rule, and they cross straight into
field and code.
Result.messages is the messages alone, for code that only ever wanted prose.
Two escape hatches sit alongside:
Result.problem(ProblemDetails(...))— an application-authored problem document, emitted verbatim, for a service that owns its own problem vocabulary and wants its owntypeURI on the wire rather than the registry URI Benzene would derive from the status.Result.set(status, payload, successful=...)— an application-defined status, stating whether it is a success (isSuccessfulis the only signal a receiver has for a status outside the vocabulary). For a vocabulary status it must agree with the status's class, or it raises.
Install just this layer if all you want is Benzene's result/status model (e.g. to type a domain service's return values) without any pipeline or transport code:
pip install benzene-results
Provides Result, BenzeneError, ProblemDetails, Status (the wire-contract status constants),
is_successful, and the SUCCESS_STATUSES / FAILURE_STATUSES / KNOWN_STATUSES sets. It contributes the benzene.results
subpackage to the shared benzene namespace. Mirrors .NET's Benzene.Results plus the status
vocabulary from Benzene.Abstractions.
Metadata
Release files for benzene-results 0.1.0b2
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 |
|---|---|---|---|---|
| benzene_results-0.1.0b2.tar.gz | 9.1 kB | With provenance | Details for benzene_results-0.1.0b2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| benzene_results-0.1.0b2-py3-none-any.whl | Python 3 | none | any | Details for benzene_results-0.1.0b2-py3-none-any.whl |
Total release size: 20.6 kB
Release files / benzene_results-0.1.0b2.tar.gz
| Download URL | benzene_results-0.1.0b2.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78d7b3b787bef9a5ceaf8711de6a43d38e3f4c6b4c13d50563c2cbba5835f5e6
|
|
BLAKE2b-256 checksum How to use checksums |
926bf39722ba592d09bba8d12ec364f9df98115dc48121da07631f3b27c074a8
|
| 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 logRelease files / benzene_results-0.1.0b2-py3-none-any.whl
| Download URL | benzene_results-0.1.0b2-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79bfa4bd9bdfa32f8f99fd6c8803a766f60d60c235e70ea8f39d967bda8bca56
|
|
BLAKE2b-256 checksum How to use checksums |
8355e98a10219c1eea3070831af4a6610d43242c6987e8619dfce7b534c75881
|
| 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 logSecurity for benzene-results 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.
Attestation for benzene_results-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 logA 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.