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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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