Pact: Attribute Enforcement Metaclass for Python
Pact is a lightweight Python metaclass designed to enforce the presence and types of class attributes in subclasses
It helps you ensure that all subclasses implement the required attributes declared in the base class,
catching missing or mistyped attributes early with warnings and exceptions
Features
- 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
Installation
You can install this package via PIP: pip install python-pact
Usage
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'
Metadata
Release files for python-pact 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_pact-0.1.1.tar.gz | 3.3 kB | Without provenance | Details for python_pact-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_pact-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for python_pact-0.1.1-py3-none-any.whl |
Total release size: 6.6 kB
Release files / python_pact-0.1.1.tar.gz
| Download URL | python_pact-0.1.1.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9886bb41d86fcc2b6956ce733e8510f427b96775fd2f3b708261fc80b31ed41
|
|
BLAKE2b-256 checksum How to use checksums |
70f8bc048b66f2e208823670bf92745ff6691f45fb84153a8fb0e28c01dabe52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Release files / python_pact-0.1.1-py3-none-any.whl
| Download URL | python_pact-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c030870d12597836c133b74a845e76ed013c84f610df2e7cea36dea5b17cd45
|
|
BLAKE2b-256 checksum How to use checksums |
18dc4df95a354cda8cdf66100d4f791828f7d6f4d16681226f57952692e277be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Security for python-pact 0.1.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.