strictpy 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 strictpy 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 strictpy
📂 Project Structure
strictpy/
├── 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!
- Fork the repo
- Create a new branch
- Make changes
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stricty-0.1.1.tar.gz.
File metadata
- Download URL: stricty-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a0afdb442cc637b484cd557003fda0f7fd14a4b3fefce0760b45835335621b0
|
|
| MD5 |
9018280958f023e7ea51eb2354ed4e78
|
|
| BLAKE2b-256 |
324a7589891a4ad91d5d6cb4756179e854a290714715397056dd30aeb6e1fffd
|
File details
Details for the file stricty-0.1.1-py3-none-any.whl.
File metadata
- Download URL: stricty-0.1.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e51da3acd15dbde20ad1b2057f85b3852c1fc809d2147ed0791f81f49b6333b6
|
|
| MD5 |
edafb0c5966985d7d425650cf6274f51
|
|
| BLAKE2b-256 |
a0443c963f0de9e451363838b8e9f3edce6035d759d0089ad4b7cb8e3731274b
|