Skip to content
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

fix(deducer): use package name from dist-info instead of import name #325

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/selfish-bugs-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@plutolang/pyright-deducer": patch
---

fix(deducer): use package name from dist-info instead of import name

The package import name may differ from its actual package name. For instance, `pysqlite3-binary` is the package name, but it is imported as `pysqlite3`. This mismatch can cause the loss of required packages at runtime.
2 changes: 1 addition & 1 deletion components/deducers/python-pyright/src/import-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function getInstallableModule(module: ImportResult): InstalledModule {
const distInfos = getAllDistInfos(path.dirname(pkgPath));
for (const distInfo of distInfos) {
if (distInfo.topLevel.includes(pkgName)) {
return InstalledModule.create(pkgName, distInfo.version);
return InstalledModule.create(distInfo.name, distInfo.version);
}
}
}
Expand Down
Loading