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 Django versioning? #5

Open
carljm opened this issue May 16, 2017 · 2 comments
Open

add Django versioning? #5

carljm opened this issue May 16, 2017 · 2 comments

Comments

@carljm
Copy link

carljm commented May 16, 2017

Thanks for your work on these stubs!

We are adding type annotations to our Django-based server codebase at Instagram, and we'd like to use (and contribute back to) this project. One issue is that we are on Django 1.8, and will likely need to modify some stubs accordingly. Would you be open to switching to a versioned layout for this project, so we could contribute back the 1.8-specific stubs for others who might find them useful?

We could use a typeshed-style model, with a "common" directory for cross-compatible stubs and then "1.8" and "1.10" directories with version-specific override stub files. And then a script to build a single combined directory for a given Django version. I'd be happy to implement this, if you are open to the approach.

@dmoisset
Copy link
Contributor

Hi, contributions would be nice! My goal right now is doing the infrastructure needed to get annotations into upstream django (automating stub generation a bit on the mypy level so it can go into CI which from a thread in django-developers last week seems to be an important concern), and which simplified the versioning issue a bit, but only for future versions.

I haven't put much thought into past versions, but if someone like you finds this valuable it's a good chance to discuss how is the best way to package and distribute this so users can get access to the correct stubs in a simple and usable way (that also may require some help at the mypy level). How do you imagine that the workflow would be for the user with the script approach you suggest?

@carljm
Copy link
Author

carljm commented May 27, 2017

Basically I was thinking we'd provide a script that would build a single unified stub directory for a given Django version, and then it would be up to the user to put that directory on their MYPYPATH. So e.g. in the source mypy-django tree we'd have a large common directory of stubs that apply to all/most versions, and then smaller version-specific directories, and the script would effectively cp -r the common directory to an output dir, then cp -r the version-specific files over top of that.

I suppose an alternative would be to provide a script that just builds an ordered pair of MYPYPATH entries for the user, for a given Django version. Where the first entry in the generated MYPYPATH entries would be to the version-specific dir, and the second to the common dir.

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

No branches or pull requests

2 participants