Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mypy to CI and create code style guidelines #9

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ jobs:
- run:
name: Lint code
command: make lint
- run:
name: Static typechecking
command: make mypy
- run:
name: Run tests
command: make test
Expand Down
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Contributing Code

## Style
We follow PEP8 with the exception of maximum line length set to 120. We
use `numpy` style docstrings with the exception of ommitting argument
types in the docstrings in favour of type hint in function and class
signatures. We use `mypy` to typecheck code with exceptions for
libraries with missing stubs specified in `setup.cfg`.

## Pull requests
Before a PR is accepted, CircleCI builds must pass. We use `flake8` for
linting (with exceptions to PEP8 described in `setup.cfg` and `pytest`
for testing. We use `sphinx` for building documentation.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ test:
.PHONY: lint
lint:
flake8 .

.PHONY: mypy
mypy:
mypy .
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pytest==4.2.0
pytest-cov==2.6.1
sphinx==1.8.4
flake8==3.7.7
flake8==3.7.7
mypy==0.670
18 changes: 18 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,21 @@ exclude =
doc/source/conf.py
# post-test
.eggs/

[mypy-setuptools.*]
ignore_missing_imports = True

[mypy-numpy.*]
ignore_missing_imports = True

[mypy-pandas.*]
ignore_missing_imports = True

[mypy-sklearn.*]
ignore_missing_imports = True

[mypy-matplotlib.*]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True