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 #152

Merged
merged 32 commits into from
Oct 4, 2019
Merged

Add mypy #152

merged 32 commits into from
Oct 4, 2019

Conversation

andersonberg
Copy link
Contributor

Fixes #145
This PR will add mypy and fix type errors. I was running mypy locally this way: $ mypy src/arche --ignore-missing-imports.

@codecov
Copy link

codecov bot commented Jul 29, 2019

Codecov Report

Merging #152 into master will decrease coverage by 0.02%.
The diff coverage is 90.9%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   79.31%   79.29%   -0.03%     
==========================================
  Files          22       22              
  Lines        1615     1618       +3     
  Branches      284      284              
==========================================
+ Hits         1281     1283       +2     
- Misses        288      289       +1     
  Partials       46       46
Impacted Files Coverage Δ
src/arche/rules/result.py 87.85% <100%> (ø) ⬆️
src/arche/tools/api.py 64.64% <100%> (ø) ⬆️
src/arche/tools/helpers.py 100% <100%> (ø) ⬆️
src/arche/rules/others.py 100% <100%> (ø) ⬆️
src/arche/rules/duplicates.py 100% <100%> (ø) ⬆️
src/arche/tools/schema.py 87.95% <100%> (ø) ⬆️
src/arche/report.py 97.72% <100%> (ø) ⬆️
src/arche/data_quality_report.py 77.52% <100%> (ø) ⬆️
src/arche/readers/schema.py 100% <100%> (ø) ⬆️
src/arche/readers/items.py 87.06% <66.66%> (-0.76%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d59880...fbf5484. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 29, 2019

Codecov Report

Merging #152 into master will decrease coverage by 0.03%.
The diff coverage is 95.08%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
- Coverage   81.79%   81.76%   -0.04%     
==========================================
  Files          23       23              
  Lines        1637     1634       -3     
  Branches      291      290       -1     
==========================================
- Hits         1339     1336       -3     
  Misses        246      246              
  Partials       52       52
Impacted Files Coverage Δ
src/arche/rules/json_schema.py 100% <ø> (ø) ⬆️
src/arche/rules/result.py 88.31% <100%> (ø) ⬆️
src/arche/tools/api.py 64.64% <100%> (ø) ⬆️
src/arche/tools/bitbucket.py 100% <100%> (ø) ⬆️
src/arche/tools/helpers.py 100% <100%> (ø) ⬆️
src/arche/rules/others.py 100% <100%> (ø) ⬆️
src/arche/rules/duplicates.py 100% <100%> (ø) ⬆️
src/arche/tools/schema.py 87.95% <100%> (ø) ⬆️
src/arche/readers/items.py 88.07% <100%> (+0.24%) ⬆️
src/arche/arche.py 84.89% <100%> (ø) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67a24b8...561c2ca. Read the comment docs.

Copy link

@ejulio ejulio left a comment

Choose a reason for hiding this comment

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

Just not sure about the benefits, mostly because:

  • Only a few variables/attributes are typed
  • There are some #type: ignore

Copy link
Contributor

@manycoding manycoding left a comment

Choose a reason for hiding this comment

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

What's the error in mypy for every line with # type: ignore?

I agree with @ejulio and think it's better to either not have # type: ignore at all or don't use mypy.

Last thing - adding mypy check to tox like here https://github.com/scrapinghub/arche/compare/mypy

src/arche/readers/items.py Outdated Show resolved Hide resolved
src/arche/readers/items.py Outdated Show resolved Hide resolved
src/arche/readers/schema.py Outdated Show resolved Hide resolved
src/arche/rules/price.py Outdated Show resolved Hide resolved
src/arche/tools/api.py Outdated Show resolved Hide resolved
Pipfile Outdated Show resolved Hide resolved
src/arche/readers/schema.py Outdated Show resolved Hide resolved
src/arche/readers/schema.py Outdated Show resolved Hide resolved
src/arche/rules/result.py Outdated Show resolved Hide resolved
Copy link
Contributor

@manycoding manycoding left a comment

Choose a reason for hiding this comment

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

Add this check to travis.yml

Pipfile Outdated Show resolved Hide resolved
src/arche/arche.py Show resolved Hide resolved
src/arche/arche.py Show resolved Hide resolved
src/arche/arche.py Outdated Show resolved Hide resolved
src/arche/readers/items.py Outdated Show resolved Hide resolved
src/arche/tools/api.py Outdated Show resolved Hide resolved
src/arche/tools/bitbucket.py Outdated Show resolved Hide resolved
src/arche/tools/schema.py Outdated Show resolved Hide resolved
src/arche/tools/schema.py Outdated Show resolved Hide resolved
src/arche/tools/schema.py Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
@manycoding
Copy link
Contributor

Awesome.

Copy link
Contributor

@manycoding manycoding left a comment

Choose a reason for hiding this comment

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

I cleaned some redundant castings and made sure it works in travis. Good work, I am merging.

@manycoding manycoding merged commit 0538719 into master Oct 4, 2019
@manycoding manycoding deleted the add-mypy branch October 4, 2019 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check typing - add mypy
3 participants