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.6.tar.gz (11.3 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.6-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strictprotocol-0.1.6.tar.gz
  • Upload date:
  • Size: 11.3 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.6.tar.gz
Algorithm Hash digest
SHA256 ca335e196e37697495fd332fc8f3388ad742d25146ceb40abb23cf59bfe2fb53
MD5 a2abf0249126370a90c78cc68167e0bb
BLAKE2b-256 17418cc96db36fe7583625abccd9cecfc69903c230127baa079624b7a6b15e34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strictprotocol-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 acf8d4d29b5d0acfb4b433e968d5ec60823190f05197b7ff63b35512d248acc0
MD5 d1c503b931ec489f8e3ea50a4d06cf0c
BLAKE2b-256 780e4ae7e59447b8efe73e2f9d9337a8415104e3736a979a6b2b8dd4eecbcc0d

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