Skip to main content

No project description provided

Project description

aioconfig

aioconfig efficiently and thread-safely stores configurations in the background (asynchronously).

Installation

pip install aioconfig

Usage

The interface of aioconfig is dramatically easy to use. For example, both set(key, value) and await set(key, value) store a pair of key/value, which the former one is a fire-and-forget asynchronous function call while the latter one blocks until the data written onto the disk.

Init

import aioconfig
storage = aioconfig.get_storage(await aioconfig.attach('example.db'))
section = await aioconfig.get('default')

Delete

section.delete(key='foo')

Blocking delete (wait until it's done)

await section.delete(key='foo')

Get

value1 = await section.get(key='foo', default='bar')
value2 = await section.get(key='baz', default=12.3)

Get all

value = await section.get_all()

Set (fire-and-forget)

section.set(key='foo', value='bar')
section.set(key='baz', value=12.3)

Blocking set (wait until it's done)

await section.set(key='foo', value='bar')
await section.set(key='baz', value=12.3)

Batch set (fire-and-forget) (TBD)

with storage.transation():
    storage.set(
        key='foo', value='bar',
        section='default_section')
    storage.set(
        key='baz', value=12.3,
        section='default_section')

Blocking batch set (wait until it's done) (TBD)

async with storage.transation():
    storage.set(
        key='foo', value='bar',
        section='default_section')
    storage.set(
        key='baz', value=12.3,
        section='default_section')

Project details


Download files

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

Files for aioconfig, version 0.4.6
Filename, size File type Python version Upload date Hashes
Filename, size aioconfig-0.4.6-py3-none-any.whl (9.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aioconfig-0.4.6.tar.gz (8.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page