Skip to content

Commit

Permalink
trying out static type checks with pyre
Browse files Browse the repository at this point in the history
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com>
  • Loading branch information
hoefling committed May 19, 2019
1 parent a6ae971 commit 696fcc7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/devpi_ext/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# pyre-strict


__all__ = ['__version__']


Expand Down
2 changes: 2 additions & 0 deletions src/devpi_ext/login.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# pyre-strict

"""
Defines custom hook for password search. This tries to get credentials
from .pypirc file. Will return nothing if the file is not present
Expand Down
15 changes: 11 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ deps =
black
flake8
mypy
pyre-check
unify
commands =
poetry run flake8 --max-line-length=88
poetry run black --check .
poetry install -v
poetry run flake8 --max-line-length=88 src/ tests/
poetry run black --check src tests
poetry run unify --quote "'" --check-only --recursive .
poetry run mypy -p devpi_ext --strict --ignore-missing-imports
# pluggy doesn't have stubs, generate them to satisfy mypy/pyre
poetry run stubgen -p pluggy --include-private --output stubs
# stubgen doesn't insert return types for untyped functions
poetry run bash -c "grep -lnr 'def .*(.*): ...' stubs/ | xargs -n1 sed -i 's/def \(.*\)(\(.*\)): .../def \1(\2) -> Any: .../g'"
poetry run mypy -p devpi_ext --strict
poetry run pyre --source-directory src --source-directory stubs --noninteractive check
setenv =
MYPYPATH = src
MYPYPATH = src:stubs

0 comments on commit 696fcc7

Please sign in to comment.