Thanks to visit codestin.com
Credit goes to github.com

Skip to content

create new package, or new sqlalchemy2-stubs version, that is essentially null typing #7555

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

Closed
zzzeek opened this issue Jan 10, 2022 · 4 comments
Labels
alchemy 2 goes along with the 2.0 milestone to aid in searching typing pep -484 typing issues. independent of "mypy"
Milestone

Comments

@zzzeek
Copy link
Member

zzzeek commented Jan 10, 2022

moving discussion from microsoft/pylance-release#840 (comment)

tasks:

  1. create either a new version of sqlalchemy2-stubs, or a new package completely sqlalchemy-null-stubs, that installs only a py.typed file, which includes a directive for "partial" (this from Provide an option to disable specific stubs in settings microsoft/pylance-release#840 (comment) )
  2. installing this package will prevent any pre-packaged sqlalchemy-stubs from taking effect.

remaining Q is if this is a new version of sqlalchemy2-stubs, how to ensure the correct version of the stubs is installed for the current SQLAlchemy version they have installed. I do not want the SQLAlchemy version itself to change.

So the requirement is:

  1. user has SQLAlchemy 1.4 installed. They say "pip install sqlalchemy2-stubs". They get the fully annotated stubs version, SQLAlchemy 1.4 installation is unchanged.
  2. user has SQLAlchemy 1.4 installed as well as sqlalchemy2-stubs. They say "pip install sqlalchemy2-stubs --upgrade". they get the latest fully annotated version of sqlalchemy2-stubs, SQLAlchemy 1.4 installation is unchanged.
  3. user has SQLAlchemy 2.0 installed. They say one of: "pip install sqlalchemy2-stubs" or "pip install sqlalchemy-null-stubs". The null version of the stubs is installed, replacing any existing sqlalchemy-stubs packages. SQLAlchemy 2.0 installation is unchanged.
@zzzeek zzzeek added alchemy 2 goes along with the 2.0 milestone to aid in searching typing pep -484 typing issues. independent of "mypy" labels Jan 10, 2022
@zzzeek zzzeek added this to the 2.0 milestone Jan 10, 2022
@zzzeek
Copy link
Member Author

zzzeek commented Jan 10, 2022

in our last episode, @CaselIT said:

I think this is possible. We could provide a version on pypi, (let's call it 2.0) that has sqlalchemy >= 2 in the requirements.
Then we can continue to publish other non-empty version of the stub using sqlalchemy < 2 as requirements.
Pip should understand these constraints, and newer version of pip will also report if a non compatible version is installed

then @zzzeek said:

also, someone has sqlalchemy 1.4 installed. then they say, "pip install sqlalchemy2-stubs --upgrade". isnt that going to bump their SQLAlchemy to 2.0 ? id rather not have it work that way.

then @CaselIT said:

I think so, but pip will then print an error because of incompatible dependencies

@zzzeek
Copy link
Member Author

zzzeek commented Jan 10, 2022

then @CaselIT said:

I think so, but pip will then print an error because of incompatible dependencies

I dont understand. If I install package X which requires Y >= 2.0, it will install Y >= 2.0, im not familiar with what the error would be, unless they have their requirements pinned which is not the norm for development environments.

Also, I'd like the stubs package to be installable, and upgradable in the 1.4 series if not also the 2.0 series, without it printing any errors.

to my mind it seems much simpler to make a new package sqlalchemy-null-stubs and be done with it. advantages include:

  1. no "branchy" development with sqlalchemy2-stubs, i.e. we'd otherwise need a "1.4" and a "2.0" branch
  2. sqlalchemy-null-stubs doesnt need to be linked to any version anywhere, we can put it on pypi once and then probably not have to ever change it

disadvantages:

  1. we have to tell users to change which package they are installing

for the "new sqlalchemy2-stubs" version I'm not understanding yet how that would work so i need to understand that first.

@CaselIT
Copy link
Member

CaselIT commented Jan 10, 2022

I would have to do some tests, but from memory I think pip does this.
I had not considered the --upgrade that will also update other packages.

@zzzeek
Copy link
Member Author

zzzeek commented Jan 17, 2022

after some discussion with typing developers this approach won't be necessary, nor does it work in any case (type checkers always fall back to typeshed when the stubs are missing some module). When SQLAlchemy 2.0 is released, typeshed will remove SQLAlchemy stubs from their project which will resolve the issue for the downstream typecheckers.

@zzzeek zzzeek closed this as completed Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alchemy 2 goes along with the 2.0 milestone to aid in searching typing pep -484 typing issues. independent of "mypy"
Projects
None yet
Development

No branches or pull requests

2 participants