Skip to main content

stricty runtime type enforcement for Python — no coercion, no surprises.

Project description

🚀 Stricty

Strict runtime type enforcement for Python — no coercion, no surprises.

Stricty makes Python behave more like C/C++ when it comes to type safety. It enforces exact type matching for function arguments and return values at runtime.


✨ Features

  • ✅ Strict function argument validation
  • ✅ Return type enforcement
  • ❌ No implicit type conversion
  • ⚡ Lightweight and fast
  • 🧠 Clear, developer-friendly error messages

🔥 Why Stricty?

Python is dynamically typed:

def add(x: int, y: int):
    return x + y

add("1", 2)  # ❌ No error by default

Stricty enforces fail-fast behavior:

from stricty import strict

@strict
def add(x: int, y: int) -> int:
    return x + y

add(1, 2)        # ✅ 3
add("1", 2)      # ❌ StrictTypeError

🧪 Return Type Enforcement

@strict
def get_number() -> int:
    return "10"   # ❌ Error

⚠️ Philosophy

Stricty follows a simple rule:

"Wrong type? Fail immediately."

No:

  • silent conversions
  • hidden bugs
  • unexpected behavior

🆚 Comparison

Feature Stricty Pydantic mypy
Runtime validation
Strict (no coercion)
Return enforcement ⚠️ manual
Lightweight

📦 Installation

pip install stricty

📂 Project Structure

stricty/
├── decorator.py
├── validator.py
├── errors.py

🚀 Roadmap

v1

  • Argument validation
  • Return validation
  • Custom errors

v2

  • Support for List, Dict, Optional
  • Better error messages
  • Config system

v3

  • Django / API integration
  • Performance optimizations

🤝 Contributing

Contributions are welcome!

  1. Fork the repo
  2. Create a new branch
  3. Make changes
  4. Submit a PR

📜 License

This project is licensed under the MIT License.


💡 Author

Backend-focused developer building reliable and predictable systems.


⭐ Final Thought

Python is flexible. Stricty makes it predictable.

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

stricty-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

stricty-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file stricty-1.0.0.tar.gz.

File metadata

  • Download URL: stricty-1.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for stricty-1.0.0.tar.gz
Algorithm Hash digest
SHA256 95ef5e6ec657bc2fcb57efde5e4dad0e134d4b1431cc6fd2309b068fff55f689
MD5 9295fa766a308d413be1e580712f6189
BLAKE2b-256 c11c66e5d3ef6a3db55939c2030e697343aef313079b484a0187dd0fd6f76e6e

See more details on using hashes here.

File details

Details for the file stricty-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: stricty-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for stricty-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c678b695e919118d6564a9634c310077aa1b60d8f0498611cb57cb6aefca558
MD5 e9828d997d82b6672859b005d7c26bbf
BLAKE2b-256 331aa13d6498665416bfb72677b9af62112578414a088535125e246ef32b18b4

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