Skip to content

Remove Flask-SQLAlchemy #9989

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
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"stubs/dateparser",
"stubs/docutils",
"stubs/Flask-Migrate",
"stubs/Flask-SQLAlchemy",
"stubs/fpdf2",
"stubs/html5lib",
"stubs/httplib2",
Expand Down
4 changes: 2 additions & 2 deletions stubs/Flask-Migrate/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version = "4.0.*"
# Requires a version of flask with a `py.typed` file
requires = ["Flask>=2.0.0", "types-Flask-SQLAlchemy"]
# Requires versions of flask/Flask-SQLAlchemy with `py.typed` files
requires = ["Flask>=2.0.0", "Flask-SQLAlchemy>=3.0.1"]
Copy link
Member

@AlexWaygood AlexWaygood Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figured it out. Because you're specifying Flask-SQLAlchemy as a dependency of types-Flask-Migrate, that then pulls in SQLAlchemy as a transitive dependency of types-Flask-Migrate (because SQLAlchemy is a dependency of Flask-SQLAlchemy). That means pip now install SQLAlchemy in CI before pyright tests any of the stubs and, because it's unpinned, pip installs the latest version of SQLAlchemy available. Because SQLAlchemy>=2 has inline types and a py.typed file, that means that pyright is now pointing out the inconsistencies between our stubs for SQLAlchemy<2 and the inline types it sees the site-packages directory for SQLAlchemy>=2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to fix this is another question. I'm open to ideas ://

Copy link
Collaborator

@Avasam Avasam Apr 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just add the missing generics. So that the stubs are on par enough with the 2.0 version for this PR to pass.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just add the missing generics. So that the stubs are on par enough with the 2.0 version for this PR to pass.

It feels like a somewhat fragile solution -- if SQLAlchemy makes more stuff generic on the 2.0 branch that isn't generic in our stubs for SQLAlchemy 1.0, and they then make a release, our CI will break unexpectedly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I think just waiting to remove them together, given their co-dependencies, just makes the most sense.


[tool.stubtest]
ignore_missing_stub = true
2 changes: 0 additions & 2 deletions stubs/Flask-SQLAlchemy/@tests/stubtest_allowlist.txt

This file was deleted.

6 changes: 0 additions & 6 deletions stubs/Flask-SQLAlchemy/METADATA.toml

This file was deleted.

97 changes: 0 additions & 97 deletions stubs/Flask-SQLAlchemy/flask_sqlalchemy/__init__.pyi

This file was deleted.

25 changes: 0 additions & 25 deletions stubs/Flask-SQLAlchemy/flask_sqlalchemy/model.pyi

This file was deleted.

3 changes: 0 additions & 3 deletions stubs/Flask-SQLAlchemy/flask_sqlalchemy/utils.pyi

This file was deleted.

4 changes: 0 additions & 4 deletions tests/pytype_exclude_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ stubs/SQLAlchemy/sqlalchemy/sql/functions.pyi
stubs/SQLAlchemy/sqlalchemy/sql/lambdas.pyi
stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi
stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi
stubs/Flask-SQLAlchemy/flask_sqlalchemy/__init__.pyi
stubs/Flask-SQLAlchemy/flask_sqlalchemy/model.pyi
stubs/Flask-SQLAlchemy/flask_sqlalchemy/utils.pyi

# Uncertain why pytype is giving an error
# pytype.pytd.visitors.ContainerError
stubs/openpyxl/openpyxl/descriptors/nested.pyi
Expand Down