{"id":15559385,"url":"https://github.com/citguru/configstore","last_synced_at":"2025-04-09T16:51:24.923Z","repository":{"id":62579419,"uuid":"137477748","full_name":"CITGuru/ConfigStore","owner":"CITGuru","description":"A Python module for handling config files. It helps handles persist config files and also giving the ability to set, get, update and delete config settings","archived":false,"fork":false,"pushed_at":"2018-06-15T12:07:35.000Z","size":12,"stargazers_count":9,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T03:35:46.533Z","etag":null,"topics":["configs","python","settings"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CITGuru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-15T11:04:25.000Z","updated_at":"2023-01-10T15:12:12.000Z","dependencies_parsed_at":"2022-11-03T21:00:53.854Z","dependency_job_id":null,"html_url":"https://github.com/CITGuru/ConfigStore","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2FConfigStore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2FConfigStore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2FConfigStore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2FConfigStore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CITGuru","download_url":"https://codeload.github.com/CITGuru/ConfigStore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248072942,"owners_count":21043335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["configs","python","settings"],"created_at":"2024-10-02T15:47:29.064Z","updated_at":"2025-04-09T16:51:24.887Z","avatar_url":"https://github.com/CITGuru.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ConfigStore \n\nA Python module for handling config files. It helps handles persist config files and also giving the ability to set, get, update and delete config settings\n\n\u003e Easily load and persist config without having to think about where and how\n\nIt's built base on nodejs [configstore](https://github.com/yeoman/configstore)\n\nConfig is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.localconfig`.\u003cbr\u003e\nExample: `~/.localconfig/configstore/name.json`\n\n## Installation\n\n```bash\npip install pyconfigstore\n```\n\n## Usage\n\n```python\nfrom pyconfigstore import ConfigStore\n\n# create a Configstore instance with a unique name e.g. gnit\n# Package name and optionally some default values\nconf = ConfigStore(\"Gnit\", {\"foo\": 'bar'})\n\nprint(conf.get('foo'))\n#\u003e\u003e\u003e 'bar'\n\nconf.set('awesome', True)\nprint(conf.get('awesome'))\n#\u003e\u003e\u003e True\n\n# Use dot-notation to set nested properties\nconf.set('bar.baz', True)\nprint(conf.get('bar'))\n#\u003e\u003e\u003e {\"baz\": True}\n\n# escape dot-notation to set nested properties\nconf.set('bar.baz\\\\.bag', True)\nprint(conf.get('bar'))\n#\u003e\u003e\u003e {\"baz.bag\": True}\n\nconf.delete('awesome')\nprint(conf.get('awesome'))\n#\u003e\u003e\u003e\n```\n\n## API\n\n### Configstore(packageName, [defaults], globalConfigPath)\n\nReturns a new instance.\n\n#### packageName\n\nType: `str`\n\nName of your package.\n\n#### defaults\n\nType: `dicts`\n\nDefault config.\n\n#### globalConfigPath\n\nType: `bool`\u003cbr\u003e\nDefault: `False`\n\nStore the config at `$CONFIG/package-name/config.json` instead of the default `$CONFIG/configstore/package-name.json`. This is not recommended as you might end up conflicting with other tools, rendering the \"without having to think\" idea moot.\n\n### Features\n\nYou can use dot-notation to set, get, update and delete nested dict properties\n\n### .set(key, value)\n\nSet an item.\n\n### .set(dict)\n\nSet multiple items at once.\n\n### .get(key)\n\nGet an item.\n\n### .has(key)\n\nCheck if an item exists.\n\n### .delete(key)\n\nDelete an item.\n\n### .clear()\n\nDelete all items.\n\n### .all()\n\nGet all the config as a dict or replace the current config with an object:\n\n```python\nconf.all({\n\thello: 'world'\n}) \n```\n\n### .size\n\nGet the item count.\n\n### .path\n\nGet the path to the config file. Can be used to show the user where the config file is located or even better open it for them.\n\n## Contribute\n\nYes, you can contribute. Just dm on twitter:[@OyetokeT](http://twitter.com/@OyetokeT)\n\n## TODO\n\nThere are couple of things I still need to add\n\n1. Dot-notation: Currently, you can only set configs using this feature. (get, delete)\n\n2. Stream: I planned to add a param that'll indicate that you want it to hit the file for every operation. Well that's how it works currently though. But to make it smarter, we don't need to hit the file for (size, get, has, all) operation. We are going to call the `.all()` once to get the configs in dicts and do the operation just using dict properties.\n\nand more...\n\n## License\nCopyright - 2018\n\nOyetoke Toby twitter:[@OyetokeT](http://twitter.com/@OyetokeT)\n\nMIT LICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitguru%2Fconfigstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcitguru%2Fconfigstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitguru%2Fconfigstore/lists"}