Skip to content

Async Support #291

@dalepo

Description

@dalepo

Bring first-class async I/O to glom, letting specs call await-able
functions without boilerplate.

Motivation

Today you must either:

  1. Block spec computations.
  2. Pre-fetch async data elsewhere, scattering transformation logic.

Native async support keeps your spec declarative & non-blocking.

Example

from glom import Async, aglom   # new helpers

# Async operation..
async def get_entity_name(eid):
    ...

target = {"entity": {"id": "123"}}

SPEC = {
    "id": "entity.id",
    "name": Async(("entity.id", get_entity_name)), 
}

result = await aglom(target, SPEC)
# -> {'id': '123', 'name': 'Acme Corp'}

Perhaps the Async glomit class wrapper might not be needed, just an idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions