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

📖 Documentation

Coming soon at https://github.com/YOUR_USERNAME/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.0.tar.gz (5.6 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.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strictprotocol-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 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.0.tar.gz
Algorithm Hash digest
SHA256 f597f15789e336acb1f4a2ad756d712b7e6ace9ba038912a1ce6cce593590ea5
MD5 4ac5eef453ce5ecf92953220ffdf228b
BLAKE2b-256 11d29ee30890986513f0b725b7434e3117078f5e0c05a2cec36451ef4c8658a9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strictprotocol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fb38561251d0f1364f508fd7f4d1b78ce2811c4024e55dca2a33484d2b3727f
MD5 76df2e3c4091f352d7ccdeddcbd69e76
BLAKE2b-256 73a4797fe7795f84d22b5e5d7fc92eb3744cb4eb5ef80b1b733c541ba58d7cc2

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