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

Support different backends #1487

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Support different backends #1487

wants to merge 24 commits into from

Conversation

dukecat0
Copy link
Member

@dukecat0 dukecat0 commented Jul 22, 2024

  • I have added a news fragment under 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.

Screenshot 2024-07-21 at 11 11 55 AM

Test plan

Tested by running

pipx install --backend uv --install uv black
pipx run --backend uv --installer uv black

Copy link
Contributor

@chrysle chrysle left a 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.

pyproject.toml Outdated Show resolved Hide resolved
src/pipx/backend.py Outdated Show resolved Hide resolved
src/pipx/commands/upgrade.py Outdated Show resolved Hide resolved
src/pipx/pipx_metadata_file.py Show resolved Hide resolved
src/pipx/venv.py Outdated Show resolved Hide resolved
src/pipx/venv.py Outdated Show resolved Hide resolved
@dukecat0 dukecat0 marked this pull request as ready for review July 23, 2024 06:56
@dukecat0 dukecat0 marked this pull request as draft July 23, 2024 06:59
src/pipx/venv.py Outdated Show resolved Hide resolved
src/pipx/venv.py Outdated Show resolved Hide resolved
src/pipx/backend.py Outdated Show resolved Hide resolved
src/pipx/backend.py Outdated Show resolved Hide resolved
src/pipx/venv.py Outdated Show resolved Hide resolved
src/pipx/venv.py Outdated Show resolved Hide resolved
src/pipx/venv.py Outdated Show resolved Hide resolved
@dukecat0 dukecat0 changed the title [WIP] Support different backends Support different backends Aug 24, 2024
@dukecat0 dukecat0 marked this pull request as ready for review August 24, 2024 13:29
src/pipx/backend.py Outdated Show resolved Hide resolved
@chrysle
Copy link
Contributor

chrysle commented Sep 8, 2024

Per #1539 (comment), we should consider adding the --no-seed option to the virtualenv (not sure concerning the uv mechanism) backend invocation.

@dukecat0
Copy link
Member Author

dukecat0 commented Sep 8, 2024

It seems like uv doesn't have this issue since it doesn't carry extra seed packages by default:

activate      activate.fish  activate_this.py  python
activate.bat  activate.nu    deactivate.bat    python3
activate.csh  activate.ps1   pydoc.bat	       python3.9

Comment on lines +202 to 204
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
Copy link
Member

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)

Copy link
Member Author

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?

Copy link
Member

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.

@dukecat0 dukecat0 requested a review from Gitznik September 27, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support different backends for pipx?
5 participants