-
Notifications
You must be signed in to change notification settings - Fork 237
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 annotations and drop Python 3.5 host support #315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job.
Looking on this code I think that installl_cpython
and install_pypy
should get as argument PythonConfiguration
, not only selected fields. This will give better flexibility.
And when drop execution on python 3.5 they maybe it is a good idea to return Path
object from them.
Thanks! Thanks for the quick review as well :-)
I don't know if we need that flexibility currently, but I'll have a look after rebasing. Too many things have changed anyway.
There are lots of things to do when dropping 3.5 support. EDIT: If there's more Python >= 3.6 stuff, do comment on #316. |
There are still quite a few things I don't like, though:
|
For me best is dataclass, but it is introduced in python 3.7. Current option is only one which gives type support and do not force us to write own constructor.
maybe use
Something for something. You got type cheeking, but need to write more code. You do not think about introduce type check task (as flake8) to tests? |
Yes, I will. But figuring that out was not my main concern. Something to think about after rebase, and once we can make decisions. |
Is there any PR I should wait for before rebasing? If not, I'll try to do it somewhere over the next few days. I've noticed it doesn't make a lot of sense to discuss code too much, if it might still change substantially. |
Strong agree. Always felt weird to me. Why didn't they just type-enable the version in
Yeah. I don't think there's anything we can do to mypy to improve this, but maybe we can tweak the flake8 rules to help here. Let's explore in the new/rebased PR?
Will presumably be helped by the BuildOptions struct in #311. |
Another note - I vote we drop Python 3.5 support in the same PR that we do the typing work. It will make things much easier. But let's leave the |
Side note, after all the complaining: on the bright side, running |
88a5b59
to
c476a10
Compare
First rebase. Got curious, and it actually went a lot quicker than expected. Juts a few extra things to annotate, now. |
Progress? |
On what? I think there aren't a lot of open discussions, for the moment? But this is not for the upcoming release, yet, if I understood @joerick correctly. Seems recent PRs resulted in conflicts, though. I'll rebase, in a bit! |
@YannickJadoul I do not want to create next PR until types are finished/decided. |
84ec4a3
to
d69526c
Compare
Rebased |
There is backport dataclasses module to python 3.6 https://pypi.org/project/dataclasses/ |
Is that worth it? Not a big advantage over |
dataclass allow to create modifiable container.
It also have few nice features like |
But if we don't need mutable containers, it might be better to not do this?
OK, yes, agreed there's some nice things, definitely. But not sure it's worth adding the extra dependency to the core of |
This is dependency only for python 3.6. From Python 3.7 it is built-in module. The question is If nice features of dataclass will be useful. If Yes then I not think it is good to wait with this till python 3.6 is dropped if it can be introduced earlier. |
I'm not so interested in the dataclass - config should be an immutable object anyway. I think we should try to get this in soon, before #334, if that works for you @YannickJadoul! I'll take another look over now, but I think it's pretty close, it probably just needs a merge of upstream master. |
Alright. I'll see if I can fit in some time to rebase today or tomorrow. Still want to/need to find some time to decently review #334 as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few notes. Then we'd need:
- some mypy config somewhere (equivalent to
--strict
), either in setup.cfg or in mypy.ini - Type checking in CI. I guess either this is an explicit job, or maybe this would be convenient to roll it into flake8 https://pypi.org/project/flake8-mypy/
d69526c
to
891e2dd
Compare
Thanks! Rebased, solved the conflicts, and fixed the final few things
Done. Added to There's a bunch of other flags/config values to be set, with various more errors/warnings. Nothing immediately catches my eye, but might be interesting to go over? Depends a bit on how strict you want to be; e.g. disallowing
I was planning to just install |
ddca0c6
to
9daad5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful. Merge when you're ready. I'll let you hit the green button :)
Hèhè, thanks! :-) |
Finally pushing this, after this came up again in #307. As noted, this is based on an old version of master, before a bunch of refactoring PRs were merged, so it still needs to be rebased (which might be as hard as just doing it from scratch again?).
To check, install mypy and run
mypy --strict cibuildwheel/
.Mainly meant to open the discussion of which aspects of type annoations are useful in the context of cibuildwheel and which are probably not. Python's typing is not all or nothing, so we can surely find middle ground.
@joerick, @Czaki, I think you were both interested to see this? :-)
EDIT:
Closes #258