Skip to content

Commit

Permalink
run mypy in proper environment (#5279)
Browse files Browse the repository at this point in the history
* enable strict mypy checking

* update contribution guide

* remove mypy precommit hook
  • Loading branch information
dimbleby committed May 7, 2022
1 parent 9331741 commit f645ab9
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ jobs:
- name: Run pytest
run: poetry run python -m pytest -p no:sugar -q tests/

- name: Run mypy
run: poetry run mypy

- name: Run pytest (integration suite)
run: poetry run python -m pytest -p no:sugar -q --integration tests/integration

Expand Down
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ repos:
- id: flake8
additional_dependencies: *flake8_deps

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.950
hooks:
- id: mypy
pass_filenames: false
additional_dependencies:
- types-requests

- repo: https://github.com/pre-commit/pre-commit
rev: v2.18.1
hooks:
Expand Down
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ $ poetry install
$ poetry run pytest tests/
```

Poetry uses [mypy](https://github.com/python/mypy) for typechecking, and the CI
will fail if it finds any errors. To run mypy locally:

```bash
$ poetry run mypy
```

Poetry uses the [black](https://github.com/psf/black) coding style and you must ensure that your
code follows it. If not, the CI will fail and your Pull Request will not be merged.

Expand Down
7 changes: 7 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ $ poetry install
$ poetry run pytest tests/
```

Poetry uses [mypy](https://github.com/python/mypy) for typechecking, and the CI
will fail if it finds any errors. To run mypy locally:

```bash
$ poetry run mypy
```

Poetry uses the [black](https://github.com/psf/black) coding style and you must ensure that your
code follows it. If not, the CI will fail and your Pull Request will not be merged.

Expand Down
131 changes: 130 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ httpretty = "^1.0"
typing-extensions = { version = "^4.0.0", python = "<3.8" }
zipp = { version = "^3.4", python = "<3.8" }
flatdict = "^4.0.1"
mypy = ">=0.950"
types-requests = ">=2.27.11"

[tool.poetry.scripts]
poetry = "poetry.console.application:main"
Expand Down

0 comments on commit f645ab9

Please sign in to comment.