Skip to main content

readycheck

PyPI PyPI - Python Version PyPI - Wheel Read the Docs CircleCI

Python package providing utilities to check classes attributes when accessing it.

Installation

Use the package manager pip to install readycheck:

pip install readycheck

Dependencies

  • Python ≥ 3.5

Goal

The goal of this module is to allow to add custom checks when accessing class attributes.

It is designed to build classes that store objects not available at import time (e.g. later fetched from a distant service). It avoid us the pain to check if the connection has been established each time we need these objects: trying to access them will automagically raise an exception if they are not ready.

Usage

This package's main external API in the ReadyCheck class.

This class is not meant to be instantiated (see documentation for details), but to be subclassed using a custom check function:

from readycheck import ReadyCheck

class User(ReadyCheck, check_type=dict, check=lambda val: "name" in val):
    john = {"id": "<john_id>", "area": 2}
    jane = {"id": "<jane_id>", "area": 5}

Usage:

>>> User.john
Traceback (most recent call last):
  ...
readycheck.NotReadyError: 'john' is not ready yet!
>>> john_data = User.get_raw("john")
>>> User.john = some_lib.load_user(john_data)
>>> User.john
{'id': '<john id>', 'area': 2, 'name': 'John Doe', 'subscribed': False}

Read the docs for more information.

Contributing

Pull requests are welcome. Do not hesitate to get in touch with me (see below) for any question or suggestion about this project!

License

This work is shared under the MIT license.

© 2022 Loïc Simon (loic.simon@espci.org)

Metadata

Release files for readycheck 1.0.1

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

Source distribution (sdist)

Source distribution for readycheck 1.0.1
File Size Uploaded Provenance Actions
readycheck-1.0.1.tar.gz 6.1 kB Without provenance Details for readycheck-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 11.7 kB

Release files / readycheck-1.0.1.tar.gz

Download URL readycheck-1.0.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4a2c4aeb7a6f14a99e79698fbe218694d507b27faa623c4bfdc0fad722c2ffa0
BLAKE2b-256 checksum
How to use checksums
3b376cb3d94f4f0ad5c820ffecc148b53d5d7baf0a71a3cac42cb9af1b6a3c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Release files / readycheck-1.0.1-py3-none-any.whl

Download URL readycheck-1.0.1-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
812e903f48d6127f1cb71219e74bfdcb72c17f75d381cb7f3c9d05e54ae62a92
BLAKE2b-256 checksum
How to use checksums
2611c30bf55d39c034fc36cd946bef812cf78aa146e9c329bfd95210c9fa573b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.4

Security for readycheck 1.0.1

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

1.0.1 This release

2 release files 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