Skip to content

Make mypy more effective

License

Notifications You must be signed in to change notification settings

orsinium-labs/typeforce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

16 Commits

Repository files navigation

typeforce

Typeforceis a CLI tool that enriches your Python environment with type annotations, empoweringmypy.

In particular:

  • Generatespy.typedfor annotated packages.
  • Installs missed stub files and plugins.

py.typed

PEP-561says the following:

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing.

In practice, many maintainers don't know about this marker. So there are tons of packages that do have type annotations but don't havepy.typed.

Typeforce checks all installed third-party packages and addspy.typedinto packages that have type annotations.

stubs and plugins

One of the breaking changesmypy 0.900 introducedis moving out allstubsand plugins for third-party packages out of mypy itself. Now, stub files for every such package should be installed manually.

Typeforce scans all installed third-party packages and installs all needed stub files and plugins if available.

Installation

python3 -m pip install --user typeforce

Usage

python3 -m typeforce --exe python3.9