This is a simple decorator that will allow you to implement strict type checking in your everyday cPython functions based on the type hint of the function parameters.
Project description
Strictpy
This library provides a simple decorator that allows you to enforce strict type checking in you everyday cPython functions based on the type hint of the function parameters.
The usage is pretty simple and intuitive. We just need to have our functions
decorated with @strict.
Let's start with simple example where the function does not have any type hints:
from strictpy import strict
@strict
def some_function(x, y):
return x * y
This will raise an error called TypeHintMissingError with detailed message of what is expected.
If we now rewrite the function this way, it will run as usual:
from strictpy import strict
@strict
def some_function(x: int, y: int) -> int:
return x * y
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 strictpy-1.0.0.tar.gz.
File metadata
- Download URL: strictpy-1.0.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad733c2dd78781281a9f1293b77d874e5a4f298267ee396de72f1907f49460b5
|
|
| MD5 |
7f58708c6845986848416cf405d99fbf
|
|
| BLAKE2b-256 |
20f2bb9443a3e6979f323a7e490fd0a72ff83107346b20b63e6c4c9e99655be8
|
File details
Details for the file strictpy-1.0.0-py3-none-any.whl.
File metadata
- Download URL: strictpy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24af70c2160edc18a8d53ac0802759d1bc2b0c93fa33f20c9241bed5ab34dd0f
|
|
| MD5 |
a1e79afd050f7d6b2d7f7b22e5325825
|
|
| BLAKE2b-256 |
3a4210fb94362080b54272c4d39a59e80dd321848259a9d9e44ea3b74ae2a881
|