{"id":23537652,"url":"https://github.com/loic-simon/readycheck","last_synced_at":"2025-05-15T00:21:40.961Z","repository":{"id":40476770,"uuid":"489079588","full_name":"loic-simon/readycheck","owner":"loic-simon","description":"Run custom checks on classes attributes when accessing them","archived":false,"fork":false,"pushed_at":"2022-05-05T22:48:00.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T12:47:27.807Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loic-simon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-05T18:10:25.000Z","updated_at":"2022-05-05T21:32:46.000Z","dependencies_parsed_at":"2022-08-09T21:31:30.101Z","dependency_job_id":null,"html_url":"https://github.com/loic-simon/readycheck","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loic-simon%2Freadycheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loic-simon%2Freadycheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loic-simon%2Freadycheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loic-simon%2Freadycheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loic-simon","download_url":"https://codeload.github.com/loic-simon/readycheck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239250584,"owners_count":19607490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T03:17:10.186Z","updated_at":"2025-02-17T07:26:36.246Z","avatar_url":"https://github.com/loic-simon.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# readycheck\r\n[![PyPI](https://img.shields.io/pypi/v/readycheck)](https://pypi.org/project/readycheck)\r\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/readycheck)](https://pypi.org/project/readycheck)\r\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/readycheck)](https://pypi.org/project/readycheck)\r\n[![Read the Docs](https://img.shields.io/readthedocs/readycheck)](https://readycheck.readthedocs.io)\r\n[![CircleCI](https://img.shields.io/circleci/build/github/loic-simon/readycheck)](https://app.circleci.com/pipelines/github/loic-simon/readycheck)\r\n\r\nPython package providing utilities to check classes attributes when accessing it.\r\n\r\n\r\n## Installation\r\n\r\nUse the package manager [pip](https://pypi.org/project/pip) to install readycheck:\r\n```bash\r\npip install readycheck\r\n```\r\n\r\n### Dependencies\r\n\r\n* Python **≥ 3.5**\r\n\r\n\r\n## Goal\r\n\r\nThe goal of this module is to allow to add custom checks when accessing class\r\nattributes.\r\n\r\nIt is designed to build classes that store objects not available at import time\r\n(e.g. later fetched from a distant service).  It avoid us the pain to check if\r\nthe connection has been established each time we need these objects: trying to\r\naccess them will automagically raise an exception if they are not ready.\r\n\r\n\r\n## Usage\r\n\r\nThis package's main external API in the **`ReadyCheck`** class.\r\n\r\nThis class is **not meant** to be instantiated (see documentation for details),\r\nbut to be subclassed using a custom check function:\r\n\r\n```py\r\nfrom readycheck import ReadyCheck\r\n\r\nclass User(ReadyCheck, check_type=dict, check=lambda val: \"name\" in val):\r\n    john = {\"id\": \"\u003cjohn_id\u003e\", \"area\": 2}\r\n    jane = {\"id\": \"\u003cjane_id\u003e\", \"area\": 5}\r\n```\r\n\r\nUsage:\r\n\r\n```\r\n\u003e\u003e\u003e User.john\r\nTraceback (most recent call last):\r\n  ...\r\nreadycheck.NotReadyError: 'john' is not ready yet!\r\n\u003e\u003e\u003e john_data = User.get_raw(\"john\")\r\n\u003e\u003e\u003e User.john = some_lib.load_user(john_data)\r\n\u003e\u003e\u003e User.john\r\n{'id': '\u003cjohn id\u003e', 'area': 2, 'name': 'John Doe', 'subscribed': False}\r\n```\r\n\r\nRead [the docs](https://readycheck.readthedocs.io) for more information.\r\n\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. Do not hesitate to get in touch with me (see below)\r\nfor any question or suggestion about this project!\r\n\r\n\r\n## License\r\n\r\nThis work is shared under [the MIT license](LICENSE).\r\n\r\n© 2022 Loïc Simon ([loic.simon@espci.org](mailto:loic.simon@espci.org))\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floic-simon%2Freadycheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floic-simon%2Freadycheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floic-simon%2Freadycheck/lists"}