pypa / pipx

Install and Run Python Applications in Isolated Environments
https://pipx.pypa.io
MIT License
9.51k stars 396 forks source link

Options before the verb are ignored #1461

Closed dechamps closed 1 week ago

dechamps commented 1 week ago
$ pipx --version
1.6.0
$ pipx install --verbose pycowsay
pipx >(setup:1083): pipx version is 1.6.0
pipx >(setup:1084): Default python interpreter is '/usr/bin/python3.11'
pipx >(package_name_from_spec:378): Determined package name: pycowsay
pipx >(package_name_from_spec:379): Package name determined in 0.0s
pipx >(create_venv:162): Creating virtual environment
creating virtual environment...
pipx >(run_subprocess:175): running /usr/bin/python3.11 -m venv --without-pip /home/e-t172/.local/pipx/venvs/pycowsay
pipx >(run_subprocess:175): running <checking pip's availability>
pipx >(run_subprocess:175): running /home/e-t172/.local/pipx/venvs/pycowsay/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:175): running /home/e-t172/.local/pipx/shared/bin/python -c import sysconfig; print(sysconfig.get_path('purelib'))
pipx >(run_subprocess:175): running /home/e-t172/.local/pipx/venvs/pycowsay/bin/python --version
pipx >(_parsed_package_to_package_or_url:139): cleaned package spec: pycowsay
pipx >(install_package:245): Installing pycowsay
installing pycowsay...
pipx >(run_subprocess:175): running /home/e-t172/.local/pipx/venvs/pycowsay/bin/python -m pip --no-input install pycowsay
pipx >(run_subprocess:175): running <fetch_info_in_venv commands>
pipx >(get_venv_metadata_for_package:349): get_venv_metadata_for_package: 25ms
pipx >(_parsed_package_to_package_or_url:139): cleaned package spec: pycowsay
pipx >(mkdir:76): creating directory /home/e-t172/.local/share/man/man6
  installed package pycowsay 0.0.0.2, installed using Python 3.11.9
  These apps are now globally available
    - pycowsay
  These manual pages are now globally available
    - man6/pycowsay.6
done! ✨ 🌟 ✨
$ pipx uninstall pycowsay
uninstalled pycowsay! ✨ 🌟 ✨
$ pipx --verbose install pycowsay
  installed package pycowsay 0.0.0.2, installed using Python 3.11.9
  These apps are now globally available
    - pycowsay
  These manual pages are now globally available
    - man6/pycowsay.6
done! ✨ 🌟 ✨

Basically: pipx install --verbose works, but pipx --verbose install silently ignores the --verbose option. This is surprising and error-prone.

This behavior not limited to the --verbose option. I actually discovered this by running pipx --global install - which seems like a natural way to use --global - and then got very confused when pipx went ahead and installed the package under my user instead!

pipx should either support options being passed before the verb, or at the very least the command should fail instead of silently ignoring the option.

huxuan commented 1 week ago

Close as duplicated with #1282.