question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conform to XDG directory specification

See original GitHub issue

I find that configuration and state data is stored in $HOME/.grip/, including (but not limited to) in these files:

  • ~/.grip/cache-*

Users who do not expect state data to be stored here may accidentally back it up and synchronize it across systems improperly. Configuration data are fine, but prefer storing state data somewhere in $XDG_DATA_HOME and configuration data to $XDG_CONFIG_HOME to conform to the freedesktop.org / XDG standard.

Reference: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

$XDG_CONFIG_HOME defines the base directory relative to which user specific                                                                                                                                          
configuration files should be stored. If $XDG_CONFIG_HOME is either not set or                                                                                                                                       
empty, a default equal to $HOME/.config should be used.
$XDG_DATA_HOME defines the base directory relative to which user specific data                                                                                                                                       
files should be stored. If $XDG_DATA_HOME is either not set or empty, a default                                                                                                                                      
equal to $HOME/.local/share should be used.

To implement a painless migration for existing users, you can consider reading $XDG_CONFIG_HOME/grip/config.py first, then falling back to $HOME/.grip/. Likewise for cache data.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:6
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
alichtmancommented, Nov 8, 2019

I’d be in favor of maintaining backwards compatibility, and I do think following the XDG spec is important.

The important thing is to get rid of ~/.grip.

Agreed.

2reactions
denisfacommented, Feb 7, 2019

If you are OK with it I can probably get a PR together that moves that to $XDG_CONFIG_HOME/grip but falls back if not found, like with the PR above

Sure! No problem! The important thing is to get rid of ~/.grip.

I’m not sure it’s necessary to force people to migrate. You can just implement the spec and then fall back to old behavior. See this PR for mypy: python/mypy#6304

Here is the thing. I think that since we are using a single config file settings.py, and the other files are cache, we could try to move straight to the spec. On some projects, the idea behind supporting legacy is to not break old installs (maybe giving users a time window too, but this is less relevant than the first) and be “nicer” to new ones. You would also need to set a future task with something like “remember removing legacy code after X months/versions”. No reason to keep multiple locations available after some time.

Edit: It would be a drawback to lose support for $GRIPHOME and it shouldn’t be necessary to lose that to implement the xdg spec

Here you need to be somewhat carefully. You can support the XDG with this like I did on my comment. But you would also change the expected behaviour if you allow this and change cache-* to $XDG_CACHE_HOME/grip. I also would like to know if someone is using this for something else other than supporting the XDG (or simply getting rid of ~/.grip).

Anyways, do as you wish. I really would like to help you more, but I am more busy now than I expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

XDG Base Directory - ArchWiki
Application Legacy Path Supported Since ALSA ~/.asoundrc 577df36 · 1.2.3 Android Studio ~/.AndroidStudioX.X Android Studio 4.1 Anki ~/Anki , ~/Documents/Anki
Read more >
XDGBaseDirectorySpecification - Debian Wiki
The XDG Base Directory Specification (XDGBDS) defines four categories of so called DotFiles and the corresponding directories in a users home ...
Read more >
XDG Base Directory Specification
$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, ...
Read more >
Is the XDG base directory specification something to care about?
Do the XDG directory specs make any sense? Is it a good idea to try to nudge developers by bug reports or pull...
Read more >
T1018 Conform to XDG Base Directory Specification - GnuPG
It'd be nice if gnupg conformed to freedesktop's XDG Base Directory Specification. ... files, while ignoring large directories such as ~/.mozilla, fast and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found