Skip to main content

🛋 An asynchronous client library for CouchDB 2.x and 3.x

Project description

License PyPI version Python package codecov Documentation Status

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.6

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 docs directory: cd docs
  • run make html

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiocouch-2.1.1.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

aiocouch-2.1.1-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file aiocouch-2.1.1.tar.gz.

File metadata

  • Download URL: aiocouch-2.1.1.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for aiocouch-2.1.1.tar.gz
Algorithm Hash digest
SHA256 1173d07c50d60424e07e440265e49132156b2e63ef74a1ffad7f2727f38545f8
MD5 1b593d61e138d127b331caf80790eea7
BLAKE2b-256 2af8acf99525275e02a49ff7042bf1de482fa0a20a2a0b1e7140f87f33677d46

See more details on using hashes here.

File details

Details for the file aiocouch-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: aiocouch-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for aiocouch-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b83831bd436d9100da4b80ec18eca93ec3f270f87f83904476a9952f73cdefb
MD5 63cbf4398c5542db3b3c38d50e0f3e52
BLAKE2b-256 bfdc87344c667d005b5ef1443c63e80dbf5de7611688569ceb5acf7eabc72d9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page