Feature Request: add support for global config using $XDG_CONFIG_HOME

Aperta
#2,465 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia tracciando il rilevamento esistente dei file di configurazione di isort, quindi leggi la specifica di XDG_CONFIG_HOME e XDG_CONFIG_DIRS collegata nella issue. Verifica come pyproject.toml, setup.py e .git vengono usati per identificare il confine di un progetto. Il lavoro è completato quando le posizioni XDG richieste sono supportate senza modificare il comportamento attuale di ricerca nella directory corrente o nella directory del progetto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I would like to see support for using the XDG directory specification for config files.
https://specifications.freedesktop.org/basedir/latest/

XDG defines a set of standard environment variables in order to provide known locations for various kinds of files.
Regarding config files, $XDG_CONFIG_HOME (defaulted to ~/.config/) is used to set the default location for a user's config files. XDG_CONFIG_DIRS specifies a search path to use if the config file is not found in XDG_CONFIG_HOME.

The benefits of XDG_CONFIG_HOME aka ~/.config are:

  • is that it reduces file system clutter because the user's home directory is not full of dot files
  • it makes it easy to move configuration files to another machine or back them up
  • it certainly makes it very easy to see what programs have a global configuration
  • it allows the user to choose a different location, such as a shared file system

The configuration for a program may either be a single config file in ~/.config/, in which case it should not be hidden. Example would be moving ~/.isort.cfg to ~/.config/isort.cfg
If the configuration for a program is a directory, such as ~/.vim/ it should be a non-hidden directory in ~/.config such as ~/.config/vim.

Note:
I am not proposing changing looking in the current directory or the project directory first. However, I think looking at 25 parent directories is excessive. If the project directory can be recognized then the search should stop there and jump directly to the global config. The project directory can be recognized by the presence of:

  • a pyproject.toml directory
  • a setup.py directory
  • a .git directory

There might also be other ways, but the above is a quick and simple list.

Lingua principale
Python
Stelle
7k
Fork
838
Merge medio
2g 6h
PR unite (30g)
19

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PyCQA/isort

Tutte le issue di PyCQA/isort

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.