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 type hints to tasks.py #241

Merged
merged 3 commits into from
Sep 5, 2019
Merged

Conversation

cs01
Copy link
Contributor

@cs01 cs01 commented Aug 25, 2019

Generate type hints database from types used during runtime:

pip install monkeytype
monkeytype run nox -s tests-3.6

See modules that can have types applied:

monkeytype list-modules

Apply types

monkeytype apply <module>

This exposed a circular dependency between session.py and manifest.py which was resolved in this PR. It ended up causing many LOC to be changed, but the change was cut+pasting code.

There are still several modules that haven't had types added yet since this PR got quite large.

Note that there are no type errors, unit tests did not change, and test coverage is still 100%.

@cs01 cs01 force-pushed the cs01/add-type-hints branch 3 times, most recently from f603667 to 13bf2a0 Compare August 25, 2019 17:33
@theacodes
Copy link
Collaborator

This is great, but we should try to find a way to remove the circular dependency without splatting t he whole manifest module into sessions.

@dhermes
Copy link
Collaborator

dhermes commented Aug 26, 2019

should try to find a way to remove the circular dependency

Indeed. I'd sleep much easier if there was a PR dedicated to resolving the circular dependency totally distinct from this one.

@cs01 Generating type hints is very much appreciated!

@cs01
Copy link
Contributor Author

cs01 commented Aug 26, 2019

Sounds good, I will do that in a different PR and then revisit this one.

@cs01
Copy link
Contributor Author

cs01 commented Aug 26, 2019

Oh something else that came up that was kind of annoying was the import sorting errors. I ran isort on nox which auto-sorted things, but nox uses a flake8 sorting plugin which doesn't match the way isort does its sorting so nox -s lint failed. Is there a way to auto-sort things such that its flake8 linter is happy?

@theacodes
Copy link
Collaborator

theacodes commented Aug 26, 2019 via email

@cs01 cs01 changed the title [wip] add more type hints add type hints to tasks.py Aug 27, 2019
@cs01
Copy link
Contributor Author

cs01 commented Aug 27, 2019

I created a new PR to update import order linting in #242. This PR depends on that one, so it should be reviewed first.

This PR has been reduced in scope to only add types to tasks.py. I decided I'll make one PR for each file to keep the review process manageable.

@cs01
Copy link
Contributor Author

cs01 commented Sep 5, 2019

Merged master into this PR. Now the diff is much smaller and only affects types in tasks.py.

@theacodes
Copy link
Collaborator

Rad, thanks!

@theacodes theacodes merged commit ee836d2 into wntrblm:master Sep 5, 2019
@cs01 cs01 deleted the cs01/add-type-hints branch September 5, 2019 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants