Feature Request: add support for global config using $XDG_CONFIG_HOME
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start by tracing isort's existing config-file discovery, then read the XDG_CONFIG_HOME and XDG_CONFIG_DIRS specification linked in the issue. Check how pyproject.toml, setup.py, and .git are used to identify a project boundary. Done means the requested XDG locations are supported without changing the current- or project-directory lookup behavior.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 7k
- Forks
- 838
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 19
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PyCQA/isort
-
separate_packages splits imports from the same explicitly configured packagePossibly taken @rahul05ranjan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
force_sort_within_sections does not sort lazy imports by module namePossibly taken @rahul05ranjan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
length_sort with native sort order puts a longer import firstPossibly taken @simpleqt claimed this 24 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
PyCQA/isort#2698 · 2 comments ·
Maintainers usually reply within 2 days
-
Cache compiled known-module patterns across Config instancesPossibly taken @Yin123-ybh claimed this 2 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 30/100
PyCQA/isort#2805 · 1 comment ·
Maintainers usually reply within 2 days
-
add_imports re-adds the import on every run when the file contains an `# isort: off` block (not idempotent)Possibly taken @Tanvi-007 claimed this 6 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
PyCQA/isort#2799 · 2 comments ·
Maintainers usually reply within 2 days
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
NatLabRockies/openstudio-mcp#286 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
intersystems/ipm#1338 ·
Maintainers usually reply within 1 day
-
The v0-through-v1 path derives ShutdownDuration its own way, silently overriding a user's definitionOpenv1
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
TigreGotico/text2spoken#626 ·
Maintainers usually reply within 1 day