Skip to content

Commit

Permalink
enable mypy on CI (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelberkeley-pio committed May 19, 2020
1 parent 61f8d84 commit a198764
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ runtest: &runtest
version: 2.1

jobs:
type-check:
docker:
- image: awav/tensorflow:2.1

steps:
- checkout
- run:
name: Install type checker
command: pip install mypy
- run:
name: Run type checker
command: mypy .

unit-test:
<<: *runtest
docker:
Expand Down Expand Up @@ -103,6 +116,10 @@ workflows:
version: 2.1
build_test_and_deploy:
jobs:
- type-check:
filters:
tags:
only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/
- format-checker:
filters:
tags:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ package:
format:
black -t py36 -l 100 gpflow tests doc setup.py

type-check:
mypy .

test:
pytest -v --durations=10 tests/
2 changes: 1 addition & 1 deletion gpflow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(

self._transform = transform
self.prior = prior
self.prior_on = prior_on
self.prior_on = prior_on # type: ignore # see https://github.com/python/mypy/issues/3004

if isinstance(value, tf.Variable):
self._unconstrained = value
Expand Down
17 changes: 17 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
[mypy]
ignore_missing_imports = True

; the following modules are not passing mypy, so we're skipping them until they've been fixed up.
; see github issue https://github.com/GPflow/GPflow/issues/1368 for more information. Note that some
; modules that haven't had types added are passing anyway so may not appear below.
;
; remove modules from this skip list when types have been added
[mypy-gpflow.conditionals.*,gpflow.config.*,gpflow.covariances.*,gpflow.expectations.*]
ignore_errors = True

[mypy-gpflow.kernels.*,gpflow.models.*,gpflow.monitor.*,gpflow.optimizers.*,gpflow.utilities.*]
ignore_errors = True

[mypy-gpflow.mean_functions]
ignore_errors = True

[mypy-tests.*]
ignore_errors = True
1 change: 1 addition & 0 deletions tests_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mypy
black
pytest>=3.5.0
pytest-random-order
Expand Down

0 comments on commit a198764

Please sign in to comment.