A stricter Protocol enforcement for Python
Project description
StrictProtocol
StrictProtocol is a lightweight runtime validation layer for Python's Protocol, enforcing exact method signature conformance at class definition time.
🔍 Features
- Enforces method existence and signature compliance for protocol implementations
- Catches missing or mismatched methods early—at class creation
- Drop-in compatible with
typing.Protocol
🚀 Example
from typing import Protocol
from strictprotocol import StrictProtocol
class Greeter(Protocol):
def greet(self, name: str) -> str: ...
class MyGreeter(StrictProtocol, Greeter):
def greet(self, name: str) -> str:
return f"Hello, {name}"
📦 Installation
pip install strictprotocol
🧪 Testing
To run tests:
pytest tests/
📄 License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
strictprotocol-0.1.10.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strictprotocol-0.1.10.tar.gz.
File metadata
- Download URL: strictprotocol-0.1.10.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3f353776a7d3cd28009e3f535710f702fca6724a3cebe1892d7c2e66f5157fd
|
|
| MD5 |
c5ad9bed6a7b8556497694ab53e29878
|
|
| BLAKE2b-256 |
258ec3e35ebcdf87a59d90d676f8c9ffb8f064fd52ae747694f07f6af843b32c
|
File details
Details for the file strictprotocol-0.1.10-py3-none-any.whl.
File metadata
- Download URL: strictprotocol-0.1.10-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dd179c2c2cc44aa02566ad17129bedfba3a9ffd307344abb6d787a0c2e63917
|
|
| MD5 |
2017112097d8b742e92e24189e591dc8
|
|
| BLAKE2b-256 |
0c7a4a47d18114501e5480749d65c22e7d0aa856ceca9a62f875d322a4ce5d35
|