Improvement: Follow XDG config spec
An old issus was closed regarding XDG: https://github.com/pyenv/pyenv/issues/139 - but that was 7 years ago now. Since then the XDG spec have become much more predominant. Many common tools follow it.
This issue is created to re-evaluate where pyenv is installed by default, using the XDG config and data dirs as appropriate. This gives a cleaner home directory for users, and users will also know that files placed in $XDG_CONFIG_HOME or the default $HOME/.config, are files that I as a user can manually update. And then also sync via dotfiles between machines, if wanted.
Prerequisite
- [ x] Make sure your problem is not listed in the common build problems.
- [ x] Make sure no duplicated issue has already been reported in the pyenv issues. You should look for closed issues, too.
- [x ] Make sure you are not asking us to help solving your specific issue.
- GitHub issues is opened mainly for development purposes. If you want to ask someone to help solving your problem, go to some community site like Gitter, StackOverflow, etc.
- [x ] Make sure your problem is not derived from packaging (e.g. Homebrew).
- Please refer to the package documentation for the installation issues, etc.
- [x ] Make sure your problem is not derived from plugins.
- This repository is maintaining
pyenvand the defaultpython-buildplugin only. Please refrain from reporting issues of other plugins here.
- This repository is maintaining
Description
- [ x] Platform information (e.g. Ubuntu Linux 16.04): Ubuntu 20.04
- [ x] OS architecture (e.g. amd64): amd64
- [ x] pyenv version: 1.2.22
- [ x] Python version: 3.8.7
- [ x] C Compiler information (e.g. gcc 7.3): 9.3
- [x] Please attach verbose build log as gist
- You can turn on verbose debug logging using by setting
PYENV_DEBUG=1, e.g.env PYENV_DEBUG=1 pyenv install -v 3.6.4
- You can turn on verbose debug logging using by setting
I don't see anything in https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html about software installed per-user which Pyenv is in the stock setup as are its Python installations. So that spec doesn't apply to it AFAICS.
XDG_DATA_HOME is used for this, at least in other tools I use. Quick example: https://github.com/jorgebucaran/nvm.fish
share is for platform-independent data (thus the name "share" i.e. shared between architectures). Python is platform-dependent.
There are plenty of tools that are platform-dependent tools using the XDG config spec. The spec was made for per-user tools, so I am pretty sure the smart guys who made this thought of this.
Having read https://bbs.archlinux.org/viewtopic.php?id=227166 which explains how XDG relates to the FHS, it's clear that installed software is outside of XDG and paths to it are pointed to by other envvars:
~/.local/bin ← PATH ~/.local/etc ← XDG_CONFIG_HOME ~/.local/include ~/.local/lib ← LD_LIBRARY_PATH ~/.local/opt ~/.local/share ← XDG_DATA_DIRS ~/.local/srv ~/.local/var/cache ← XDG_CACHE_HOME ~/.local/var/lib ← XDG_DATA_HOME ~/.local/var/log ← XDG_LOG_HOME (not standard, but I set and use it anyway)
Pyenv uses the /opt approarch -- because it allows to manage an installation and allow multiple side-by-side installations without a package manager. Placing stuff under a shared location wouldn't allow that.
So it anything, it should be moved to ~/.local/opt.
I am fine with that, as long as it does not clutter up the space directly under the home directory. Most Linux tools out there have moved into the XDG_CONFIG_SPEC and comparing the home directory to a few years ago, it is much cleaner in this regard.
Feel free to submit a PR to change the default installation directory and link to this discussion.
https://github.com/pyenv/pyenv-installer will need a PR to do the same as well.