Skip to main content

A PDM build hook to compile source files with mypyc

Project description

pdm-mypyc

pdm-mypyc is a build hook for pdm-backend to compile source files with mypyc.

Activate the hook

To enable the hook, simply add it to the build-system.requires:

[build-system]
requires = ["pdm-mypyc", "pdm-backend"]
build-backend = "pdm.backend"

Besides, you can also disable it temporarily by setting environment variable PDM_BUILD_WITHOUT_MYPYC to 1.

Configuration

Include and exclude files

By default, all .py files included by the tool.pdm.build configuration will be compiled with mypyc. You can override it with the includes and excludes settings under tool.pdm.build.hooks.mypyc table:

[tool.pdm.build.hooks.mypyc]
includes = ["src/**/*.py"]
excludes = ["src/**/tests/*.py"]  # these files will be excluded **in addition to** the excluded files in the build config

Mypy arguments

You can supply supported mypy command line options to the mypycify function with mypy-args setting:

[tool.pdm.build.hooks.mypyc]
mypy-args = ["--disallow-untyped-defs", "--disallow-any-generics"]

Options

You can specify options to pass to the mypycify function.

[tool.pdm.build.hooks.mypyc.options]
opt_level = "3"

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

pdm-mypyc-0.1.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

pdm_mypyc-0.1.0-py3-none-any.whl (3.7 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