posit-dev / posit-dev/positron
Surface package install origin (editable/local/VCS) in getPackages so requirements can be reconstructed faithfully
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 206
Description
The env-safety fix in #14328 (PR #14520) builds the pip install -r / uv pip install -r requirements file from the kernel's
installed-package list (getPackagesInstalled -> getPackages), naming every installed package so the resolver honors all constraints.
That list is name-only, so packages installed editable (-e), from a local path, or from a VCS URL are emitted as bare names.
That's correct for the common case, but bare-naming a non-PyPI package has edges when the resolver has to move it (a version conflict, or
Update All's --upgrade, which seeks a newer version of everything):
- A different package with the same name on the configured index could be substituted (name collision).
- Update All could fail with "no matching distribution" for a local-only package instead of keeping the installed copy.
Proposal
Surface install origin on LanguageRuntimePackage so package operations can emit a faithful requirement line for these packages instead of
a bare name.
- The Python kernel's
_get_packages_installedalready walksimportlib.metadata.distributions(); it can read each dist's PEP 610
direct_url.jsonto determine whether it was installed editable, from a local directory/archive, or from a VCS. - Add a field (e.g.
editable: booleanand/orsource/directUrl) toLanguageRuntimePackageinpositron.d.ts. - The pip/uv package managers then emit
name @ file://.../-e ...for those packages and bare names for the rest, eliminating both
edges above.
Some of this information is not portable to other languages, so we might want to consider supporting a generic type, like Map<string, string> instead of enumerating every possible field required per language.
Notes
- Enhancement: current bare-name behavior is correct for normal PyPI packages, which is the overwhelming majority.
See #14328.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing getPackagesInstalled through getPackages and the Python kernel’s _get_packages_installed, then inspect LanguageRuntimePackage in positron.d.ts and the pip/uv package managers. Confirm how PEP 610 direct_url.json represents editable, local, and VCS installs. Done means preserving those origins in package data and emitting faithful requirement lines while keeping ordinary packages as bare names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100