sbdchd / django-types

:doughnut: Type stubs for Django
MIT License
202 stars 63 forks source link

Specify supported django version for package #96

Open last-partizan opened 2 years ago

last-partizan commented 2 years ago

I was reading PEP 561 and it says

stub-only distributions SHOULD indicate which version(s) of the runtime package are supported by indicating the runtime distribution's version(s) through normal dependency data.

Which django-types are not specifying. This can lead to some unexpected results, like: we're using django 3.1, but type checker won't stop me from using @admin.display decorator which was added in 3.2.

last-partizan commented 2 years ago

I'm raising this issue again, @sbdchd please take a look.

Django 4 removed this import, but django-types doesn't. I would be really helpful when upgrading django to see this type of issues.

https://github.com/sbdchd/django-types/blob/46e3a877aabcefacfd3021c36be9ddd4bc3a0a99/django-stubs/contrib/admin/__init__.pyi#L14

sbdchd commented 2 years ago

Hmm on the one hand if we say we only support >3 something <4 something we'd prevent people from accessing the wrong thing, but we'd also prevent people using 4 from getting value from the stubs

last-partizan commented 2 years ago

I think, we need to make separate branch for 3.x and release version specifically for 3.x django with correctly set requirements. And then - main branch should target latest django. When next major django version is out, we're creating new branch for previous one, and again main targeting latest.

sbdchd commented 2 years ago

Ah yeah that makes sense, I think we'd need some github actions / CI jobs to make the release process smoother, right now I'm doing things pretty manually

knyghty commented 2 years ago

FWIW, django-stubs recently made some changes so it's only supporting 3.2. If this project would support more modern versions (as separate branches or however you like) I'd be very inclined to make the switch and start contributing types for 4.0 (and 4.1) here.

last-partizan commented 2 years ago

@sbdchd yeah, that would be great.

I'm not familiar with Circle CI, do you think it's better alternative to github actions?

Maybe switch CI to github actions? I can help with that.

last-partizan commented 2 years ago

(And after adopting github actions, release is simple enough https://github.com/pypa/gh-action-pypi-publish)

last-partizan commented 2 years ago

https://github.com/last-partizan/django-types/pull/1/checks

Also, we can add stubtest django to pipeline, when we decide on what versions to support. stubtest itself is currently crashing by default becouse of django not being configured, in my example i just patched it not to crash.