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

Replace types-SQLAlchemy requirement with SQLAlchemy in Flask-SQLAlchemy #8333

Closed
wants to merge 3 commits into from
Closed

Conversation

kkirsche
Copy link
Contributor

This removes the types-SQLAlchemy requirement from Flask-SQLAlchemy because the user may instead be using sqlalchemy-provided stubs rather than third-party stubs.

If there is a way to instead make this conditional, this should be closed and that approach should be used instead to isolate the version appropriately.

Kevin Kirsche added 2 commits July 19, 2022 13:56
This removes the types-SQLAlchemy requirement from Flask-SQLAlchemy because the user may instead be using sqlalchemy-provided stubs rather than third-party stubs.
@kkirsche kkirsche changed the title Remove types-SQLAlchemy requirement from Flask-SQLAlchemy Replace types-SQLAlchemy requirement with SQLAlchemy in Flask-SQLAlchemy Jul 19, 2022
@kkirsche
Copy link
Contributor Author

Sounds like maybe this should be an issue instead :/ from the pre-commit results

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AlexWaygood
Copy link
Member

AlexWaygood commented Jul 19, 2022

There's two things that don't make this possible yet, unfortunately:

  • We currently don't have the infrastructure set up to allow non-types dependencies in typeshed: Allow non-types dependencies #5768
  • SQLAlchemy now has inline type annotations for much of its code, and has a py.typed file on its master branch. But the most recent release (1.4.39) doesn't have a py.typed file. Without a py.typed file, the type annotations are only for internal use; a type-checker won't be able to see them and use them if SQLAlchemy is installed as a package. Until SQLAlchemy cuts a release with a py.typed file, typeshed's types-SQLAlchemy stubs will still be necessary.

@srittau
Copy link
Collaborator

srittau commented Jul 19, 2022

It's currently not possible to depend on non-type packages from typeshed packages. Also, SQLAlchemy doesn't ship with a py.typed file at the moment, so its type annotation won't be used. SQLAlchemy 2 will include the py.typed file if I understand correctly.

@kkirsche kkirsche closed this Jul 19, 2022
@kkirsche
Copy link
Contributor Author

Ah, that's too bad. I was really hoping it'd be possible to use the sqlalchemy sqlalchemy2-stubs with this type set as this would drastically simplify working with Flask-SQLAlchemy for users on 1.4 who use their official mypy stubs

@kkirsche
Copy link
Contributor Author

Thank you for the information though and sorry for the incorrect PR

@srittau
Copy link
Collaborator

srittau commented Jul 19, 2022

If there are useful types from sqlalchemy2-stubs that aren't in types-sqlalchemy yet, I believe it would be useful to have them integrated.

@AlexWaygood
Copy link
Member

No worries, thanks for the PR, even if it wasn't successful! :)

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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

Successfully merging this pull request may close these issues.

3 participants