pypa/pipx

Provide `ensurepath` with a check option or create an `init` command

Open

#1.014 geöffnet am 3. Juli 2023

Auf GitHub ansehen
 (8 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (363 Forks)batch import
enhancementhelp wanted

Repository-Metriken

Stars
 (7.844 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 2h) (16 gemergte PRs in 30 T)

Beschreibung

How would this feature be useful?

Currently, pipx ensurepath does not tell me what changes will it make. I would like to stay in control: see what changes it would make, and then decide if it's okay with me.

Describe the solution you'd like

  • Add a --check or --dry-run option that checks for necessary changes and outputs them.
    > pipx ensurepath --dry-run
    # append lines to ~/.config/fish/config.fish
    fish_add_path ~/.local/bin
    # ... and other configs
    

Describe alternatives you've considered

  • Add an init command that outputs the shell config changes - similarly to how pyenv does it:
    > pipx init --fish
    # Add this to your config.fish file if You haven't yet
    fish_add_path ~/.local/bin
    # ... other configs - similarly --zsh or --bash or --tcsh
    

Here is how pyenv does it:

> pyenv init
# Add pyenv executable to PATH by running
# the following interactively:

set -Ux PYENV_ROOT $HOME/.pyenv
set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths

# Load pyenv automatically by appending
# the following to ~/.config/fish/config.fish:

pyenv init - | source


# Restart your shell for the changes to take effect.

Contributor Guide