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.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 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-4.0.1.tar.gz (45.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiocouch-4.0.1-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiocouch-4.0.1.tar.gz
  • Upload date:
  • Size: 45.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiocouch-4.0.1.tar.gz
Algorithm Hash digest
SHA256 eeb46afe7626bd067c5a759fdd7c5eea11c4ac47c509751405a5e383081be7ab
MD5 18dbe81e4a6858969404140aa4aa18a0
BLAKE2b-256 5fed213816310793a43577a9ff402a8f232d4fe2ee7e17b2b39cadd0f4a0bc02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiocouch-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for aiocouch-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f664150ee6f580fcacf6a6ef3b55e3304a7a352b91f3b88e139b4e2b09ffea44
MD5 7d646b71f4716bb83cb3e3cd3da70105
BLAKE2b-256 eac9530814ac26853680bbf46f07f1f39a81abf3a8631844a9587c4738436d73

See more details on using hashes here.

Supported by

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