executed.
This is a logical change. If the command is `pip install ...`, then you
don't need to look for `python -m pip install ...` in the same command.
Either you have `pip install ...` or `python -m pip install ...`
or something completely different.
The tests showed that the original implementation actually never worked.
You did NOT get a rehash after doing pip3.8 install, even when the
comments in the code said so.
--> replaced `\d` with [0-9] and slapped on a `+`, such that we match
both pip3.x and `pip3.xx install`
Using the brand new isolated_environment functionality in
test_helper.bash to set up a fresh and clean environment where we can
use pyenv to install a clean python version, and then check whether we
are getting an automatic rehash after pip install.
We are checking:
- pip
- pip3
- pip3.12
- python -m pip
- python3 -m pip
- python3.12 -m pip
for automatic rehash.
Instead of creating a for-loop where we go through each argument, to
check if current argument is -m and next argument is pip, we instead do
simple regex matching where we look for ` -m pip ` somewhere in the
command which is to be executed.
When doing `pip install ...`, the command is redirected to
`pyenv.d/exec/pip-rehash/pip`, which does a `pyenv rehash` after
installation. A simple fix to issue #3031 is to make `python -m pip`
commands go through the same special hook script.
Now that ubuntu-24 is out of beta at Github
Since for ubuntu_build, we only use one OS version
and the changes between versions are not as drastic as with MacOS,
it seems safe to have it upgrade automatically.
* perf: replace a series of if statements with a case block. Add error
handling for case where unknown option is provided.
Same setup as rbenv-init for reading arguments.
* perf, docs: Recommend users to specify the shell for `pyenv init -`
Speeds up the startup by about 40% (in local testing, from ~50ms to ~30ms).
Reflect this in `pyenv init` hint text.
* style: remove unnecessary `root` variable in pyenv-init
* style: remove unnecessary variable declarations at the top of file in pyenv-init.
* perf: replace `cat <<` calls with `echo`
The builtin `echo` is about 100x faster. In tests, saves about 2-3ms.
* docs: document the `pyenv init - <shell>` performance boost in the Advanced Configuration section.
* style: test_helper.bash: avoid unnecessary ".." in produced PATH
* docs: fix a false statement about completions location in the Advanced Configuration section.
Requested in https://github.com/pyenv/pyenv/issues/2680
for deployments with a stock `.pyenv-version` that can use any
of a number of Python versions
and for compatibility with `uv`.
* Support `pyenv local --force`
* Support `pyenv-version-file-write --force`
* Support `pyenv version-name --force`
* Ignore missing versions when searching for executables
* Display "commmand not found" even when there are nonexistent versions
* exec.bats: replace `python` and `rspec` with something that doesn't exist globally, either
in Ubuntu Github CI, `python` exists globally