Mypy setup fixes (#27825)
* Install our core dependencies for mypy in azure To match local setups and tox. * Use "system" mypy in pre-commit instead of the "real" mypy hook The results of mypy depend on what is installed. And the mypy hook runs in a virtualenv of its own, meaning we'd need to install and maintain another set of our dependencies there... no. Use the "system" one and reuse the environment that is set up anyway already instead. * Reintroduce needed ruamel.yaml type ignore This ignore is required when ruamel.yaml is installed, and we want it to be as it's part of the core dependency set.
This commit is contained in:
parent
61edd33da7
commit
3a608314c4
3 changed files with 14 additions and 6 deletions
|
@ -13,9 +13,17 @@ repos:
|
|||
additional_dependencies:
|
||||
- flake8-docstrings==1.3.1
|
||||
- pydocstyle==4.0.0
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy.git
|
||||
rev: v0.730
|
||||
# Using a local "system" mypy instead of the mypy hook, because its
|
||||
# results depend on what is installed. And the mypy hook runs in a
|
||||
# virtualenv of its own, meaning we'd need to install and maintain
|
||||
# another set of our dependencies there... no. Use the "system" one
|
||||
# and reuse the environment that is set up anyway already instead.
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: mypy
|
||||
args: []
|
||||
name: mypy
|
||||
entry: mypy
|
||||
language: system
|
||||
types: [python]
|
||||
require_serial: true
|
||||
exclude: ^script/scaffold/templates/
|
||||
|
|
|
@ -174,12 +174,12 @@ stages:
|
|||
steps:
|
||||
- template: templates/azp-step-cache.yaml@azure
|
||||
parameters:
|
||||
keyfile: 'requirements_test.txt | homeassistant/package_constraints.txt'
|
||||
keyfile: 'requirements_test.txt | setup.py | homeassistant/package_constraints.txt'
|
||||
build: |
|
||||
python -m venv venv
|
||||
|
||||
. venv/bin/activate
|
||||
pip install -r requirements_test.txt -c homeassistant/package_constraints.txt
|
||||
pip install -e . -r requirements_test.txt -c homeassistant/package_constraints.txt
|
||||
- script: |
|
||||
. venv/bin/activate
|
||||
mypy homeassistant
|
||||
|
|
|
@ -90,7 +90,7 @@ def load_yaml(fname: str, round_trip: bool = False) -> JSON_TYPE:
|
|||
if round_trip:
|
||||
yaml = YAML(typ="rt")
|
||||
# type ignore: https://bitbucket.org/ruamel/yaml/pull-requests/42
|
||||
yaml.preserve_quotes = True
|
||||
yaml.preserve_quotes = True # type: ignore
|
||||
else:
|
||||
if ExtSafeConstructor.name is None:
|
||||
ExtSafeConstructor.name = fname
|
||||
|
|
Loading…
Add table
Reference in a new issue