Pylint: wishlist: use $XDG_DATA_DIR

Created on 8 Mar 2017  路  8Comments  路  Source: PyCQA/pylint

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

Most helpful comment

@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.

All 8 comments

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

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

This will never happen.

@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.

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.

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

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
Was this page helpful?
0 / 5 - 0 ratings

Related issues

PCManticore picture PCManticore  路  3Comments

glmdgrielson picture glmdgrielson  路  3Comments

TBoshoven picture TBoshoven  路  3Comments

ethanchewy picture ethanchewy  路  3Comments

sambarluc picture sambarluc  路  3Comments