| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: hatch-mypyc |
| 3 |
Version: 0.16.0 |
| 4 |
Summary: Hatch build hook plugin for Mypyc |
| 5 |
Project-URL: Funding, https://github.com/sponsors/ofek |
| 6 |
Project-URL: History, https://github.com/ofek/hatch-mypyc/blob/master/HISTORY.md |
| 7 |
Project-URL: Issues, https://github.com/ofek/hatch-mypyc/issues |
| 8 |
Project-URL: Source, https://github.com/ofek/hatch-mypyc |
| 9 |
Author-email: Ofek Lev <[email protected]> |
| 10 |
License-Expression: MIT |
| 11 |
License-File: LICENSE.txt |
| 12 |
Keywords: build,hatch,mypy,mypyc,plugin,typing |
| 13 |
Classifier: Development Status :: 4 - Beta |
| 14 |
Classifier: Framework :: Hatch |
| 15 |
Classifier: License :: OSI Approved :: MIT License |
| 16 |
Classifier: Programming Language :: Python |
| 17 |
Classifier: Programming Language :: Python :: 3.7 |
| 18 |
Classifier: Programming Language :: Python :: 3.8 |
| 19 |
Classifier: Programming Language :: Python :: 3.9 |
| 20 |
Classifier: Programming Language :: Python :: 3.10 |
| 21 |
Classifier: Programming Language :: Python :: 3.11 |
| 22 |
Classifier: Programming Language :: Python :: Implementation :: CPython |
| 23 |
Classifier: Programming Language :: Python :: Implementation :: PyPy |
| 24 |
Classifier: Topic :: Software Development :: Build Tools |
| 25 |
Requires-Python: >=3.7 |
| 26 |
Requires-Dist: hatchling>=1.12.2 |
| 27 |
Requires-Dist: mypy>=0.971 |
| 28 |
Requires-Dist: pathspec |
| 29 |
Requires-Dist: setuptools |
| 30 |
Description-Content-Type: text/markdown |
| 31 |
|
| 32 |
# hatch-mypyc |
| 33 |
|
| 34 |
| | | |
| 35 |
| --- | --- | |
| 36 |
| CI/CD | [](https://github.com/ofek/hatch-mypyc/actions/workflows/test.yml) [](https://github.com/ofek/hatch-mypyc/actions/workflows/build.yml) | |
| 37 |
| Package | [](https://pypi.org/project/hatch-mypyc/) [](https://pypi.org/project/hatch-mypyc/) | |
| 38 |
| Meta | [](https://github.com/pypa/hatch) [](https://github.com/psf/black) [](https://github.com/ambv/black) [](https://spdx.org/licenses/) [](https://github.com/sponsors/ofek) | |
| 39 |
|
| 40 |
----- |
| 41 |
|
| 42 |
This provides a [build hook](https://hatch.pypa.io/latest/config/build/#build-hooks) plugin for [Hatch](https://github.com/pypa/hatch) that compiles code with [Mypyc](https://github.com/mypyc/mypyc). |
| 43 |
|
| 44 |
**Table of Contents** |
| 45 |
|
| 46 |
- [Configuration](#configuration) |
| 47 |
- [File selection](#file-selection) |
| 48 |
- [Mypy arguments](#mypy-arguments) |
| 49 |
- [Options](#options) |
| 50 |
- [Missing types](#missing-types) |
| 51 |
- [License](#license) |
| 52 |
|
| 53 |
## Configuration |
| 54 |
|
| 55 |
The [build hook plugin](https://hatch.pypa.io/latest/plugins/build-hook/) name is `mypyc`. |
| 56 |
|
| 57 |
- ***pyproject.toml*** |
| 58 |
|
| 59 |
```toml |
| 60 |
[tool.hatch.build.targets.wheel.hooks.mypyc] |
| 61 |
dependencies = ["hatch-mypyc"] |
| 62 |
``` |
| 63 |
|
| 64 |
- ***hatch.toml*** |
| 65 |
|
| 66 |
```toml |
| 67 |
[build.targets.wheel.hooks.mypyc] |
| 68 |
dependencies = ["hatch-mypyc"] |
| 69 |
``` |
| 70 |
|
| 71 |
### File selection |
| 72 |
|
| 73 |
By default, all files included using the [standard file selection options](https://hatch.pypa.io/latest/config/build/#file-selection) 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](https://git-scm.com/docs/gitignore#_pattern_format). |
| 74 |
|
| 75 |
```toml |
| 76 |
[build.targets.wheel.hooks.mypyc] |
| 77 |
include = ["/src/pkg/server"] |
| 78 |
exclude = ["__main__.py"] |
| 79 |
``` |
| 80 |
|
| 81 |
### Mypy arguments |
| 82 |
|
| 83 |
You can specify extra [Mypy arguments](https://mypy.readthedocs.io/en/stable/command_line.html) with the `mypy-args` option. |
| 84 |
|
| 85 |
```toml |
| 86 |
[build.targets.wheel.hooks.mypyc] |
| 87 |
mypy-args = [ |
| 88 |
"--disallow-untyped-defs", |
| 89 |
] |
| 90 |
``` |
| 91 |
|
| 92 |
### Options |
| 93 |
|
| 94 |
You can specify `options` that affect the behavior of [mypycify](https://github.com/python/mypy/blob/v0.930/mypyc/build.py#L429). |
| 95 |
|
| 96 |
```toml |
| 97 |
[build.targets.wheel.hooks.mypyc.options] |
| 98 |
opt_level = "3" |
| 99 |
``` |
| 100 |
|
| 101 |
Note: |
| 102 |
|
| 103 |
- the `target_dir` option is used internally and therefore has no effect |
| 104 |
|
| 105 |
## Missing types |
| 106 |
|
| 107 |
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](#configuration): |
| 108 |
|
| 109 |
- `dependencies` - add more dependencies alongside `hatch-mypyc` |
| 110 |
- `require-runtime-dependencies` - set to `true` to include dependencies defined in the `project.dependencies` array |
| 111 |
- `require-runtime-features` - set to an array of named dependency groups that are defined in `project.optional-dependencies` |
| 112 |
|
| 113 |
## License |
| 114 |
|
| 115 |
`hatch-mypyc` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. |