maryada for Python
maryada provides outward-rounded binary64 intervals for CPython 3.11 and later.
An Interval is immutable. Arithmetic returns a new interval enclosing the
results of applying the operation to all defined input values.
from maryada import Interval
x = Interval.parse("[0.1, 0.2]")
y = 2 * x + 1
assert 1.25 in y
assert Interval.parse(y.to_text()) == y
print(y.bounds)
Interval(lower, upper) takes the binary64 values Python passes.
Interval.parse("[0.1, 0.2]") rounds the exact decimal endpoints outward.
Interval.point(value) constructs a finite singleton, and
Interval.from_mid_radius(midpoint, radius) rounds the computed endpoints
outward. Construction and scalar arithmetic accept floats and integers that
fit exactly in binary64. An integer that would round raises OverflowError.
Membership tests compare integers exactly, including integers larger than
binary64 can represent.
Invalid bounds raise IntervalConstructionError. Invalid interval text or
text with ambiguous endpoint order raises IntervalParseError. Both exceptions
are subclasses of ValueError. A valid empty set is represented by
Interval.empty(). For example, Interval(-2, -1).sqrt() is empty because
the input has no nonnegative members. Interval.entire() represents all real
numbers.
IntervalParseError.kind is an IntervalParseErrorKind enum member.
byte_offset is a zero-based UTF-8 byte offset into the original text.
For a rejected ambiguous ordering, the kind is POSSIBLY_UNDEFINED and
the offset is None. Both real interval types expose these diagnostics.
Call alternate constructors on the class, for example Interval.point(3),
Interval.parse("..."), and Interval.from_bytes(data). They use Python's
static method lookup, so CPython's REPL can also suggest them on instances.
Scalar operations
- Use properties such as
bounds,midpoint,width,radius, andmagnitudeto inspect an interval. The constantsInterval.ZERO,Interval.ONE,Interval.PI,Interval.TAU,Interval.E, andInterval.LN_2are ready to use. - Arithmetic includes
**,square(), and fusedmul_add(), together with the Rust scalar elementary functions and pointwise rounding operations. Integer**uses the signed 32-bit integer-power operation. Float and interval exponents use the general power enclosure. - Comparisons use set inclusion. For example,
x <= ymeans every point inxbelongs toy. Useintersection(),hull(), orbisect()to construct related enclosures. - Dividing through zero can give two disjoint pieces. Use
div_split()orreciprocal_split()to get a tuple containing the individual components.Interval.sum(terms)andInterval.dot(left, right)use the Rust exact accumulation routines. to_bytes()andInterval.from_bytes()round-trip the exact IEEE binary encoding.to_decimal(digits, notation=...)formats an outward-rounded decimal enclosure.Interval.parse_checked(text)returns the parsed interval and a boolean indicating ambiguous endpoint order.
Use to_text() for an exact hexadecimal literal, repr(interval) for a Python
constructor expression, and str(interval) for display.
Bare interval equality compares sets. Use in for point membership or interval
containment. For intervals, a in b is equivalent to a.subset(b), including
when both intervals are equal or a is empty.
The weighted-sum example uses Interval.dot()
to check a budget against uncertain usage and prints the exact interval
literal for storage. Run it from the checkout after installing the package.
python bindings/python/examples/weighted_sum.py
Decorated intervals
DecoratedInterval provides the same scalar operations and carries an IEEE 1788
decoration that records definedness and continuity. The Decoration enum runs
from weakest to strongest as ILL, TRV, DEF, DAC, and COM.
from maryada import DecoratedInterval, Decoration, Interval
x = DecoratedInterval(-1, 4)
assert x.sqrt().decoration is Decoration.TRV
y = Interval(1, 2).decorate(Decoration.DEF)
assert (1 + y).decoration is Decoration.DEF
assert y.interval == Interval(1, 2)
In mixed arithmetic, a bare operand gets its strongest valid decoration and the result is decorated. Equality between decorated values compares both bounds and decoration. Membership compares the represented sets.
DecoratedInterval.empty() represents the empty set, and
DecoratedInterval.nai() represents Not an Interval. NaI propagates through
arithmetic and raises IntervalConstructionError when you access .interval.
Exact text and binary round-trips preserve the decoration and both special
values.
Complex enclosures
ComplexBox encloses independent real and imaginary intervals.
ComplexDisk encloses values within a radius of a complex center. Both
support complex arithmetic, elementary functions, modulus and argument
bounds, and set containment. Use abs(z) for a real interval enclosing the
modulus.
Both types accept finite binary64 complex points in arithmetic and membership
tests. Box arithmetic also accepts a bare Interval along the real axis.
a in b checks inclusive containment for two boxes or two disks.
from maryada import ComplexBox, ComplexDisk, Interval
box = ComplexBox(Interval(1, 2), Interval(-1, 1))
assert 1.5 + 0.5j in box
assert box in box.to_disk().to_box()
disk = ComplexDisk(1 + 0j, 0.4375)
assert 0j in disk * disk
assert 0j not in disk.mul_recentered(disk)
Use to_box() for a disk's rectangular hull and to_disk() for a box's
enclosing disk. Both conversions can widen the enclosure. A proper
unbounded box or an overflowing radius raises ComplexDiskError.
Ordinary disk multiplication uses the fixed-center product.
mul_recentered() spends extra work to try a smaller radius.
Rust method names
sqr(), recip(), and powi() are aliases for square(), reciprocal(),
and pown(). Complex enclosures also support conj() for conjugate().
Real intervals support recip_split() and from_mid_rad() alongside
reciprocal_split() and from_mid_radius().
Rust inspection methods such as inf(), mid(), and wid() correspond
to Python properties such as lower, midpoint, and width.
Develop
From the repository root, use uv to install the package and test dependencies into a virtual environment.
uv venv
uv pip install -e . --group test
uv run --no-project pytest
uv run --no-project ty check
uv run --no-project ruff check bindings/python
uv run --no-project ruff format --check bindings/python
The package ships typing information through py.typed and the
_native.pyi stub. Update the stub alongside changes to the public extension
interface.
Metadata
Release files for maryada 0.3.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 |
|---|---|---|---|---|
| maryada-0.3.0.tar.gz | 238.3 kB | With provenance | Details for maryada-0.3.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| maryada-0.3.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for maryada-0.3.0-cp311-abi3-win_amd64.whl |
| maryada-0.3.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for maryada-0.3.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| maryada-0.3.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for maryada-0.3.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| maryada-0.3.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for maryada-0.3.0-cp311-abi3-macosx_11_0_arm64.whl |
| maryada-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for maryada-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 2.7 MB
Release files / maryada-0.3.0.tar.gz
| Download URL | maryada-0.3.0.tar.gz |
|---|---|
| Size | 238.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d93fa3955e3219df15d0803428a1ce0c82e64614e582da01bad1363616a4d96b
|
|
BLAKE2b-256 checksum How to use checksums |
9392d12bc86a28b2062adc431d979cbe5af2c0f880662bb9009c5013cbd77af1
|
| 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 26, 2026.
Transparency logRelease files / maryada-0.3.0-cp311-abi3-win_amd64.whl
| Download URL | maryada-0.3.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 375.7 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
453d5fa04c757dbdce663fbc0b946e5a727a6d2783a312fda5636a835c469da0
|
|
BLAKE2b-256 checksum How to use checksums |
7ebc14c924afcd8b0286f08ea9f91748fc7300d5ffde0b48fb7cef2a2b26c284
|
| 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 26, 2026.
Transparency logRelease files / maryada-0.3.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | maryada-0.3.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 556.8 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
89f99c018d2ca0ffdc4e68512169cee498aa1838089c9bfa767ed9ae982556f7
|
|
BLAKE2b-256 checksum How to use checksums |
87cf92b97a34d288daac8897a222c5f2bb3136688a27235c62983babf4c4dbcd
|
| 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 26, 2026.
Transparency logRelease files / maryada-0.3.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | maryada-0.3.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 536.5 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
402b9446b5d025f577e0ed90756fb2aee7e3e31e6427109e8aac4bf95b6afe9a
|
|
BLAKE2b-256 checksum How to use checksums |
6f662dd6522c1127e2f6a82a14b5be96c653a46ed342bcff6ec7ee6b01bd3fc2
|
| 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 26, 2026.
Transparency logRelease files / maryada-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | maryada-0.3.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 503.0 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9802eb6863d0a22e6f4d1fc1f37de36cd41e6a188e351b94239e2b41ff46f865
|
|
BLAKE2b-256 checksum How to use checksums |
cf67679f5d0a13ff0c4b87152ae56ccb2dc35546326e5e2c41dae19ce2f59d0a
|
| 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 26, 2026.
Transparency logRelease files / maryada-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | maryada-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 514.2 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1eafc2a81cffd837fc0ffcc0475e2c95da065b942b824ece6032d92cdfd52b0c
|
|
BLAKE2b-256 checksum How to use checksums |
e155ac92b410037d497ba7494261f1ea7d95fa53ff934902c5742a2499782cbe
|
| 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 26, 2026.
Transparency logSecurity for maryada 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
All 6 files in this release have been uploaded with provenance metadata.
Attestation for maryada-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 26, 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.