Task: type-check sqlalchemy/test/typing/plain_files successfully
SQLAlchemy is a popular library that used to have a mypy plugin but, as of version 2.0, advertises itself as "fully pep-484 compliant" without the plugin. It has a typing test suite at https://github.com/sqlalchemy/sqlalchemy/tree/main/test/typing/plain_files. We should ensure we pass this test suite, so that Pyrefly is usable with SQLAlchemy.
I ran pyrefly check ~/sqlalchemy/test/typing/plain_files/ --search-path ~/sqlalchemy/lib/ --count-errors=0 to see how many errors we generate today. Note that the reveal-type and unknown-name errors are due to the tests using reveal_type to assert expected types; we should probably create a fork that uses assert_type instead.
Error counts:
476 instances of reveal-type
476 instances of unknown-name
37 instances of missing-attribute
14 instances of bad-argument-type
10 instances of bad-context-manager
10 instances of bad-specialization
2 instances of missing-argument
2 instances of bad-return
2 instances of index-error
2 instances of no-matching-overload
1 instances of bad-assignment
1 instances of bad-override
INFO 557 errors
hey, that's pretty good! only a few dozen errors
This issue has someone assigned, but has not had recent activity for more than 2 weeks.
If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.
Thank you for your contributions!
I'm still planning to work on this.
Fixing https://github.com/facebook/pyrefly/issues/954 shaved off a fair number of errors =D
476 instances of reveal-type
476 instances of unknown-name
29 instances of bad-argument-type
5 instances of missing-argument
3 instances of unbound-name
2 instances of index-error
2 instances of no-matching-overload
1 instances of bad-assignment
1 instances of bad-specialization
1 instances of missing-attribute
1 instances of bad-return
1 instances of bad-override
INFO 522 errors
I created a sqlalchemy fork that changes its typing tests to (1) use assert_type instead of reveal_type for checking types and (2) have # pyrefly: ignore comments everywhere a mypy error is expected: https://github.com/rchen152/sqlalchemy/tree/typing. (Make sure you check out the "typing" branch.)
The pyrefly command to run is (assuming you've cloned sqlalchemy into your home dir):
pyrefly check ~/sqlalchemy/test/typing/plain_files/ --search-path ~/sqlalchemy/lib/ --remove-unused-ignores --count-errors=0
The --remove-unused-ignores is to make sure pyrefly actually emits errors where errors are expected. The output is:
37 instances of assert-type
3 instances of bad-override
3 instances of unbound-name
2 instances of bad-argument-type
2 instances of no-matching-overload
1 instances of bad-assignment
1 instances of bad-specialization
1 instances of missing-attribute
INFO 50 errors (34 ignored)
INFO Removed 2 unused error suppression(s) in 1 file(s)
One # pyrefly: ignore is removed (see https://github.com/facebook/pyrefly/issues/1309 - it's a bug that it reports two removed) from https://github.com/rchen152/sqlalchemy/blob/f98fdcd13355dc2d451a6004b7b215ade226cf5a/test/typing/plain_files/engine/engine_result.py#L20, due to pyrefly not catching an index out of range error.
This issue has someone assigned, but has not had recent activity for more than 2 weeks.
If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.
Thank you for your contributions!
I'm still planning to work on this.
This issue has someone assigned, but has not had recent activity for more than 2 weeks.
If you are still working on this issue, please add a comment so everyone knows. Otherwise, please unassign yourself and allow someone else to take over.
Thank you for your contributions!
Latest status:
22 instances of assert-type
16 instances of deprecated
3 instances of bad-override
3 instances of unbound-name
2 instances of bad-argument-type
2 instances of no-matching-overload
1 instances of bad-assignment
1 instances of bad-specialization
1 instances of missing-attribute
INFO 35 errors (35 suppressed)
INFO Removed 0 unused error suppression(s) in 0 file(s)