[![CI](https://github.com/lordwelch/settngs/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/lordwelch/settngs/actions/workflows/build.yaml)
[![GitHub release (latest by date)](https://img.shields.io/github/downloads/lordwelch/settngs/latest/total)](https://github.com/lordwelch/settngs/releases/latest)
[![PyPI](https://img.shields.io/pypi/v/settngs)](https://pypi.org/project/settngs/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/settngs)](https://pypistats.org/packages/settngs)
[![PyPI - License](https://img.shields.io/pypi/l/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": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "",
"author": "Timmy Welch",
"author_email": "timmy@narnian.us",
"download_url": "https://files.pythonhosted.org/packages/1a/5f/5da3145bb5f29d7bb8eab72cc7cd4389344a2b26e673a643e42ea24f732c/settngs-0.10.0.tar.gz",
"platform": null,
"description": "[![CI](https://github.com/lordwelch/settngs/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/lordwelch/settngs/actions/workflows/build.yaml)\n[![GitHub release (latest by date)](https://img.shields.io/github/downloads/lordwelch/settngs/latest/total)](https://github.com/lordwelch/settngs/releases/latest)\n[![PyPI](https://img.shields.io/pypi/v/settngs)](https://pypi.org/project/settngs/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/settngs)](https://pypistats.org/packages/settngs)\n[![PyPI - License](https://img.shields.io/pypi/l/settngs)](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.0",
"project_urls": {
"Homepage": "https://github.com/lordwelch/settngs"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "36d42a77eaa17b2b401e8f23dd6970212f94b4c99eef390337b17daceebf17f6",
"md5": "13852398cc0d87595b2309f0d565885f",
"sha256": "cddc1fdc1bfaadb18653df94cd8fe53af7d2e5d22c10aa42f3154069168a57d0"
},
"downloads": -1,
"filename": "settngs-0.10.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "13852398cc0d87595b2309f0d565885f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11800,
"upload_time": "2024-02-23T03:18:07",
"upload_time_iso_8601": "2024-02-23T03:18:07.239876Z",
"url": "https://files.pythonhosted.org/packages/36/d4/2a77eaa17b2b401e8f23dd6970212f94b4c99eef390337b17daceebf17f6/settngs-0.10.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1a5f5da3145bb5f29d7bb8eab72cc7cd4389344a2b26e673a643e42ea24f732c",
"md5": "2be19302654ed34e6412d36c9d216f7d",
"sha256": "8fed4867b427a49289a8918337bf23a2fcfb8797fc1333c6a774346509e41f96"
},
"downloads": -1,
"filename": "settngs-0.10.0.tar.gz",
"has_sig": false,
"md5_digest": "2be19302654ed34e6412d36c9d216f7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 22056,
"upload_time": "2024-02-23T03:18:08",
"upload_time_iso_8601": "2024-02-23T03:18:08.972796Z",
"url": "https://files.pythonhosted.org/packages/1a/5f/5da3145bb5f29d7bb8eab72cc7cd4389344a2b26e673a643e42ea24f732c/settngs-0.10.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-23 03:18:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lordwelch",
"github_project": "settngs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "settngs"
}