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.11.tar.gz
(11.5 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.11.tar.gz.
File metadata
- Download URL: strictprotocol-0.1.11.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd7113c43a64ee758e7a729b3a6e417205762562e08428647ba7b5b853d5be8e
|
|
| MD5 |
dcf5d5a2fbc52a33001ce2e5fbf6a6ad
|
|
| BLAKE2b-256 |
cf1068c43a88c3cd727b64b8d851c5a3b021ca553b3a24bfdc68ac312395444e
|
File details
Details for the file strictprotocol-0.1.11-py3-none-any.whl.
File metadata
- Download URL: strictprotocol-0.1.11-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 |
eaae96d943765be352b380e191436afa8b9214854c57635a2d8c238911971394
|
|
| MD5 |
9b86a9407773c802f80be7986cb5383e
|
|
| BLAKE2b-256 |
57a3cbc350ebf4ee2c00d63a67279b7f85b23a05cf957dcf28aeac484bbb007a
|