Skip to main content

peepy

A simple Observer Pattern implementation with decorators

Installation

Simply instasll from pypi:

pip3 install peepy

Usage

Observables can be connected to bserver callbacks siply by callling the bind_to method or by using the observe, observe_dict and observer_function decorators

from peepy.Observables import Observable, ObservableDict, observe, observe_dict

foo = Observable('important object')
foo2 = Observable('important object 2')

@observe(foo, foo2)
def observer(label, old, new):
    print('Changing {0}\'s value from {1} to {2}'.format(label, old, new))

foo.value = 'bar'
foo.value = 'baz'

foo2.value = foo

foo_dict = ObservableDict({'foo': 1, 'bar':{}})

@foo_dict.observer_function
def dict_observer(label, old, new):
    print('Changing key {0} from {1} to {2}'.format(label, old, new))

foo_dict['foo'] = 2
foo_dict['foo2'] = 20
foo_dict['bar'] = {'baz':None}

Metadata

Release files for peepy 0.0.2

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

Built distribution (wheel)

Table of built distributions (wheels) for peepy 0.0.2
File Interpreter ABI Platform Actions
peepy-0.0.2-py3-none-any.whl Python 3 none any Details for peepy-0.0.2-py3-none-any.whl

Release files / peepy-0.0.2-py3-none-any.whl

Download URL peepy-0.0.2-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef330da3c830c7b43ccdcb370d01d18805f77e34d6d82323fb730a8496332523
BLAKE2b-256 checksum
How to use checksums
40ee597cd5955ce4fbbe3a2ae26b3c3c7446fd71d568636399306e8f5a41b3a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.5

Security for peepy 0.0.2

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

0.0.2 This release

1 release file No provenance

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