{"id":29258045,"url":"https://github.com/genesiscoast/conditions-py","last_synced_at":"2025-07-04T05:09:47.061Z","repository":{"id":57417515,"uuid":"198813703","full_name":"GenesisCoast/conditions-py","owner":"GenesisCoast","description":"Conditions libary for Python 3+","archived":false,"fork":false,"pushed_at":"2019-11-14T14:12:44.000Z","size":168,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-03T01:18:54.355Z","etag":null,"topics":["assertions","conditional","conditional-statements","conditionals","conditions","fluent-assertions","fluent-validation","fluentvalidation","libary","python","python-3","python3","validation","validators"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GenesisCoast.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-07-25T10:52:51.000Z","updated_at":"2019-11-14T14:12:46.000Z","dependencies_parsed_at":"2022-09-17T22:01:58.734Z","dependency_job_id":null,"html_url":"https://github.com/GenesisCoast/conditions-py","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GenesisCoast/conditions-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenesisCoast%2Fconditions-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenesisCoast%2Fconditions-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenesisCoast%2Fconditions-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenesisCoast%2Fconditions-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GenesisCoast","download_url":"https://codeload.github.com/GenesisCoast/conditions-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GenesisCoast%2Fconditions-py/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263450009,"owners_count":23468154,"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":["assertions","conditional","conditional-statements","conditionals","conditions","fluent-assertions","fluent-validation","fluentvalidation","libary","python","python-3","python3","validation","validators"],"created_at":"2025-07-04T05:09:45.925Z","updated_at":"2025-07-04T05:09:47.049Z","avatar_url":"https://github.com/GenesisCoast.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Image\" src=\"https://i.imgur.com/XSacNPD.png?2\"/\u003e\n\u003c/p\u003e\n\n[![Build Status](https://travis-ci.org/GenesisCoast/conditions-py.svg?branch=master)](https://travis-ci.org/GenesisCoast/conditions-py) [![codecov](https://codecov.io/gh/GenesisCoast/conditions-py/branch/master/graph/badge.svg)](https://codecov.io/gh/GenesisCoast/conditions-py) [![PyPI version](https://badge.fury.io/py/conditions-py.svg)](https://badge.fury.io/py/conditions-py)\n\n# Conditions-PY\n\nConditions is a Python port of the famous .NET library [Conditions](https://github.com/ghuntley/conditions) which helps developers write pre- and postcondition validations in a fluent manner. Writing these validations is easy and it improves the readability and maintainability of code.\n\n## Contents\n- [Installation](#installation) \n- [Conditions](#conditions)\n- [Tests](#tests)\n- [Examples](#examples)\n- [Acknowledgements](#acknowledgements)\n\n## Installation\n\nInstallation is done via PIP:\n\n    pip install conditions-py\n\n## Conditions\n\nA full list of all the available conditions can be found in the [Wiki](https://github.com/GenesisCoast/conditions-py/wiki).\n\n## Tests\n\nCurrently both unit and integration tests are written using the `pytest` library. Execution of tests in Visual Studio Code is performed using the `pytest` test runner.\n\n## Examples\n\n```python\nimport conditions_py\n\n\ndef speak(message: str):\n    Condition\\\n        .requires_str(message, 'message')\\\n        .is_not_null_or_whitespace()\n\n    # Do speaking...\n\n\ndef multiple(left: int, right: int):\n    Condition\\\n        .requires_num(left, 'left')\\\n        .is_positive()\n\n    Condition\\\n        .requires_num(right, 'right')\\\n        .is_greater_than(4)\n        \n    # Do multiplication\n    \n    \ndef is_true(value: bool):\n    Condition\\\n        .requires_bool(value, 'value')\\\n        .is_true()\n        \n    # Do other stuff\n    \n    \ndef animals(dog: object, cat: object):\n    Condition\\\n        .requires_obj(dog, 'dog')\\\n        .is_not_null()\n        \n    Condition\\\n        .requires_obj(cat, 'cat')\\\n        .is_null()\n        \n    # Do other stuff\n```\n\nA particular validation is executed immediately when it's method is called, and therefore all checks are executed in the order in which they are written:\n\n## Acknowledgements\n\n- The icon \"\u003ca href=\"http://thenounproject.com/term/tornado/2706/\" target=\"_blank\"\u003eTornado\u003c/a\u003e\" designed by \u003ca href=\"http://thenounproject.com/adamwhitcroft/\" target=\"_blank\"\u003eAdam Whitcroft\u003c/a\u003e from The Noun Project.\n- \u003ca href=\"https://github.com/ghuntley\"\u003eGeoffrey Huntley (ghuntley)\u003c/a\u003e who is the original author of \"\u003ca href=\"https://github.com/ghuntley/conditions\"\u003eConditions\u003c/a\u003e\" from which this project was based on.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenesiscoast%2Fconditions-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenesiscoast%2Fconditions-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenesiscoast%2Fconditions-py/lists"}