microsoft / python-type-stubs

A set of type stubs for popular Python packages. These are works in progress from the Microsoft Python team and others, with the intent that they are contributed to typeshed or to the associated packages once sufficiently complete.
MIT License
249 stars 96 forks source link

SQLAlchemy both obsolete and upstreamed to typeshed #276

Closed Avasam closed 1 year ago

Avasam commented 1 year ago

With SQLAlchemy 2.0.0's release a while back, these stubs are conflicting with the official type annotations. For legacy 1.4 support, https://github.com/python/typeshed/pull/9597 finishes making the typeshed stubs on par with this one.

debonte commented 1 year ago

@Avasam, do you expect that https://github.com/python/typeshed/pull/9597 will be merged soon?

Since Pylance bundles both these stubs and typeshed, won't SQLAlchemy 2.0 users continue to have stub conflicts if/when both of these PRs are merged?

Avasam commented 1 year ago

Good point about pyright, but at least they won't have 3 different behaviours between runtime, cli and IDE. That'll resolve itself in July with https://github.com/python/typeshed/issues/9607

No ETA on https://github.com/python/typeshed/pull/9597, but I can say that typeshed maintainers are going through some of my bigger PRs right now. I'll mark this here PR as draft until that one is merged over at typeshed.

debonte commented 1 year ago

I'll mark this here PR as draft until that one is merged over at typeshed.

@Avasam, I don't understand why we would delay this PR. Isn't the goal to remove the stubs from both here and typeshed? Shouldn't we be encouraging SQLAlchemy users to upgrade to 2.0?

Avasam commented 1 year ago

I don't think it would encourage users either way because of the pyright including Alchemy Stubs issue you mentioned. So I'm not weighting in SQLAlchemy 2.0 users in my reasoning.

The reasoning is just that if it's removed now, Pylance (not pyright) users on SQLAlchemy 1.4 will have a moment until https://github.com/python/typeshed/pull/9597 where they'll loose some type information. It is imo very minor so if you don't care about that, I can mark as ready and feel free to merge.


Edit: Your suggestion at https://github.com/microsoft/pylance-release/issues/3702#issuecomment-1542658953 would resolve both minor concern too.

debonte commented 1 year ago

Despite the existence of the stubs in this repo, it turns out that Pylance stopped bundling these sqlalchemy stubs in 2022.3.3-pre.1 (March 16, 2022).

I'd like to delete them from here. Feel free to continue using them as a reference for changes in typeshed as needed.

Edit: Your suggestion at https://github.com/microsoft/pylance-release/issues/3702#issuecomment-1542658953 would resolve both minor concern too.

@rchiodo and I concluded that this wouldn't work because the stubs would be downloaded to a global (not workspace-specific) location and therefore anyone who had both SQLAlchemy 1.x and SQLAlchemy 2.0 projects would end up with the same problem -- stubs downloaded and causing issues in their 2.0 projects.

Avasam commented 1 year ago

Despite the existence of the stubs in this repo, it turns out that Pylance stopped bundling these sqlalchemy stubs in 2022.3.3-pre.1 (March 16, 2022).

Oh awesome. Let's get this removed then.