Skip to content

Complete Flask-Migrate and mark as Strict #10971

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

Merged
merged 8 commits into from
Nov 9, 2023

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Nov 3, 2023

Thanks to typeshed-stats, I noticed Flask-Migrate had very little unannotated methods, so I decided to take a swing at it.

See comments below for more details

Comment on lines 27 to 29
output_buffer: TextIO | None = None,
stdout: TextIO = sys.stdout,
cmd_opts: Namespace | None = None,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TextIO and Namespace come directly from alembic's own inline types, but I have some concern about using those.
Namely if TextIO should be replaced by some buffer protocol.

Copy link
Collaborator

@srittau srittau Nov 6, 2023

Choose a reason for hiding this comment

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

I haven't looked at it, but generally for I/O types in input roles (e.g. arguments), protocols are preferred.

Copy link
Collaborator Author

@Avasam Avasam Nov 9, 2023

Choose a reason for hiding this comment

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

output_buffer: TextIO | None = None,
stdout: TextIO = sys.stdout,
cmd_opts: Namespace | None = None,
config_args: SupportsKeysAndGetItem[str, _AlembicConfigValue] | Iterable[tuple[str, _AlembicConfigValue]] = ...,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

config_args and attributes are used to create and update a dict respectively. I don't remember if it's better to type this as a Mapping like alembic did for config_args or maybe make a ConvertibleToDict type like in #10707

This comment has been minimized.

1 similar comment

This comment has been minimized.

This comment has been minimized.

@Avasam Avasam requested a review from srittau November 9, 2023 01:09

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks, one suggestion for type checker compatibility.

Copy link
Contributor

github-actions bot commented Nov 9, 2023

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

@srittau srittau merged commit b893289 into python:main Nov 9, 2023
@Avasam Avasam deleted the Flask-Migrate-strict branch November 9, 2023 17:41
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.

2 participants