Skip to main content

Enforce type hints at import time

Project description

Force static type hints at import time

This runs mypy on all imports, and currently just dumps the text, but that shows the concept.

Properly hooking both path and file imports might requir something more, and raising proper import errors when files don't pass is also left to do.

However, conceptually it sort of works, and simply importing it in a software can toggle the flag on to force strict typing more.

To use it, add "import typeforce.enforcing" to the modules of the initial code, and watch your code explode when you have a badly typed module.

Also note, that imports will not just be slow, they will be very slow.

asciicast

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

enforce_typehints-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

enforce_typehints-0.0.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file enforce_typehints-0.0.2.tar.gz.

File metadata

  • Download URL: enforce_typehints-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for enforce_typehints-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0de31fe3e4793c3256dcb496e852b2a9db991b8b81110b1598badcfb70a0f60e
MD5 c4002a01adcf9dd87b6172c5f3150235
BLAKE2b-256 282fde23ec289e4d71b45719099be44aa9d7b49e2076b22256b920073cb49d38

See more details on using hashes here.

File details

Details for the file enforce_typehints-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: enforce_typehints-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for enforce_typehints-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf369b19e6a9cd0acf0669d25a713af6007ea2b3ea2b3108ede5172a7480ad7e
MD5 9401706b71bc840d371f483b017b2af3
BLAKE2b-256 2a695dd65c84e44b577fa2e1d978dbfbd7ab446949453da96f2e585bbef4653d

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