Skip to main content

A framework for supporting MVC and observer patterns in Python

Project description

Orrery

PyPI - Version License Test lint Publish Docs

A framework for supporting MVC and observer patterns in Python

Install

pip install orrery

Update

pip install --update orrery

Documentation

Quick start

See the Tutorial page for more information

Create a model containing an initial value

from orrery.models import ValueModel
my_model = ValueModel(value=5)

Read or set the model value

my_model.value = 6
print(my_model.value)

Constant model:

from orrery.models import ConstantModel
my_model = ConstantModel(value=5)

Model containing a class (i.e. store without copying)

from orrery.models import ClassModel
my_object = MyClass()
my_model = ClassModel(my_object)

Check if a model has been given a value:

print(my_model.has_value())

Observe changes to a model:

class CallbackClass:
    def value_changed(self, model):
        print(f"New value: {model.value}")

callback_class = CallbackClass()
my_model.add_value_changed_listener(callback_class.value_changed)

Create a model which depends on other models:

from orrery.models import DependentModel, ValueModel

model_a = ValueModel(value=2)
model_b = ValueModel(value=3)
sum_model = DependentModel(
    dependencies=dict(model_a=model_a, model_b=model_b), 
    get_result=lambda dependencies: dependencies["model_a"].value + dependencies["model_b"].value
)
print(sum_model.value)

Source code

License

See license file

Copyright

© 2025 Code Choreography Limited

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

orrery-0.1.1.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

orrery-0.1.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file orrery-0.1.1.tar.gz.

File metadata

  • Download URL: orrery-0.1.1.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for orrery-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b960c9d1e7e47a91c5c0c4c91f0792fee48ab9bd43714615cfe42718cc1d7c9f
MD5 51f12236b70a42620f9cb634333c16ba
BLAKE2b-256 76ecf4dd30b5eaa0d8de90c4ec0d47d62ebb98dcede377a728f41225ced8ed1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for orrery-0.1.1.tar.gz:

Publisher: publish.yml on CodeChoreography/orrery

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orrery-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: orrery-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for orrery-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 774db8c88462b5088c974978c81ab63d5d772b9a4273839fc935335c871a9289
MD5 e5af6155bc20164fe3420d1947a80ddd
BLAKE2b-256 ef280585c3c60326bc9fb14c97cf0b3be9a2839359df6093f75131320f7d27c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for orrery-0.1.1-py3-none-any.whl:

Publisher: publish.yml on CodeChoreography/orrery

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page