[ty] Add support for Debian/Ubuntu dist-packages directories#22466
[ty] Add support for Debian/Ubuntu dist-packages directories#22466
dist-packages directories#22466Conversation
Typing conformance resultsNo changes detected ✅ |
|
|
This is a Claude PR, which I haven't had time to validate yet (thus it's still in draft). I'm putting it up as a starting point for contribution by anyone motivated to help get this issue fixed faster. Contributions needed:
|
|
Tested that on my Ubuntu Resolute machine. Versions ( Showing all the broken cases before the final one that works (as expected): It seems to work fine. Also working fine as an LSP plugged to Obviously the above configuration makes the check to pass without extra CLI arguments: Thanks for that work! 💚 |
|
Just tried this patch - seems to solve my issue described in astral-sh/ty#2412 as well 😄 🥳 |
b85fe60 to
ea6393e
Compare
|
I fired up a Debian VM and double-checked this PR against the paths I found there; it all looks good to me. |
|
Thanks @Hyask and @sillydan1 for confirmation that this fixes your use cases! |
This change adds support for discovering `dist-packages` directories alongside `site-packages` directories. On Debian/Ubuntu systems, system-installed Python packages are placed in `dist-packages` rather than `site-packages`. The implementation adds: - A `relative_dist_packages_path` method mirroring `relative_site_packages_path` - Checks for version-specific dist-packages (e.g., `/usr/lib/python3.12/dist-packages`) - Support for Debian's version-agnostic `/usr/lib/python3/dist-packages` path - Updated fallback enumeration to discover dist-packages when iterating directories Closes astral-sh/ty#1323
ea6393e to
bdd9cad
Compare
|
Additionally: I've been daily-driving this patch for the last 3 weeks, in many different codebases. So far so good. I can't say that I've hit every corner cases, but at least the test coverage has definitely expanded! |
This change adds support for discovering
dist-packagesdirectories alongsidesite-packagesdirectories. On Debian/Ubuntu systems, system-installed Python packages are placed indist-packagesrather thansite-packages.The implementation adds:
relative_dist_packages_pathmethod mirroringrelative_site_packages_path/usr/lib/python3.12/dist-packages)/usr/lib/python3/dist-packagespathThis PR is mostly Claude, but I checked the paths used in the PR on a real Debian system and everything seems to line up; several users also report that this PR fixes their use case.
Closes astral-sh/ty#1323