YamlDB
======
[![GitHub Repo](https://img.shields.io/badge/github-repo-green.svg)](https://github.com/cloudmesh/yamldb)
[![image](https://img.shields.io/pypi/pyversions/yamldb.svg)](https://pypi.org/project/yamldb)
[![image](https://img.shields.io/pypi/v/yamldb.svg)](https://pypi.org/project/yamldb/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![General badge](https://img.shields.io/badge/Status-Production-<COLOR>.svg)](https://shields.io/)
[![GitHub issues](https://img.shields.io/github/issues/cloudmesh/yamldb.svg)](https://github.com/cloudmesh/yamldb/issues)
[![Contributors](https://img.shields.io/github/contributors/cloudmesh/yamldb.svg)](https://github.com/cloudmesh/yamldb/graphs/contributors)
[![General badge](https://img.shields.io/badge/Other-repos-<COLOR>.svg)](https://github.com/cloudmesh)
[![Linux](https://img.shields.io/badge/OS-Linux-orange.svg)](https://www.linux.org/)
[![macOS](https://img.shields.io/badge/OS-macOS-lightgrey.svg)](https://www.apple.com/macos)
[![Windows](https://img.shields.io/badge/OS-Windows-blue.svg)](https://www.microsoft.com/windows)
YamlDB is an easy to use file-based database using YAML as the format for the
data represented in the file. This makes it possible to quickly change and add
values in the file itself while it can then be loaded and used as a dict in your
application.
It has the ability to use a dot notations for the keys instead of nested brackets.
It also creates parents if they do not exist.
Note: you must be using python 3.8 or newer
```python
pip install yamldb
db = YamlDB(filename="data.yml")
db["a"] = "1"
db["b.c"] = "2"
d = db.get("a.b.c.d", default=3)
db.load()
reloads the file
db.delete("b.c")
deletes the key b.c
to save the state you have to also call db.save()
db.save()
saves the current db into the file
db.search("a.*.c")
quries the db
see: https://jmespath.org/tutorial.html
```
## Development and tests
The best way to contribute is with issues and pull requests. You will need to check out the development version such as
```bash
git clone https://github.com/cloudmesh/yamldb.git
cd yamldb
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
```
Then you can run the a test with
```bash
pytest -v --capture=no tests/test_config.py
```
## Alternatives
* jmespath: <https://jmespath.org/>
* TinyDB: <https://tinydb.readthedocs.io/en/latest/index.html>
* nosqlite: <https://github.com/shaunduncan/nosqlite>
* MongoDB: This is quite a big package and we developed yamldb to replace it when mongo is not needed.
## Acknowledgments
Continued work was in part funded by the NSF
CyberTraining: CIC: CyberTraining for Students and Technologies
from Generation Z with the award numbers 1829704 and 2200409.
Raw data
{
"_id": null,
"home_page": "",
"name": "yamldb",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Gregor von Laszewski <laszewski@gmail.com>",
"keywords": "helper library,cloudmesh",
"author": "",
"author_email": "Gregor von Laszewski <laszewski@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/eb/8b/f91c57c2d1574094f5be7e85837ae5980f910a903a948689973ca47aa06f/yamldb-1.0.4.tar.gz",
"platform": null,
"description": "YamlDB\n======\n\n[![GitHub Repo](https://img.shields.io/badge/github-repo-green.svg)](https://github.com/cloudmesh/yamldb)\n[![image](https://img.shields.io/pypi/pyversions/yamldb.svg)](https://pypi.org/project/yamldb)\n[![image](https://img.shields.io/pypi/v/yamldb.svg)](https://pypi.org/project/yamldb/)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n[![General badge](https://img.shields.io/badge/Status-Production-<COLOR>.svg)](https://shields.io/)\n[![GitHub issues](https://img.shields.io/github/issues/cloudmesh/yamldb.svg)](https://github.com/cloudmesh/yamldb/issues)\n[![Contributors](https://img.shields.io/github/contributors/cloudmesh/yamldb.svg)](https://github.com/cloudmesh/yamldb/graphs/contributors)\n[![General badge](https://img.shields.io/badge/Other-repos-<COLOR>.svg)](https://github.com/cloudmesh)\n\n\n[![Linux](https://img.shields.io/badge/OS-Linux-orange.svg)](https://www.linux.org/)\n[![macOS](https://img.shields.io/badge/OS-macOS-lightgrey.svg)](https://www.apple.com/macos)\n[![Windows](https://img.shields.io/badge/OS-Windows-blue.svg)](https://www.microsoft.com/windows)\n\n\nYamlDB is an easy to use file-based database using YAML as the format for the\ndata represented in the file. This makes it possible to quickly change and add\nvalues in the file itself while it can then be loaded and used as a dict in your\napplication.\n\nIt has the ability to use a dot notations for the keys instead of nested brackets.\nIt also creates parents if they do not exist.\n\nNote: you must be using python 3.8 or newer\n\n```python\npip install yamldb\n\ndb = YamlDB(filename=\"data.yml\")\n\ndb[\"a\"] = \"1\"\ndb[\"b.c\"] = \"2\"\n\nd = db.get(\"a.b.c.d\", default=3)\n\ndb.load()\n reloads the file\n \ndb.delete(\"b.c\")\n deletes the key b.c\n to save the state you have to also call db.save()\n \ndb.save()\n saves the current db into the file\n\ndb.search(\"a.*.c\")\n quries the db\n see: https://jmespath.org/tutorial.html\n \n```\n\n## Development and tests\n\nThe best way to contribute is with issues and pull requests. You will need to check out the development version such as\n\n```bash\ngit clone https://github.com/cloudmesh/yamldb.git\ncd yamldb\npip install -r requirements.txt\npip install -r requirements-dev.txt\npip install -e .\n```\n\nThen you can run the a test with \n\n```bash\npytest -v --capture=no tests/test_config.py\n```\n\n## Alternatives\n\n* jmespath: <https://jmespath.org/>\n* TinyDB: <https://tinydb.readthedocs.io/en/latest/index.html>\n* nosqlite: <https://github.com/shaunduncan/nosqlite>\n* MongoDB: This is quite a big package and we developed yamldb to replace it when mongo is not needed.\n\n## Acknowledgments\n\nContinued work was in part funded by the NSF\nCyberTraining: CIC: CyberTraining for Students and Technologies\nfrom Generation Z with the award numbers 1829704 and 2200409.\n",
"bugtrack_url": null,
"license": "Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ Copyright 2017 Gregor von Laszewski, Indiana University Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ",
"summary": "A file based database using yaml as file format",
"version": "1.0.4",
"project_urls": {
"Changelog": "https://github.com/cloudmesh/yamldb/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/cloudmesh/yamldb/blob/main/README.md",
"Homepage": "https://github.com/cloudmesh/yamldb",
"Issues": "https://github.com/cloudmesh/yamldb/issues",
"Repository": "https://github.com/cloudmesh/yamldb.git"
},
"split_keywords": [
"helper library",
"cloudmesh"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb12199f6c09d5ec26eff7099b45b3fb8560a71217ef71a37954a9c839f17939",
"md5": "11c734449d4c8c788f02360d8a986480",
"sha256": "b2abeb48687bb556db8f95e323151753db2fb90e1ffe9818f7448663c929d7e6"
},
"downloads": -1,
"filename": "yamldb-1.0.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "11c734449d4c8c788f02360d8a986480",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 7767,
"upload_time": "2023-12-24T01:36:00",
"upload_time_iso_8601": "2023-12-24T01:36:00.317650Z",
"url": "https://files.pythonhosted.org/packages/bb/12/199f6c09d5ec26eff7099b45b3fb8560a71217ef71a37954a9c839f17939/yamldb-1.0.4-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eb8bf91c57c2d1574094f5be7e85837ae5980f910a903a948689973ca47aa06f",
"md5": "20bdfcf1ab01b1e3359b0bd4a7c0a011",
"sha256": "370ec372f66d55c9240ed34ac24c9e06f891739548f939e1ae8ceba71f45eb6f"
},
"downloads": -1,
"filename": "yamldb-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "20bdfcf1ab01b1e3359b0bd4a7c0a011",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 11571,
"upload_time": "2023-12-24T01:36:02",
"upload_time_iso_8601": "2023-12-24T01:36:02.402224Z",
"url": "https://files.pythonhosted.org/packages/eb/8b/f91c57c2d1574094f5be7e85837ae5980f910a903a948689973ca47aa06f/yamldb-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-24 01:36:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloudmesh",
"github_project": "yamldb",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "yamldb"
}