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

Use PIPX_HOME as given #1327

Open
garthk opened this issue Apr 7, 2024 · 1 comment
Open

Use PIPX_HOME as given #1327

garthk opened this issue Apr 7, 2024 · 1 comment

Comments

@garthk
Copy link

garthk commented Apr 7, 2024

Further to #1315 and #1320, it strikes me pipx should take and use the environment it's given so we can use symlinks to put that environment where we want.

Instead, pipx determines and uses the absolute path, putting us at greater risk of encountering the multiple incompatibilities it feels obliged to heavily discourage.

How to reproduce

mkdir -p "$HOME/.local"
where_we_want_it="$HOME/Library/Application Support/.local"
where_pipx_wants_it="$HOME/.local"
for dir in bin share state; do
    mkdir -p "$where_we_want_it/$dir"
    ln -sf "$where_we_want_it/$dir" "$where_pipx_wants_it/$dir"
done
pipx environment

Output:

⚠️ Found a space in the home path. We heavily discourage this, due to multiple
    incompatibilities. Please check our docs for more information on this, as
    well as some pointers on how to migrate to a different home path.
Environment variables (set by user):

PIPX_HOME=
PIPX_BIN_DIR=
PIPX_MAN_DIR=
PIPX_SHARED_LIBS=
PIPX_DEFAULT_PYTHON=
PIPX_FETCH_MISSING_PYTHON=
USE_EMOJI=

Derived values (computed by pipx):

PIPX_HOME=/Users/me/Library/Application Support/.local/state/pipx
PIPX_BIN_DIR=/Users/me/Library/Application Support/.local/bin
PIPX_MAN_DIR=/Users/me/Library/Application Support/.local/share/man
PIPX_SHARED_LIBS=/Users/me/Library/Application Support/.local/state/pipx/shared
PIPX_LOCAL_VENVS=/Users/me/Library/Application Support/.local/state/pipx/venvs
PIPX_LOG_DIR=/Users/me/Library/Application Support/.local/state/pipx/logs
PIPX_TRASH_DIR=/Users/me/Library/Application Support/.local/state/pipx/.trash
PIPX_VENV_CACHEDIR=/Users/me/Library/Application Support/.local/state/pipx/.cache
PIPX_STANDALONE_PYTHON_CACHEDIR=/Users/me/Library/Application Support/.local/state/pipx/py
PIPX_DEFAULT_PYTHON=/opt/homebrew/opt/[email protected]/libexec/bin/python
USE_EMOJI=true

Expected behavior

Environment variables (set by user):

PIPX_HOME=
PIPX_BIN_DIR=
PIPX_MAN_DIR=
PIPX_SHARED_LIBS=
PIPX_DEFAULT_PYTHON=
PIPX_FETCH_MISSING_PYTHON=
USE_EMOJI=

Derived values (computed by pipx):

PIPX_HOME=/Users/me/.local/state/pipx
PIPX_BIN_DIR=/Users/me/.local/bin
PIPX_MAN_DIR=/Users/me/.local/share/man
PIPX_SHARED_LIBS=/Users/me/.local/state/pipx/shared
PIPX_LOCAL_VENVS=/Users/me/.local/state/pipx/venvs
PIPX_LOG_DIR=/Users/me/.local/state/pipx/logs
PIPX_TRASH_DIR=/Users/me/.local/state/pipx/.trash
PIPX_VENV_CACHEDIR=/Users/me/.local/state/pipx/.cache
PIPX_STANDALONE_PYTHON_CACHEDIR=/Users/me/.local/state/pipx/py
PIPX_DEFAULT_PYTHON=/opt/homebrew/opt/[email protected]/libexec/bin/python
USE_EMOJI=true
@Gitznik Gitznik added enhancement New feature or request macOS labels Apr 7, 2024
@Gitznik
Copy link
Contributor

Gitznik commented Apr 7, 2024

The main reason we can't support paths with spaces on mac is that shebangs don't support spaces in the interpreter path. All applications installed via pipx are installed via pip, which creates a script with a shebang at the top, defining the interpreter of the venv to use.

Using your approach, does it use the symlinked location in the interpreter path, or the absolute one? You can find it via

head -2 $(which pycowsay)

(assuming you have pycowsay installed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants