[](https://opensource.org/licenses/BSD-3-Clause)
[](https://badge.fury.io/py/aiocouch)

[](https://codecov.io/gh/metricq/aiocouch)
[](https://aiocouch.readthedocs.io/en/latest/?badge=latest)
# aiocouch
An asynchronous client library for CouchDB 2.0 based on asyncio using aiohttp
## Key features
- All requests are asynchronus using aiohttp
- Supports CouchDB 2.x and 3.x
- Support for modern Python ≥ 3.7
## Library installation
```
pip install aiocouch
```
## Getting started
The following code retrieves and prints the list of `incredients` of the *apple_pie* `recipe`.
The `incredients` are stored as a list in the *apple_pie* `aiocouch.document.Document`,
which is part of the `recipe` `aiocouch.database.Database`. We use the context manager
`aiocouch.CouchDB` to create a new session.
```python
from aiocouch import CouchDB
async with CouchDB(
"http://localhost:5984", user="admin", password="admin"
) as couchdb:
db = await couchdb["recipes"]
doc = await db["apple_pie"]
print(doc["incredients"])
```
We can also create new recipes, for instance for some delicious cookies.
```python
new_doc = await db.create(
"cookies", data={"title": "Granny's cookies", "rating": "★★★★★"}
)
await new_doc.save()
```
For further details please refer to the documentation, which is available [here on readthedocs.org](https://aiocouch.readthedocs.io/).
## Run examples
- Setup the CouchDB URL and credentials using the environment variables
- Install dependencies using `pip install --editable '.[examples]'`
- run for instance `python examples/getting_started.py`
## Run tests
- Install dependencies using `pip install --editable '.[tests]'`
- Setup the CouchDB URL and credentials using the environment variables (`COUCHDB_HOST`, `COUCHDB_USER`, `COUCHDB_PASS`)
- run `pytest --cov=aiocouch`
## Generate documentation
- Install dependencies using `pip install '.[docs]'`
- switch to the `docs` directory: `cd docs`
- run `make html`
Raw data
{
"_id": null,
"home_page": "https://github.com/metricq/aiocouch",
"name": "aiocouch",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "TU Dresden",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/c6/e8/21b3de841ed816152a2912b62786d0993d6f81c68d8f9a963a842b3ead21/aiocouch-3.0.0.tar.gz",
"platform": null,
"description": "[](https://opensource.org/licenses/BSD-3-Clause)\n[](https://badge.fury.io/py/aiocouch)\n\n[](https://codecov.io/gh/metricq/aiocouch)\n[](https://aiocouch.readthedocs.io/en/latest/?badge=latest)\n\n\n# aiocouch\nAn asynchronous client library for CouchDB 2.0 based on asyncio using aiohttp\n\n## Key features\n\n- All requests are asynchronus using aiohttp\n- Supports CouchDB 2.x and 3.x\n- Support for modern Python \u2265 3.7\n\n\n## Library installation\n\n```\n pip install aiocouch\n```\n\n## Getting started\n\nThe following code retrieves and prints the list of `incredients` of the *apple_pie* `recipe`.\nThe `incredients` are stored as a list in the *apple_pie* `aiocouch.document.Document`,\nwhich is part of the `recipe` `aiocouch.database.Database`. We use the context manager\n`aiocouch.CouchDB` to create a new session.\n\n```python\n\n from aiocouch import CouchDB\n\n async with CouchDB(\n \"http://localhost:5984\", user=\"admin\", password=\"admin\"\n ) as couchdb:\n db = await couchdb[\"recipes\"]\n doc = await db[\"apple_pie\"]\n print(doc[\"incredients\"])\n```\n\nWe can also create new recipes, for instance for some delicious cookies.\n\n```python\n\n new_doc = await db.create(\n \"cookies\", data={\"title\": \"Granny's cookies\", \"rating\": \"\u2605\u2605\u2605\u2605\u2605\"}\n )\n await new_doc.save()\n```\n\nFor further details please refer to the documentation, which is available [here on readthedocs.org](https://aiocouch.readthedocs.io/).\n\n## Run examples\n\n- Setup the CouchDB URL and credentials using the environment variables\n- Install dependencies using `pip install --editable '.[examples]'`\n- run for instance `python examples/getting_started.py`\n\n\n## Run tests\n\n- Install dependencies using `pip install --editable '.[tests]'`\n- Setup the CouchDB URL and credentials using the environment variables (`COUCHDB_HOST`, `COUCHDB_USER`, `COUCHDB_PASS`)\n- run `pytest --cov=aiocouch`\n\n\n## Generate documentation\n\n- Install dependencies using `pip install '.[docs]'`\n- switch to the `docs` directory: `cd docs`\n- run `make html`\n\n\n",
"bugtrack_url": null,
"license": "BSD 3-clause",
"summary": "\ud83d\udecb An asynchronous client library for CouchDB 2.x and 3.x",
"version": "3.0.0",
"project_urls": {
"Bug Tracker": "https://github.com/metricq/aiocouch/issues",
"Documentation": "https://aiocouch.readthedocs.io/en/stable",
"Homepage": "https://github.com/metricq/aiocouch",
"Source": "https://github.com/metricq/aiocouch"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "29594f3f251c9571fcc815627bd070d034fdde0c2395ecbaa9ec89fb4882bd2e",
"md5": "a25b681a1564e7d8e60c5d377c8389ee",
"sha256": "27bfc9d5ccca13c7e7f4181b83a5f18e706cdc7d65099e06eb95c9c9690cae01"
},
"downloads": -1,
"filename": "aiocouch-3.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a25b681a1564e7d8e60c5d377c8389ee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 34287,
"upload_time": "2023-08-25T13:55:30",
"upload_time_iso_8601": "2023-08-25T13:55:30.120913Z",
"url": "https://files.pythonhosted.org/packages/29/59/4f3f251c9571fcc815627bd070d034fdde0c2395ecbaa9ec89fb4882bd2e/aiocouch-3.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c6e821b3de841ed816152a2912b62786d0993d6f81c68d8f9a963a842b3ead21",
"md5": "addf32cd34077f1a41a39cc0f1b79a76",
"sha256": "bcad18c58653014aaca0fa74aa0adc7f3bfc2717e5736414d7399082a566e8c1"
},
"downloads": -1,
"filename": "aiocouch-3.0.0.tar.gz",
"has_sig": false,
"md5_digest": "addf32cd34077f1a41a39cc0f1b79a76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 43350,
"upload_time": "2023-08-25T13:55:32",
"upload_time_iso_8601": "2023-08-25T13:55:32.179656Z",
"url": "https://files.pythonhosted.org/packages/c6/e8/21b3de841ed816152a2912b62786d0993d6f81c68d8f9a963a842b3ead21/aiocouch-3.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-25 13:55:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "metricq",
"github_project": "aiocouch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiocouch"
}