Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

strictpy-1.0.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

strictpy-1.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

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

Hashes for strictpy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ad733c2dd78781281a9f1293b77d874e5a4f298267ee396de72f1907f49460b5
MD5 7f58708c6845986848416cf405d99fbf
BLAKE2b-256 20f2bb9443a3e6979f323a7e490fd0a72ff83107346b20b63e6c4c9e99655be8

See more details on using hashes here.

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

Hashes for strictpy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24af70c2160edc18a8d53ac0802759d1bc2b0c93fa33f20c9241bed5ab34dd0f
MD5 a1e79afd050f7d6b2d7f7b22e5325825
BLAKE2b-256 3a4210fb94362080b54272c4d39a59e80dd321848259a9d9e44ea3b74ae2a881

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