Document how to run mypy; move mypy settings to pyproject.toml
This commit is contained in:
parent
08b221d760
commit
52cb9ab2df
3 changed files with 20 additions and 7 deletions
|
|
@ -12,7 +12,7 @@ There's no particular roadmap for chap, it was created to scratch the original d
|
|||
If you're looking for a way to contribute, check out the open issues.
|
||||
If you want to discuss a possible enhancement before beginning work, opening a fresh issue is a good way to start a dialog about your idea.
|
||||
|
||||
## Code style & linting
|
||||
## Code style & linting with pre-commit
|
||||
|
||||
This project uses [pre-commit](https://pre-commit.com/) to maintain the code's style and perform some quality checks.
|
||||
First, install pre-commit: `pip install pre-commit`.
|
||||
|
|
@ -26,3 +26,16 @@ It is acceptable to use hints like `# pylint: ignore=diagnostic-kind` when it's
|
|||
|
||||
When you create a pull request, `pre-commit run --all` is run in a standardized environment, which occasionally catches things that were not seen locally.
|
||||
That green checkmark in github actions is the final arbiter of whether the code is pre-commit clean.
|
||||
|
||||
## Type checking with mypy
|
||||
|
||||
This project uses [mypy](https://www.mypy-lang.org/) for type-checking.
|
||||
If your system has `make`, you can type-check the project with: `make`.
|
||||
Otherwise, you need to perform several setup steps:
|
||||
* create a virtual environment at "venv": `python -mvenv venv`
|
||||
* install dependencies in the virtual environment: `venv/bin/pip install -r requirements.txt mypy`
|
||||
|
||||
Then, type check with: `venv/bin/mypy`
|
||||
|
||||
When you create a pull request, mypy is run in a standardized environment, which occasionally catches things that were not seen locally.
|
||||
That green checkmark in github actions is the final arbiter of whether the code is mypy clean.
|
||||
|
|
|
|||
6
mypy.ini
6
mypy.ini
|
|
@ -1,6 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Jeff Epler <jepler@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
[mypy]
|
||||
mypy_path = src
|
||||
|
|
@ -44,3 +44,9 @@ readme = {file = ["README.md"], content-type="text/markdown"}
|
|||
dependencies = {file = "requirements.txt"}
|
||||
[tool.setuptools.package-data]
|
||||
"pkgname" = ["py.typed"]
|
||||
[tool.mypy]
|
||||
mypy_path = ["src"]
|
||||
warn_unused_ignores = false
|
||||
warn_redundant_casts = true
|
||||
strict = true
|
||||
packages = ["chap"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue