[](https://github.com/lordwelch/settngs/actions/workflows/build.yaml)
[](https://github.com/lordwelch/settngs/releases/latest)
[](https://pypi.org/project/settngs/)
[](https://pypistats.org/packages/settngs)
[](https://opensource.org/licenses/MIT)
# 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
```console
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].
```console
$ 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:
```json
{
"Example Group": {
"hello": "world",
"verbose": false
},
"persistent": false,
"hello": "world"
}
```
## What happened to the 'i'?
PyPi wouldn't let me use 'settings'
[flake8]: https://github.com/PyCQA/flake8
[ComicTagger]: https://github.com/comictagger/comictagger
Raw data
{
"_id": null,
"home_page": "https://github.com/lordwelch/settngs",
"name": "settngs",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Timmy Welch",
"author_email": "timmy@narnian.us",
"download_url": "https://files.pythonhosted.org/packages/ef/83/a50dc9580517fd78e99dbe695271d6ae29bf32628b92d57ccaf18a8cce8f/settngs-0.10.4.tar.gz",
"platform": null,
"description": "[](https://github.com/lordwelch/settngs/actions/workflows/build.yaml)\n[](https://github.com/lordwelch/settngs/releases/latest)\n[](https://pypi.org/project/settngs/)\n[](https://pypistats.org/packages/settngs)\n[](https://opensource.org/licenses/MIT)\n\n# Settngs\n\nThis library is an attempt to merge reading flags/options from the commandline (argparse) and settings from a file (json).\n\nIt 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.\n\nInstall with pip\n```console\npip install settngs\n```\n\n\nA trivial example is included at the bottom of settngs.py with the output below (using bash). For a more complete example see [ComicTagger].\n```console\n$ python -m settngs\nHello world\n$ python -m settngs --hello lordwelch\nHello lordwelch\n$ python -m settngs --hello lordwelch -s\nHello lordwelch\nSuccessfully saved settings to settings.json\n$ python -m settngs\nHello lordwelch\n$ python -m settngs -v\nHello lordwelch\nmerged_namespace.values.Example_Group__verbose=True\n$ python -m settngs -v -s\nHello lordwelch\nSuccessfully saved settings to settings.json\nmerged_namespace.values.Example_Group__verbose=True\n$ python -m settngs\nHello lordwelch\nmerged_namespace.values.Example_Group__verbose=True\n$ cat >settings.json << EOF\n{\n \"example\": {\n \"hello\": \"lordwelch\",\n \"verbose\": true\n },\n \"persistent\": {\n \"test\": false,\n \"hello\": \"world\"\n }\n}\nEOF\n$ python -m settngs --no-verbose\nHello lordwelch\n$ python -m settngs --no-verbose -s\nHello lordwelch\nSuccessfully saved settings to settings.json\n$ python -m settngs --hello world --no-verbose -s\nHello world\nSuccessfully saved settings to settings.json\n$ python -m settngs\nHello world\n```\n\nsettngs.json at the end:\n```json\n{\n \"Example Group\": {\n \"hello\": \"world\",\n \"verbose\": false\n },\n \"persistent\": false,\n \"hello\": \"world\"\n}\n```\n\n## What happened to the 'i'?\nPyPi wouldn't let me use 'settings'\n\n[flake8]: https://github.com/PyCQA/flake8\n[ComicTagger]: https://github.com/comictagger/comictagger\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library for managing settings",
"version": "0.10.4",
"project_urls": {
"Homepage": "https://github.com/lordwelch/settngs"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "19b3aa3a18823a022160a691dce072a2bfec6222b03388f1bed1869b8f8f9f2a",
"md5": "7358c8b72d1f800268f828d60d2296cc",
"sha256": "2b11adf60863bdb11a65ab7d02640e7bc674ec7dea670fdeb785044f56b9800f"
},
"downloads": -1,
"filename": "settngs-0.10.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7358c8b72d1f800268f828d60d2296cc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 13094,
"upload_time": "2024-06-07T02:35:59",
"upload_time_iso_8601": "2024-06-07T02:35:59.959780Z",
"url": "https://files.pythonhosted.org/packages/19/b3/aa3a18823a022160a691dce072a2bfec6222b03388f1bed1869b8f8f9f2a/settngs-0.10.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ef83a50dc9580517fd78e99dbe695271d6ae29bf32628b92d57ccaf18a8cce8f",
"md5": "819a4bba80e54998d0023df08ac9428a",
"sha256": "f8a2b67e711bc0fb2c73e7e812ccd6f3699fa8f158f6053a802ff1304d410fee"
},
"downloads": -1,
"filename": "settngs-0.10.4.tar.gz",
"has_sig": false,
"md5_digest": "819a4bba80e54998d0023df08ac9428a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 23912,
"upload_time": "2024-06-07T02:36:01",
"upload_time_iso_8601": "2024-06-07T02:36:01.759508Z",
"url": "https://files.pythonhosted.org/packages/ef/83/a50dc9580517fd78e99dbe695271d6ae29bf32628b92d57ccaf18a8cce8f/settngs-0.10.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-07 02:36:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lordwelch",
"github_project": "settngs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "settngs"
}