Skip to main content
Pre-release

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

observable

Observable fields with conversion, access policies, and change notifications. Requires Python 3.13 or newer.

Installation

Install the sg-observable package from PyPI:

python -m pip install sg-observable

Pip also installs its dependencies: sg-metacore from PyPI and NumPy.

Usage

from observable.observable import Observable, ObservableField, auto_field

class Counter(Observable):
    value: ObservableField[int, str] = auto_field(default=0)

counter = Counter()
counter.value = "42"       # Writes accept str and convert to int.
assert counter.value == 42 # Reads return int.

Runtime and typing

src/observable/observable.py contains the implementation and its public type annotations, including descriptor overloads and the types of field decorators.

auto_field() is intended for annotated declarations in an Observable class. At runtime it returns an AutoField configuration that the metaclass replaces with an ObservableField. Its return annotation describes that resulting descriptor, with a localized cast in the factory to account for the metaclass transformation and preserve the field's read and write types. Use AutoField directly when working with a configuration outside a class body.

The wheel includes a py.typed marker so type checkers use the annotations in the implementation. Existing comments and TODOs remain in the implementation.

Development

From the observable project directory, install the development dependencies and run the checks. MetaCore is installed as the sg-metacore PyPI dependency.

python -m pip install -e ".[dev]"
python -m pyright --project pyproject.toml
python -m pytest

The tests cover runtime behavior and rejected type errors. Static examples under tests/typing/ verify descriptor inference and callback signatures.

Metadata

Release files for sg-observable 0.1.0a0

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

Source distribution (sdist)

Source distribution for sg-observable 0.1.0a0
File Size Uploaded Provenance Actions
sg_observable-0.1.0a0.tar.gz 11.6 kB Without provenance Details for sg_observable-0.1.0a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sg-observable 0.1.0a0
File Interpreter ABI Platform Actions
sg_observable-0.1.0a0-py3-none-any.whl Python 3 none any Details for sg_observable-0.1.0a0-py3-none-any.whl

Total release size: 20.0 kB

Release files / sg_observable-0.1.0a0.tar.gz

Download URL sg_observable-0.1.0a0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ff9a8d6560d3055519a15eb7e8096d798c4ef01fbfbf170b6b92782b0d0e4a85
BLAKE2b-256 checksum
How to use checksums
ad76babed7a2e7c8f706c72ad3abc8209fbbabc43a5310983d9f6f571842dc50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / sg_observable-0.1.0a0-py3-none-any.whl

Download URL sg_observable-0.1.0a0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2549c4fcfe46e133fde3b3b0a990a1b972b8922e9c486e9b8b2294f06ff0a126
BLAKE2b-256 checksum
How to use checksums
6a01489ab7e7b9eb1663378b87c63d1aab9fb55f13e15021c9185075a5f7e947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for sg-observable 0.1.0a0

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.

Release history Release notifications | RSS feed

This release
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