Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wishlist: use $XDG_DATA_DIR #1364

Closed
legrostdg opened this issue Mar 8, 2017 · 10 comments
Closed

wishlist: use $XDG_DATA_DIR #1364

legrostdg opened this issue Mar 8, 2017 · 10 comments

Comments

@legrostdg
Copy link

It would be great if pylint could use $XDG_DATA_DIR to store its data (at least ~/.pylint.d).

@PCManticore
Copy link
Contributor

Why? What is XDG_DATA_DIR and why is it so important?

@legrostdg
Copy link
Author

Here is an explaination of why this matters: http://gk2.sk/the-ugly-duckling-called-xdg_config_home/

Here is the complete spec: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

@jleclanche
Copy link

@PCManticore I understand that adding more config path options is never great, but ideally this would deprecate ~/.pylintrc.

@PCManticore
Copy link
Contributor

This will never happen.

@MestreLion
Copy link

@PCManticore , care to reconsider that decision? Since this issue was opened, a LOT of software migrated to XDG Standard:

  • python and pip use ~/.local and ~/.cache extensively
  • git uses ~/.config/git/config if it exists, otherwise fallback to ~/.gitconfig
  • Firefox uses ~/.cache, (but not yet ~/.config)
  • GUI apps like Chrome/Chromium, LibreOffice, Deluge
  • Most DEs, such as Gnome and KDE, are champions of the standard

You don't need change current locations: just use the XDG ones if they exist, otherwise fall back to $HOME just like it is now. For current users absolutely nothing changes.

  • ~/.pylint.d/ is a perfect candidate for ~/.cache/pylint/ or ~/.local/share/pylint depending on how permanent that data is supposed to be.
  • ~/.pylintrc fits ~/.config/pylintrc very nicely.

It's very easy to implement, and I can provide a patch if it helps. The number of negative reactions alone on "This will never happen" is an indication how strong is the demand of this feature.

@stoladev
Copy link

Please consider adding this. I understand the hesitation 3+ years ago, but today we are seeing XDG become the new standard when it comes to the organization of everyone's program's configuration files, especially when we are getting into an age of many programs that have the potential of cluttering up our home directory. I'm a believer in the Unix philosophy, but it comes with the (hopefully temporary) downside of having everything in ~/.

I would say since 3 years ago, about 80-90% of the programs that I use (and have started using since) all hold their configuration files organized through XDG. The only ones that seem to have an issue with integrating this is Firefox (this is why I use Chromium now), Thunderbird (this is why I use Mutt now), and Tmux (sure, they added a check for a tmux folder in .config, but that still isn't XDG. XDG allows me to put my config files anywhere I please). Now, pylint is in that mix. I've enjoyed Pylint til now, and I don't want to change that.

Why do I love XDG so much? I can carry around my entire configuration on a USB, plug it into a computer I am working on, backup the person's directory listings, and utilize XDG. Then I don't have to worry that they already have Tmux, their own config for programs that I also use, etc. Finally, I leave without a trace and without any disturbance to the client's files/configs.

Again, please reconsider. Thank you for coming to my Ted Talk.

@unavaliabl3
Copy link

If you want move you pylint directory to $XDG_DATA_HOME, you can append

if [[ -d "$XDG_DATA_HOME/pylint" ]]
then
	export PYLINTHOME="$XDG_DATA_HOME/pylint"
fi

to your .bashrc, .zshrc, /etc/bash.bashrc,or /etc/zsh/zshenv and then create a "pylint" folder in your $XDG_DATA_HOME which is $HOME/.local/share by default.
reference : https://github.com/PyCQA/pylint/blob/master/pylint/config/__init__.py#L54-L62

@MestreLion
Copy link

If you want move you pylint directory to $XDG_DATA_HOME, you can append

if [[ -d "$XDG_DATA_HOME/pylint" ]]
then
	export PYLINTHOME="$XDG_DATA_HOME/pylint"
fi

to your .bashrc, .zshrc, /etc/bash.bashrc,or /etc/zsh/zshenv and then create a "pylint" folder in your $XDG_DATA_HOME which is $HOME/.local/share by default.
reference : https://github.com/PyCQA/pylint/blob/master/pylint/config/__init__.py#L54-L62

A few notes:

  • Instead of $XDG_DATA_HOME, always use ${XDG_DATA_HOME:-$HOME/.local/share}, so it gets the default path in case XDG_DATA_HOME is not set, as is the case in most systems.
  • I believe pylint already creates its data dir when it does not exist, no? If so, no need to test, simply export PYLINTHOME and pylint will do the rest:
export PYLINTHOME=${XDG_DATA_HOME:-$HOME/.local/share}/pylint

@quentin-ag
Copy link

It seems that the environment variable PYLINTRC could be used to set the path to the configuration variable.
Relevant code here, documented there.

I have not tested this, but the following should work:

export PYLINTRC="${XDG_CONFIG_HOME:-$HOME/.config}"/pylint/pylintrc

Together with the proposal from @rekaerst, it seems to address the issue. At least, pylint can be made to use the XDG base directories, even if a bit of configuration is required from the user.

@Pierre-Sassoulas
Copy link
Member

The default for PYLINTHOME will change in 2.10, see #4661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants