config-better
Make use of directories for configuration / data / caching better and more user-friendly!
This module provides support for the XDG Base Directory specification, and OS-friendly fallbacks for Windows, Mac OS, and Linux if not otherwise specified.
Usage
import os.path
import configbetter
c = configbetter.Config('appname')
with open(os.path.join(c.config, 'config.json')) as conf:
# ...
Available parameters for creating a Config instance:
force_unixallows you to force using Unix-like paths on Windows/Darwin if desired. This isn't really recommended on Windows but on Darwin it seems as though programs without a GUI usually use Unix-like configuration paths while GUI apps use the "standard" Darwin paths. By default this isFalse.
Available properties of Config:
.cache, which points to$XDG_CACHE_HOMEif available, otherwise uses a generic system equivalent..config, which points to$XDG_CONFIG_HOMEif available, otherwise uses a generic system equivalent..data, which points to$XDG_DATA_HOMEif available, otherwise uses a generic system equivalent.
Additionally, the following methods are provided:
.makedirs()will create the cache, config and data directories if they do not already exist, including all parent directories..rmdirs()will remove any program-specific directories that would have been created by config-better.
Installation
pip install config-better
Developing
- Clone the repo
git checkout -b some-feature-or-bugfix- Do work
- Test with
pytest(add tests to maintain coverage as best as possible) - Run
yapf -ir .andisort -rc .to standardize. - Make a PR.
Release files for config-better 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| config-better-1.1.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| config_better-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.0 kB
Release files / config-better-1.1.0.tar.gz
| Download URL | config-better-1.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cafb848b46d1740a42b2d279b0c8979c1b4b6e8a4a9d4f439bc059ac87f74d43
|
|
BLAKE2b-256 checksum How to use checksums |
a2b988f4eec983a2383055f897efaf90032eb81df54beb871518b65876fea2f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|
Release files / config_better-1.1.0-py3-none-any.whl
| Download URL | config_better-1.1.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00ff28afd0026bff140829b3675d8fb284ff7b95f28e2d71e5031435e1e6c25b
|
|
BLAKE2b-256 checksum How to use checksums |
41c31e68f348116d00c22ff253656136151fd91e81e3fd0e9a575113c8a1357f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
|