python-pact


Namepython-pact JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA lightweight Python metaclass for enforcing required attributes and types in class hierarchies
upload_time2025-07-11 21:10:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT
keywords python-pact pact
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## <ins> Pact: Attribute Enforcement Metaclass for Python </ins>

Pact is a lightweight Python metaclass designed to enforce the presence and types of class attributes in subclasses <br>
It helps you ensure that all subclasses implement the required attributes declared in the base class, <br>
catching missing or mistyped attributes early with warnings and exceptions <br>

### <ins> Features </ins>

- Enforce presence of specific class or instance attributes in subclasses
- Type validation of annotated attributes
- Raises PactException exception and emits warnings for missing or mismatched attributes

### <ins> Installation </ins>

You can install this package via PIP: pip install python-pact

### <ins> Usage </ins>

```python
from pact import Pact


class Person(Pact):
    name: str
    age: int


class JohnDoe(Person):
    name = 'John Doe'
    age = 25


# This will raise PactException due to missing 'age':
class JaneDoe(Person):
    name = 'Jane Doe'
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-pact",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "python-pact, pact",
    "author": null,
    "author_email": "Omer Menashe <unspecified@mail.com>",
    "download_url": "https://files.pythonhosted.org/packages/70/f8/bc048b66f2e208823670bf92745ff6691f45fb84153a8fb0e28c01dabe52/python_pact-0.1.1.tar.gz",
    "platform": null,
    "description": "## <ins> Pact: Attribute Enforcement Metaclass for Python </ins>\r\n\r\nPact is a lightweight Python metaclass designed to enforce the presence and types of class attributes in subclasses <br>\r\nIt helps you ensure that all subclasses implement the required attributes declared in the base class, <br>\r\ncatching missing or mistyped attributes early with warnings and exceptions <br>\r\n\r\n### <ins> Features </ins>\r\n\r\n- Enforce presence of specific class or instance attributes in subclasses\r\n- Type validation of annotated attributes\r\n- Raises PactException exception and emits warnings for missing or mismatched attributes\r\n\r\n### <ins> Installation </ins>\r\n\r\nYou can install this package via PIP: pip install python-pact\r\n\r\n### <ins> Usage </ins>\r\n\r\n```python\r\nfrom pact import Pact\r\n\r\n\r\nclass Person(Pact):\r\n    name: str\r\n    age: int\r\n\r\n\r\nclass JohnDoe(Person):\r\n    name = 'John Doe'\r\n    age = 25\r\n\r\n\r\n# This will raise PactException due to missing 'age':\r\nclass JaneDoe(Person):\r\n    name = 'Jane Doe'\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A lightweight Python metaclass for enforcing required attributes and types in class hierarchies",
    "version": "0.1.1",
    "project_urls": {
        "Source": "https://github.com/iamomerm/python-pact"
    },
    "split_keywords": [
        "python-pact",
        " pact"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "18dc4df95a354cda8cdf66100d4f791828f7d6f4d16681226f57952692e277be",
                "md5": "64fb09f520a72af966e305e5a6a6d784",
                "sha256": "9c030870d12597836c133b74a845e76ed013c84f610df2e7cea36dea5b17cd45"
            },
            "downloads": -1,
            "filename": "python_pact-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64fb09f520a72af966e305e5a6a6d784",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3295,
            "upload_time": "2025-07-11T21:10:24",
            "upload_time_iso_8601": "2025-07-11T21:10:24.064917Z",
            "url": "https://files.pythonhosted.org/packages/18/dc/4df95a354cda8cdf66100d4f791828f7d6f4d16681226f57952692e277be/python_pact-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "70f8bc048b66f2e208823670bf92745ff6691f45fb84153a8fb0e28c01dabe52",
                "md5": "750791780788ce5987c9d19d1e2115c8",
                "sha256": "e9886bb41d86fcc2b6956ce733e8510f427b96775fd2f3b708261fc80b31ed41"
            },
            "downloads": -1,
            "filename": "python_pact-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "750791780788ce5987c9d19d1e2115c8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3322,
            "upload_time": "2025-07-11T21:10:25",
            "upload_time_iso_8601": "2025-07-11T21:10:25.365570Z",
            "url": "https://files.pythonhosted.org/packages/70/f8/bc048b66f2e208823670bf92745ff6691f45fb84153a8fb0e28c01dabe52/python_pact-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-11 21:10:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iamomerm",
    "github_project": "python-pact",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-pact"
}
        
Elapsed time: 1.33655s