Skip to main content

A non intrusive and optional *type checking for Python 3* using annotations

Project description

This package implements a non intrusive and optional type checking in functions and methods by using annotations. Once types are defined in annotations, no changes are required to make the verification of types. And, because it is completely optional, it can be used only in the desired environments, like unit testings. This way, the performance of production code is not affected.

Learn more in:

https://bitbucket.org/carlopires/optypecheck

Installation

pip3 install optypecheck

Example

def gencode(a: bytes, b: str) -> str:
    return '{}{}'.format(a[0], b)

def valid_number(n) -> 'decimal.Decimal':
    return n

# enable type checking in DEBUG mode
assert __import__('typecheck').typecheck(__name__)

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

optypecheck-16.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file optypecheck-16.tar.gz.

File metadata

  • Download URL: optypecheck-16.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for optypecheck-16.tar.gz
Algorithm Hash digest
SHA256 5e75166606039ffe957330b92dbc23ea3c9a6b5b393e86111fe93c4b2c452aa8
MD5 8e428b85c649f654383fd2f41f2bbdf1
BLAKE2b-256 8bd0938c347a6e593d8a4d528e1cc18a4d7f038035884f2ce828b7321f20d787

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page