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.
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.
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.
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
docsdirectory:cd docs - run
make html
Metadata
Release files for aiocouch 4.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aiocouch-4.0.1.tar.gz | 45.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiocouch-4.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 80.4 kB
Release files / aiocouch-4.0.1.tar.gz
| Download URL | aiocouch-4.0.1.tar.gz |
|---|---|
| Size | 45.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eeb46afe7626bd067c5a759fdd7c5eea11c4ac47c509751405a5e383081be7ab
|
|
BLAKE2b-256 checksum How to use checksums |
5fed213816310793a43577a9ff402a8f232d4fe2ee7e17b2b39cadd0f4a0bc02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / aiocouch-4.0.1-py3-none-any.whl
| Download URL | aiocouch-4.0.1-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f664150ee6f580fcacf6a6ef3b55e3304a7a352b91f3b88e139b4e2b09ffea44
|
|
BLAKE2b-256 checksum How to use checksums |
eac9530814ac26853680bbf46f07f1f39a81abf3a8631844a9587c4738436d73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|