| CI/CD | |
| Package | |
| Meta |
This provides a build hook plugin for Hatch that compiles code with Mypyc.
Table of Contents
The build hook plugin name is mypyc.
-
pyproject.toml
[tool.hatch.build.targets.wheel.hooks.mypyc] dependencies = ["hatch-mypyc"]
-
hatch.toml
[build.targets.wheel.hooks.mypyc] dependencies = ["hatch-mypyc"]
By default, all files included using the standard file selection options with a .py extension will be targeted. You can narrow what files to compile to an even smaller subset with the include/exclude options, which represent Git-style glob patterns.
[build.targets.wheel.hooks.mypyc]
include = ["/src/pkg/server"]
exclude = ["__main__.py"]You can specify extra Mypy arguments with the mypy-args option.
[build.targets.wheel.hooks.mypyc]
mypy-args = [
"--disallow-untyped-defs",
]You can specify options that affect the behavior of mypycify.
[build.targets.wheel.hooks.mypyc.options]
opt_level = "3"Note:
- the
target_diroption is used internally and therefore has no effect
If you need more packages at build time in order to successfully type check, you can use the following options where you configured the plugin:
dependencies- add more dependencies alongsidehatch-mypycrequire-runtime-dependencies- set totrueto include dependencies defined in theproject.dependenciesarrayrequire-runtime-features- set to an array of named dependency groups that are defined inproject.optional-dependencies
hatch-mypyc is distributed under the terms of the MIT license.