-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Integrate typeshed into mypy #882
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
Comments
AAAAAH!!!! Submodules are "theoretically" good but bite where it hurts when it comes to larger repos. |
I've never had any issues with submodules. They're exactly the right solution for the problem at hand (wanting to extract out and share a piece of functionality and maintain it independently). |
With recent versions of git, it's a lot harder to screw up submodules. If you're afraid of them because of experience with old versions of git, your knowledge is obsolete. |
Likely add some sort of directory helper method here: o11c@bb2daf5 |
This could be really nice. At least merging the stubs is a no-brainer and I haven't done it yet only because of lack of time. However, I've had some bad experiences with submodules myself (using older versions of git, I admit). I'll play around with them a little and see if I have any objections any more. An alternative would be to import the contents of typeshed periodically to the mypy repo as commits. This would have its own set of issues. |
The three alternatives typically are:
In the past, I've tried all three and found submodules the most convenient and the least error-prone (mostly because they prevent you from changing things in the wrong repository), but your mileage might vary. I'll be perfectly happy to use whatever setup you decide to go with. |
Submodules are not bad per-se. The problem that comes with them is when people want to use them as a replacement for SVN partial checkouts. I think in this scenario a submodule fits the problem nicely. |
I added some comments to #884. Here is another workflow which is more work to support but may give a better experience in the most common workflows for new contributors. I don't really care that much about the workflows for core contributors such as me as we can figure it out or script it, but for new contributors I'd like to give an experience that is as close as possible to a vanilla git(hub) experience. The idea goes like this:
Now all the existing mypy workflows will work exactly like they currently do, plus there are two additional workflows, one for pushing stub changes from mypy to typeshed and the other for pulling changes from typeshed to mypy. Benefits over submodule:
Costs over submodule:
I'm not really sure whether this will be worth it. I'll ask around and try to get more opinions on git submodules. |
I very very strongly recommend against a We want stubs to be committed to typeshed early, even if their PR branch is not ready. PR branches should not contain submodule updates, those should be periodically done in core (and we can have our scripts encourage people to use typeshed master rather than the commit the submodule points to - or perhaps offer I created #903 to make life easier for me, not for anybody else. |
o11c: I wouldn't run any git commands in runtests.py, just out of principle. If anything, it should detect a missing submodule and output a nice message with instructions what to do. JukkaL: If you allow PRs that cause mypy and typeshed to become out of sync, you (and other core contributors) will take on the extra workload to bring them back into sync. Sure, scripts can help, but it still means extra work for potentially every PR - work that normally would/should be done by the contributor. |
Correction: git will not automatically initialize submodules, at least not on all Linux distributions. (E.g. on Gentoo git does automatic submodule cloning, but Ubuntu it doesn't) |
No, it does not. |
Oh oops, you're right. (I just tried it on an older Gentoo box) |
Okay, I went through the submodule workflow offline with @gnprice today, and git submodule support is definitely still janky but it seems like the least bad option we have. Here are my/our additional concerns:
I see the point of optimizing the workflow for the core contributors, as they are a more critical resource for moving things forward than casual contributors. My suggestions for partially working around the issues with submodules:
Optionally, somebody could send a diff to fix the most glaring UI issues in git (any takers?). What do you think? Would somebody be willing to implement the suggestions? |
Sounds good to me. I can implement this. I'll add the documentation to #884. The git logic and helper scripts should probably go into a PR of it's own. (Or do you want that as part of #884, too? I usually prefer to modularize things)
An alias would work, but the canonical way is to install a post-receive hook on the client side. Maybe mypy can have a utility script that does this for you. |
I don't think that upstream git considers these UI choices to be an issue actually. (Or at least, thats a hypothesis just because I can't think of any other reason why it wouldn't be the way you describe) |
Given how many improvements they have made to the UI of submodules in recent versions, that appears to be untrue. Also |
Ok, submitted PR #923 for verifying whether the submodules are initialized. Will do the documentation changes next. Since it seems we might be able to merge #884 soon, if at all possible, please hold off on doing any changes to stubs (or on merging PRs that do), to prevent typeshed and mypy getting out of sync. (They're in sync right now, but I had to manually port some changes.) |
I added stubs for |
This is the story I'd had in my head, but after going through the workflow yesterday with @JukkaL, my conclusion is that they're unfortunately just as bad as I remember from circa 2009. Still, as Jukka says, they seem like the least-bad available option.
This is a nice illustration of how bad the UI still is. I just double-checked this on the very latest Git (v2.6.1), and the message is exactly the same as Jukka and I looked at yesterday. (It's true that I made a repo Here's the message:
There's no hint of any relevant command to run. "new commits" is sort of helpful if you can guess that it means "there's a submodule here", but it's also backward from what the user actually should do. It's left to us, in code like #923, to give the user the hint they actually need (which is In my copious free time, I might try dreaming up appropriate fixes to this UI that Git upstream will take. Meanwhile I think we're on the right track given the tools we have. |
I started working on a pull request for this, so I'm opening this issue to discuss details and track progress.
The idea is to
https://github.com/python/typeshed/blob/master/README.md)
The text was updated successfully, but these errors were encountered: