Skip to content

enable mypy "ignore-without-code" rule #12645

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aradkdj
Copy link
Contributor

@aradkdj aradkdj commented Jun 5, 2025

Description

Enable mypy "ignore-without-code" rule and apply the necessary fixes.

Not really a "small typing error fix" but I think that's the closest of the items from the checklist.

Checklist

This pull request is:

  • A documentation / typographical / small typing error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • please include the issue number, and create an issue if none exists, which
      must include a complete example of the issue. one line code fixes without an
      issue and demonstration will not be accepted.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests. one line code fixes without tests will not be accepted.
  • A new feature implementation
    • please include the issue number, and create an issue if none exists, which must
      include a complete example of how the feature would look.
    • Please include: Fixes: #<issue number> in the commit message
    • please include tests.

Have a nice day!

Enable mypy "ignore-without-code" rule and apply the necessary fixes.
@aradkdj aradkdj force-pushed the mypy-enable-ignore-without-code branch from 8de1599 to 02350ef Compare June 5, 2025 01:11
@aradkdj
Copy link
Contributor Author

aradkdj commented Jun 5, 2025

In its current state zimports and mypy are fighting over what they want from https://github.com/sqlalchemy/sqlalchemy/pull/12645/files#diff-1e16143a522e36ab9806250b0ebee01057001cbd8d51d03db7336d9c8a762c0bR207-R209. Mypy wnats the #type: ignore comment on line 207 but zimports really does not like it that way and the changes it introduces create a syntax error

@zzzeek
Copy link
Member

zzzeek commented Jun 5, 2025

yes, zimports has some deficiencies with imports that require comments. usually I put the imports into a condtiional like "if True:" in the hopes of getting zimports to skip over them.

if we could improve zimports to maintain comments or have a more comprehensive "ignore" option that would solve other problems as well

@aradkdj
Copy link
Contributor Author

aradkdj commented Jun 5, 2025

usually I put the imports into a condtiional like "if True:" in the hopes of getting zimports to skip over them.

I saw a couple of comments referencing that and tried it, but no luck.

To be honest I started working on this before 68cd3e8 landed and it was "equally broken" on main and my branch.

@CaselIT
Copy link
Member

CaselIT commented Jun 5, 2025

yes, zimports has some deficiencies with imports that require comments. usually I put the imports into a condtiional like "if True:" in the hopes of getting zimports to skip over them.

if we could improve zimports to maintain comments or have a more comprehensive "ignore" option that would solve other problems as well

maybe we can try to fix zimports to bend it to our will?

actually there is sqlalchemyorg/zimports#43, let's try finishing that

@CaselIT
Copy link
Member

CaselIT commented Jun 16, 2025

I've pushed a change to zimports that should support this usecase sqlalchemyorg/zimports#47

@aradkdj
Copy link
Contributor Author

aradkdj commented Jun 16, 2025

Awesome! Should I test it with this PR? I sould be able to just edit the dep in tox.ini, right?

@CaselIT
Copy link
Member

CaselIT commented Jun 17, 2025

it's not yet released, once it is sure

@CaselIT
Copy link
Member

CaselIT commented Jun 24, 2025

it has been released as 0.6.2 if you want to try it

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