Skip to content

Lessen dmypy suggest path limitations for Windows machines #19337

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CoolCat467
Copy link

In this pull request, we allow dmypy suggest absolute paths to contain the drive letter colon for Windows machines. Fixes #19335.

This is done by changing how find_node works slightly, allowing there to be at most two colon (:) characters in the passed key for windows machines instead of just one like on all other platforms, and then using rsplit and a split limit of 1 instead of just split like prior.

I was looking at the existing tests for dmypy suggest and noticed nothing is testing absolute paths for any platform, so I am unsure what I need to do to add tests; This sounds like maybe it could require changes to the test framework system, and I'd like feedback from others before trying to do that.

@CoolCat467 CoolCat467 changed the title Lessen dmypy suggest path limitations for Windows machine Lessen dmypy suggest path limitations for Windows machines Jun 25, 2025
@brianschubert
Copy link
Member

I wonder if it would make sense to just remove the key.count(":") check

@CoolCat467
Copy link
Author

That could certainly be an option, or make it always max of 2 if a platform check is unacceptable.

This comment has been minimized.

Copy link
Collaborator

@sterliakov sterliakov left a comment

Choose a reason for hiding this comment

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

LG! Added a comment suggestion (it wouldn't be immediately obvious to me why a second colon should be allowed on windows) - feel free to ignore if you think it's me too used to convenient devenv and any normal person should immediately understand that:)

Co-authored-by: Stanislav Terliakov <50529348+sterliakov@users.noreply.github.com>
Copy link
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mypy daemon suggest does not accept windows paths
3 participants