-
This is again for SQLAlchemy. Suppose typeshed releases a set of stubs for a library that's at version 3.0 then the library in question releases version 4.0, it's the same package on pypi, but has major API changes - not just new APIs, but changes to argument signatures, methods removed, etc. Suppose the package releases a stubs setup, and they also update that, so there's mypackage-stubs 3.0, and mypackage-stubs 4.0. How does typeshed accommodate that? do they just replace the stubs and all users of version 3.0 of the library no longer have accurate stubs in typeshed? That's the first part of my question. The more difficult part is that SQLAlchemy 2.0 is inlining all of the typing. Meaning, the presence of sqlalchemy-stubs in typeshed at all will break our library for all users of typing tools. We have experimented with various ways of producing a "null-stubs" package, such as blank with just a py.typed file that's "partial", but type checkers in that case still fall back to what's in typeshed, ignoring the annotations in the library itself. At the moment, it looks like our approach would need to be that we fully generate pyi stubs using a stub generation tool and ship them anyway. typeshed would adopt these once SQLAlchemy 2.0 is fully released. This has many obvious downsides however. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
cc @CaselIT |
Beta Was this translation helpful? Give feedback.
-
Part 1: We just release stubs for the latest version. If someone is stuck on Edit: To clarify, if mypackage 4.x comes with type annotations, typeshed will be stuck on 3.x for 6 months or so, and after that, the stubs will be removed from typeshed. After that, they will still be available on pypi. Part 2: SQLAlchemy 1.x stubs are a mess. There is at least:
For 2.x, it would be awesome if SQLAlchemy would just come with inline type annotations, and we wouldn't have to deal with any of this. 1.x would still continue working. Typeshed wouldn't accept pull requests that add 2.x features, and we would instead tell people to uninstall |
Beta Was this translation helpful? Give feedback.
-
A quick note on the various stubs:
On a general note, I would recommend to constrain the types dependency similar to how the main dependency is constraint, e.g.:
This should work for the majority of cases. |
Beta Was this translation helpful? Give feedback.
Part 1: We just release stubs for the latest version. If someone is stuck on
mypackage
version 3.0, they can continue usingtypes-mypackage==3.0.x
. Any changes in typeshed will lead to automatically releasingtypes-mypackage==4.0.x
.Edit: To clarify, if mypackage 4.x comes with type annotations, typeshed will be stuck on 3.x for 6 months or so, and after that, the stubs will be removed from typeshed. After that, they will still be available on pypi.
Part 2: SQLAlchemy 1.x stubs are a mess. There is at least:
types-sqlalchemy
: maintained in typeshed, new, incomplete and mostly auto-generatedsqlalchemy-stubs
: a mypy plugin and related stubs, in dropbox's github: https://github.com/dropbox…