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.7.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.7-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strictprotocol-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 cb87440e76561b7857ab6cfe8f242b898ca2efa7a2ab6154fd8a6f67b3ca62bf
MD5 d5a48a67f05c9420d0329dff4e9d618e
BLAKE2b-256 1d6707328803fd8e264b5395f7112486e52e1e6031baaa64816ed3f568190c95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strictprotocol-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 10.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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a684bdd6e52152ba4b5171aea60ae8d6a40a80977df9bf7bf1090855470bacde
MD5 77caa21e4aa6bedbbba6df572cb0a7d1
BLAKE2b-256 719a08701431d07fadb0660eb0cc046aa47e4cb6abb4d689b4fd62c81949ca18

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