Skip to content

sys.path change breaks editable installs of cwd #12956

Closed
@hauntsaninja

Description

@hauntsaninja

The new sys.path logic introduced in #11143 carefully avoids putting cwd onto sys.path, which is probably generally a good thing. However, the logic incorrectly removes cwd from sys.path in cases where the current directory has been editably installed (i.e. is on sys.path for reasons unrelated to being the current directory).

I'm not the most familiar with the code, but my understanding is this often doesn't really matter, since cwd should be on search_paths.python_path. However, it looks like we only look for stub packages on search_paths.package_path (which is where cwd is now removed from).

My concern here isn't theoretical. It came up in #12931 where when trying to reproduce, stubtest was unable to find the django stubs.

Depending on how serious we feel this concern is / how strictly backward compatible we want to be, there are several options for working around this. Curious for your opinions!

cc @AWhetter @ethanhs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions