I was doing some debugging with PYENV_DEBUG=1 and noticed that a lot of
work was being done in conda.bash, even though I had not installed any
conda versions like `mambaforge`.
The solution is pretty simple, put all the code inside an if-block.
This aligns with what @varikin found in his pull request #3037
Additionally, I have refactored the code slightly for readability
(created function `build_conda_exclusion_list`), and added comments
which should make it easier to understand what's going on.
This commit simplifies debugging and should reduce the execution time of
```bash
eval "$(pyenv init -)"
```
slightly.
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
* Reorganize readme, add gif
1. Details in 'Getting Pyenv' and 'Setup for your shell' are collapsed. User can expand relevant
sections depending on their platform and shell.
2. 'How It Works' and 'Advanced Configuration' are moved to the bottom of the README.md
just before 'Contributing' section at the end.
3. Added a GIF in the 'Usage' section to showcase
- Listing python versions available for install.
- Installing a specific python version.
- Listing installed python versions.
- Switching to another python version for a directory.
- Testing by moving terminal into the directory and moving back.
* Update GIF to show prefix resolution
* Collapse upgrade notes
* Cross-mention Linux and MacOS instlalation scenarios
---------
Co-authored-by: Ivan Pozdeev <vano@mail.mipt.ru>