Skip to main content

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


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.4.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strictprotocol-0.1.4-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file strictprotocol-0.1.4.tar.gz.

File metadata

  • Download URL: strictprotocol-0.1.4.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for strictprotocol-0.1.4.tar.gz
Algorithm Hash digest
SHA256 223d9de606b7101b0e7987f2f2f1f48b4ca934c09289ae73ab6c742f45720176
MD5 6da053f8a9478b2010561fbb80f1aa14
BLAKE2b-256 8715d288f0b4248d3c52ab116d93a09439a5324865df85e499848d263e01df24

See more details on using hashes here.

File details

Details for the file strictprotocol-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: strictprotocol-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for strictprotocol-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d4541c917e017a2606a1894584ffe299f534a56902e007012577c915f1d604ef
MD5 292d5f69ad4c072d934cc7db3c5f35dc
BLAKE2b-256 cfbb2fd5ab283c8b48105234fa9848e98892a85f2083fadcf1250050eb1a1824

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page