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

ci: add mypy configuration and pre-commit hook #48

Merged
merged 3 commits into from
Apr 30, 2020
Merged

ci: add mypy configuration and pre-commit hook #48

merged 3 commits into from
Apr 30, 2020

Conversation

redeboer
Copy link
Member

@redeboer redeboer commented Apr 28, 2020

Closes #33

See also #47

@redeboer redeboer added 🔨 Maintenance Maintenance and upkeep improvements Priority: Medium labels Apr 28, 2020
@redeboer redeboer requested a review from spflueger April 28, 2020 16:11
@redeboer redeboer self-assigned this Apr 28, 2020
@redeboer
Copy link
Member Author

Draft for now because we need to see what configurations to add
https://mypy.readthedocs.io/en/stable/config_file.html

I'm not sure if we should add yet another config file, in this case mypy.ini. So I would prefer to add the mypy configuration to the tox.ini file. See this discussion though... python/mypy#2761.

@codecov
Copy link

codecov bot commented Apr 28, 2020

Codecov Report

Merging #48 into master will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #48      +/-   ##
==========================================
- Coverage   83.07%   83.04%   -0.04%     
==========================================
  Files          24       24              
  Lines        2618     2618              
==========================================
- Hits         2175     2174       -1     
- Misses        443      444       +1     
Impacted Files Coverage Δ
tensorwaves/interfaces.py 100.00% <100.00%> (ø)
...ensorwaves/expertsystem/state/conservationrules.py 84.59% <0.00%> (-0.24%) ⬇️

@redeboer redeboer changed the title ci: add mypy checks ci: add mypy configuration and pre-commit hook Apr 29, 2020
@spflueger spflueger force-pushed the master branch 2 times, most recently from f37b0fd to effe261 Compare April 29, 2020 15:02
Run from anywhere with
  pre-commit run mypy --file .
or from te main directory with
  mypy --config-file=tox.ini
@redeboer redeboer marked this pull request as ready for review April 30, 2020 07:44
Copy link
Member

@spflueger spflueger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. We should keep in mind to write a small section in the docs about this as well, once we include this officially. Specifically how to config vs code.

@redeboer
Copy link
Member Author

Indeed. An attempt to improve the contribute pages was drafted in ComPWA/pycompwa#85, but that PR should probably be migrated to tensorwaves. Then the instructions can be simplified, we now only use:

  • formatter: black
  • linting: pylint + flake8 (+ extensions)
  • static type checker: mypy

All of that is automatised through pre-commit and Travis CI, just need to point out those four tools and their corresponding configs. The configs are important because they represent our (if necessary, evolving) coding conventions, so those conventions don't need to be written out in the documentation.

Related to that, as you say, we may want to highly recommend contributors to work with VS code. There is currently no such assumption in the documentation.

@redeboer redeboer merged commit d46ebcc into ComPWA:master Apr 30, 2020
@redeboer redeboer deleted the mypy branch April 30, 2020 08:21
redeboer added a commit that referenced this pull request May 5, 2020
* ci: add mypy pre-commit hook
* ci: add mypy configuration in `tox.ini`
* fix: add more type hints to `interfaces.py`

Run from anywhere with
```bash
  pre-commit run mypy --file .
```
  or from te main directory with
```bash
  mypy --config-file=tox.ini
```
@redeboer redeboer added 🖱️ DX Improvements to the Developer Experience 🕐 Easy and removed 🔨 Maintenance Maintenance and upkeep improvements labels Jun 20, 2020
@redeboer redeboer added this to the Finalize dev environment milestone Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖱️ DX Improvements to the Developer Experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add static typing checks (mypy) and test in Travis CI job
2 participants