Settngs
This library is an attempt to merge reading flags/options from the commandline (argparse) and settings from a file (json).
It is a modified argparse inspired by how flake8 loads their settings. Note that this does not attempt to be a drop-in replacement for argparse.
Install with pip
pip install settngs
A trivial example is included at the bottom of settngs.py with the output below (using bash). For a more complete example see ComicTagger.
$ python -m settngs
Hello world
$ python -m settngs --hello lordwelch
Hello lordwelch
$ python -m settngs --hello lordwelch -s
Hello lordwelch
Successfully saved settings to settings.json
$ python -m settngs
Hello lordwelch
$ python -m settngs -v
Hello lordwelch
merged_namespace.values.Example_Group__verbose=True
$ python -m settngs -v -s
Hello lordwelch
Successfully saved settings to settings.json
merged_namespace.values.Example_Group__verbose=True
$ python -m settngs
Hello lordwelch
merged_namespace.values.Example_Group__verbose=True
$ cat >settings.json << EOF
{
"example": {
"hello": "lordwelch",
"verbose": true
},
"persistent": {
"test": false,
"hello": "world"
}
}
EOF
$ python -m settngs --no-verbose
Hello lordwelch
$ python -m settngs --no-verbose -s
Hello lordwelch
Successfully saved settings to settings.json
$ python -m settngs --hello world --no-verbose -s
Hello world
Successfully saved settings to settings.json
$ python -m settngs
Hello world
settngs.json at the end:
{
"Example Group": {
"hello": "world",
"verbose": false
},
"persistent": false,
"hello": "world"
}
What happened to the 'i'?
PyPi wouldn't let me use 'settings'
Metadata
Release files for settngs 0.11.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| settngs-0.11.2.tar.gz | 23.4 kB | Without provenance | Details for settngs-0.11.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| settngs-0.11.2-py3-none-any.whl | Python 3 | none | any | Details for settngs-0.11.2-py3-none-any.whl |
Total release size: 36.2 kB
Release files / settngs-0.11.2.tar.gz
| Download URL | settngs-0.11.2.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0947eed808b3adca0be20b7098580d1f8648f2a80e6ca32bcd2d0456ae387ee
|
|
BLAKE2b-256 checksum How to use checksums |
6b6f975716d726bebd390d4ead06ffa83f4eaadb5a469da5aeb44d7ab0532330
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / settngs-0.11.2-py3-none-any.whl
| Download URL | settngs-0.11.2-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36fa353daa067edf5d241b861a8563c55ba9491d4131acf4f4bfa8f9811516dc
|
|
BLAKE2b-256 checksum How to use checksums |
24ad8fd5a8654ce872eadeaa7eddfddf6fa5ef7ca020efad08d78054ceadcbd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for settngs 0.11.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.