Skip to main content

Python is a not typed language, and runs under the paradigm of first try and then it success or fails. This package allows you to have the capability of apply typing features in last versions of Python, allowing to the developer to have a transparent mechanism to grant that typing annotations are satisfied in the execution time of their programs.

Project description

safetypes package

Python is a non typed language, and runs under the paradigm of first try and then it success or fails. This package allows you to have the capability of apply typing features in last versions of Python, allowing to the developer to have a transparent mechanism to grant that typing annotations are satisfied in the execution time of their programs.

To use this package you only need to add an annotation before a function or method definition::

@safe_types
def my_func(test: str) -> int

With this simple line when you run your program the annotation checks:

  1. The test argument satisfies the condition to be a str.
  2. The return value satisfies the condition to be an int.

Also, you can use the Typing package to have multiple types for the same argument or to extend the detail of typing your code::

from typing import Union
@safe_types
def my_func(test: Union[int, float]) -> Union[int, float]

With this definition, the annotation checks if test argument and return value are one of two possible types: int and float. Note that not necessarily needs to be the same type in both cases, due to the annotation could not correlate a direct causality between arguments and return types.

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

safetypes-0.1rc1.post4.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

safetypes-0.1rc1.post4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file safetypes-0.1rc1.post4.tar.gz.

File metadata

  • Download URL: safetypes-0.1rc1.post4.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for safetypes-0.1rc1.post4.tar.gz
Algorithm Hash digest
SHA256 a4d22bedfc165cf922482ac841694570299f46bab5bbed122aaec8e61b66bd64
MD5 bb05d88b85f4123ecbc169e38b478a66
BLAKE2b-256 df69a0465413ad2d81c36ee3f97535d9cb4dda476a27b9758b371b10d55cd662

See more details on using hashes here.

File details

Details for the file safetypes-0.1rc1.post4-py3-none-any.whl.

File metadata

File hashes

Hashes for safetypes-0.1rc1.post4-py3-none-any.whl
Algorithm Hash digest
SHA256 962f7714144a29ecbfcf1a226c3147c7c3eef7c21504f4998962a6f49bdcec22
MD5 a3677dec69027ce7f2521d435769565c
BLAKE2b-256 517b99109f517e9616a2841dfe32753323e42ddcfe75921c05c32f0538ea84f2

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