Skip to main content

Run custom checks on classes attributes when accessing them

Project description


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

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


Use the package manager pip to install readycheck:

pip install readycheck


  • Python ≥ 3.5


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.


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}


>>> 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.


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


This work is shared under the MIT license.

© 2022 Loïc Simon (

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

readycheck-1.0.1.tar.gz (6.1 kB view hashes)

Uploaded source

Built Distribution

readycheck-1.0.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded py3

Supported by

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