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.1.tar.gz (10.7 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.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strictprotocol-0.1.1.tar.gz
  • Upload date:
  • Size: 10.7 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.1.tar.gz
Algorithm Hash digest
SHA256 0ac260b468dd54667aad813ee3ed4e130cdd8da2cb622f98512a0a87f48e779e
MD5 e3c869cf0b676b2578e695d2f9756879
BLAKE2b-256 69770c5e14e80bd8d5dc28b58b226fa875146040d799b2f22c1bc49b4d22bf18

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strictprotocol-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef0a8c9eb48e9d4276e9181037f8bf31bf7f66f196060a71d0b59a00687beed6
MD5 4a7542b839877832b6ed9cbf2a66d73a
BLAKE2b-256 e2c8b40414a2906d19be61516cc241c2e6676bc2335b5883e1ce0f2b7841c798

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