1) Got rid of useless call to `cat`, much better to simply use sed with
file as argument.
2) Got rid of `sort -u`. There is no need to sort the list.
Additionally, the list `pyenv.d/rehash/conda.d/default.list` only has
unique entries, and even if you have duplicate entries, the function
will still work. --> No need for sort nor unique.
3) Further improvement is simple, save a cached
cleaned-list-v1.0 in `conda.d` and simple read from that file instead of
doing `sed`, which must be a more expensive operation than simply
reading from file.
Applies to the conda blacklist in `pyenv.d/rehash/conda.d/default.list`
No practical difference, but it looks misplaced when it sits at the end
of the file.
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