-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Typeshed #884
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
Typeshed #884
Conversation
This includes fixes to _random, cStringIO, errno, operator, sys, zlib, etc.
This almost certainly requires the changes in #721 to actually run the testsuite properly. |
I wouldn't count out Jukka yet. He published a pretty comprehensive document on duck-typing just a few weeks ago. I like the simplification you did to setup.py. And yes, merging our two branches sounds like a great idea. (So that Jukka can, if he wants to, just apply one giant merged pull request.) What's the HEAD of all your branches? o11c/mypy:master? |
3 weeks since any activity isn't a healthy sign, and 3 months that my first PR hasn't been merged ... I update
I've added you as a collaborator to my repo. Feel free to push new branches or rebase my non-active branches (i.e. not Suggested merge order:
|
@o11c: Sounds good! I'll look into merging my changes into your branches. |
@matthiaskramm I've reset started merging stuff into Do you use IRC? I've registered |
I started playing around with merging the |
Er sorry, I pushed it as |
I've fixed the testsuite failures, you should be able to rebase o11c/typeshed on top of o11c/driver now. Make sure you actually add all the stubs, . Note that python2 support is still incomplete per #732 so only worry about making sure all the python3 stubs for the the current/lower versions are checked for any given run. |
Applied the stubs changes of #721 onto typeshed/, and updated the submodule here. |
The reports of my death have been greatly exaggerated :-) Due to Life I've been neglecting mypy recently but I'm back now. Apologies for eveybody who's been affected! I'll look into this later this week. |
I've used submodules a little and don't hate them but I also didn't really like them when I used them the last time, and I know a lot of people who will not want to touch them. My main reason for being skeptical is that a lot of people hate them, not that they are actually so bad. I want mypy to have a great developer experience for new and existing contributors, even for those who aren't git experts. I'd like to see how this affects different mypy contributor workflows. This won't affect normal users as they will use pip to install mypy. Specific potential issues:
I have a draft suggestion to an alternative workflow which may or may not be better. Note that here I'm mostly concerned about mypy contributors (including me), as people only using typeshed would see no difference. I'll add this to #882. |
Does
If user runs setup.py or runtests.py, automatically run
Document that people outside of the core contributors should not touch the submodule pointer. There's little danger in running a newer-than-submodule-pointer version of the submodule. In my experience, the stubs are finished before the main PR, but if not, just comment that in the PR. You have merge permission on typeshed I assume?
This makes the workflow easier, as evidenced by the fact that I wrote #903.
No, as said earlier.
If they do, that's a bug, we fix that bug (we should be updating the submodule pointer very frequently anyway), they rebase on master, the bug goes away.
If we do have local stubs (which I generally recommend against), we should just keep them in a |
submodules have gotten much better. People still hate them, but they hate them for what they were, not what they're now. They'll lose their bad reputation at some point.
"git clone --recursive" will check out submodules, too. But yes, any executables in mypy should warn you if your mypy clone is incomplete (and tell you what git commands to run), rather than failing with an obscure error. I can start a PR on that.
You'll touch the submodule in order to upgrade to the latest version of typeshed. You'll get a conflict if you're merging two branches that both did that. The standard resolution would be to run "cd typeshed; git checkout master; git pull; cd ..; git add typeshed", in order to upgrade to the latest version of typeshed in the merged branches as well.
That's the correct thing to do. Regardless of the typeshed integration approach we take, we want people to do two separate commits, one for the stubs, one for the rest. Clumping those two changes into the same commit would mean that a core developer has to tease them apart again (in order to sync between typeshed and mypy). It's better if there's a very obvious distinction between modifying the stubs and modifying the code, and it's good that the contributor has to deal with that distinction, not the repository owner. (Better parallelism!)
Valid concern. But troublesome changes to typeshed will cause problems later, anyway. It might be preferable if they surface as soon as possible.
I have a feeling that files like builtins.py or collections.py will occasionally need local changes. The other stubs, not so much. As mentioned in my other comment, we can have an "override/" directory in mypy that contains mypy-specific stubs, with the understanding that it should not be overused. |
(This adds lxml/ertree.pyi.)
(includes httplib3 fix)
Suggest typeshed be added as a subdirectory of |
I played around with this and looks mostly good (together with #923). [Though I'm starting to get lost in the tangles of git history. Maybe we should move to a more linear, rebase-based history.] Some things I noticed:
|
Merged master, and fixed the path in setup.py (by just doing |
My snippet was adapted from an earlier commit -- I didn't write it myself. I first tried to do what you did now, but I hadn't merged master so it was still failing. Then I tried a few different things, including merging master, but didn't get back to trying the original fix attempt. I believe that I don't have time to test this today, but I'll try to get back to this ASAP. |
This removes the stubs/ directory, and adds the "typeshed" submodule to replace it. The directory layout of the latter is quite similar, so the changes to default_lib_path are straightforward.
Note that the submodule currently is using the "mypy" branch of in typeshed, which has, as a subset, the previous contents of stubs/, but sorted into the typeshed directory hierarchy.
This is for #882. It depends on #883.