-
Notifications
You must be signed in to change notification settings - Fork 486
Support different backends #1487
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for working on this feature! Some initial thoughts.
Per #1539 (comment), we should consider adding the |
It seems like uv doesn't have this issue since it doesn't carry extra seed packages by default:
|
shared_libs.create(verbose=self.verbose, pip_args=pip_args) | ||
if not override_shared and (self.backend != "uv" or self.installer != "uv"): | ||
pipx_pth = get_site_packages(self.python_path) / PIPX_SHARED_PTH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the shared
environment still be injected/exist after this or should it only be used (and thus maybe renamed) as the environment holding pip
and allowing "{shared_libs.python_path}" -m pip --python "{self.python_path}"
being used as an installer (rather than "{self.python_path}" -m pip
in _run_pip
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using --python
option sounds reasonable, but would there be any scenarios where users would prefer to keep the .pth
file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that comes to mind would be if they were directly running python in an app venv to run pip instead of using pipx runpip
.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for different virtual environment backends and installers, allowing users to choose between uv, venv, and virtualenv for the backend and between uv and pip for installation. Key changes include updated tests for backend/installer functionality, modifications to venv creation and inspection to store backend/installer data, and enhanced CLI argument parsing to accept these new options.
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/* | Added tests for custom backend and installer behavior |
tests/conftest.py | Cleared environment variables for backend and installer |
src/pipx/venv_inspect.py | Extended metadata signature to include backend and installer |
src/pipx/venv.py | Updated Venv constructor and methods to support backend/installer logic |
src/pipx/util.py | Renamed pip error handler to installer error handler |
src/pipx/pipx_metadata_file.py | Extended metadata version and included backend/installer fields |
src/pipx/main.py | Updated CLI options to pass backend and installer |
src/pipx/commands/* | Updated commands (install, upgrade, run, reinstall, interpreter) to pass backend/installer |
src/pipx/backend.py | Introduced DEFAULT_BACKEND, DEFAULT_INSTALLER and supported values |
noxfile.py | Added uv and virtualenv as test dependencies |
mkdocs.yml, docs/* | Updated documentation to include backend usage and examples |
changelog.d/1392.feature.md | Added changelog entry for supporting different backends/installers |
Files not reviewed (1)
- testdata/pipx_metadata_multiple_errors.json: Language not supported
changelog.d/
(if the patch affects the end users)Summary of changes
Closes #1392
This allows users to choose from different backends and also speeds up the installation process.
Test plan
Tested by running