Skip to content

Further annotate sqlalchemy.engine and collections - #6680

Merged
Akuli merged 24 commits into
python:masterfrom
srittau:sqlalchemy-engine
Jan 9, 2022
Merged

Akuli merged 24 commits into
python:masterfrom
srittau:sqlalchemy-engine

Conversation

@srittau

@srittau srittau commented Dec 24, 2021

Copy link
Copy Markdown
Collaborator

No description provided.

@Akuli Akuli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I read about half of this in detail.

Comment thread stubs/SQLAlchemy/sqlalchemy/dbapi.pyi
Comment thread stubs/SQLAlchemy/sqlalchemy/dialects/firebird/fdb.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/base.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/base.pyi
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/base.pyi Outdated
url: str
dialect: Dialect
logging_name: str # only exists if not None during initialization
echo: echo_property

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe this should be ClassVar, because the class has an instance of echo_property. Or just echo: _EchoFlag, since the underlying echo_property instance is an implementation detail?

@srittau srittau Jan 2, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how well class vars play together with the descriptor protocol. @property is usually not wrapped in ClassVar either.

I just tried to use just echo: _EchoFlag, and while it should work, stubtest complains, so I opted for the version that requires less stubtest overrides.

@Akuli

Akuli commented Dec 30, 2021

Copy link
Copy Markdown
Collaborator

It would be nice to see sqlalchemy-stubs types migrated here, because we can be confident they are already correct enough to be usable.

@srittau

srittau commented Dec 30, 2021

Copy link
Copy Markdown
Collaborator Author

It would be nice to see sqlalchemy-stubs types migrated here, because we can be confident they are already correct enough to be usable.

That's my plan after migrating the stubs from https://github.com/srittau/python-stubs/tree/master/stubs/sqlalchemy. I know that the latter work for my use case. :)

@srittau

srittau commented Dec 30, 2021

Copy link
Copy Markdown
Collaborator Author

(I will look at the other comments later/in the next few days.)

@Akuli Akuli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry for taking so long to review the rest of this.

A couple thoughts:

  • There now seems to be 4 different sqlalchemy stubs out there: sqlalchemy-stubs, whatever zzzeek works on (python/typing#999), https://github.com/srittau/python-stubs, and the stubs in typeshed. Is this really a good thing?
  • This PR took a lot of time to review. I would have appreciated splitting it up into smaller pull requests.

Comment thread stubs/SQLAlchemy/sqlalchemy/engine/base.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/future/engine.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/result.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/mock.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/create.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/base.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/base.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/interfaces.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/interfaces.pyi Outdated
Comment thread stubs/SQLAlchemy/sqlalchemy/engine/url.pyi Outdated
@Akuli
Akuli merged commit 67c5d73 into python:master Jan 9, 2022
@srittau
srittau deleted the sqlalchemy-engine branch January 9, 2022 17:32
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