Skip to main content

Ultra fast agents for nodnod.

Project description

Nodina Logo

Ultra fast agents for nodnod
We make a nodnod family 🧑‍🧑‍🧒‍🧒

Getting started

import asyncio

from nodina import AsyncNodinaAgent, Scope, scalar_node


@scalar_node
class Hello:
    @classmethod
    async def __compose__(cls) -> str:
        return "Hello,"


@scalar_node
class World:
    @classmethod
    async def __compose__(cls) -> str:
        return "World!"


async def main() -> None:
    agent = AsyncNodinaAgent.build({Hello, World})
    mapped_scopes = {}

    async with Scope(detail="local") as local_scope:
        await agent.run(local_scope, mapped_scopes)
        print(local_scope[Hello], local_scope[World])


asyncio.run(main())

How it works

nodina is a small DAG scheduler for nodnod graphs, built as a Cython extension over a tiny native pthread work pool. It ships two agents:

  • AsyncNodinaAgent resolves the dependency graph on the running asyncio event loop — one task per node, so independent async nodes (and any node that awaits real I/O) run concurrently.
  • NodinaAgent resolves it synchronously, dispatching independent nodes onto a shared pthread pool (nodina/core/nodina_pool.c). The pool's queueing and waiting run without the GIL — the GIL is held only inside each __compose__ call. A lone ready node with nothing else in flight composes inline to skip a thread hand-off.

Both pick the first successful SequentialEither / ConcurrentEither candidate in declared order; ConcurrentEither composes all of its candidates concurrently, SequentialEither composes them lazily. Neither cancels losing candidates.

Performance & the GIL, honestly

backend_name() returns "cython". The thread pool overlaps nodes that release the GIL (blocking I/O, time.sleep, C extensions). On a normal CPython build, CPU-bound __compose__ work still serializes on the GIL — that is a property of the interpreter, not of nodina.

On a free-threaded build (python3.14t, PEP 703) the GIL is gone and the pool runs CPU-bound nodes truly in parallel. The extension declares freethreading_compatible, so importing it does not re-enable the GIL:

# 8 independent CPU nodes, 8-node graph, 11-core machine
python3.14   (GIL):  8 nodes = 206 ms   speedup vs serial 1.0x
python3.14t  (no GIL): 8 nodes =  40 ms   speedup vs serial 5.1x
python -m benchmarks.bench               # vs a pure-Python reference
python3.14t -m benchmarks.freethreading_demo    # CPU parallelism with the GIL off

The benchmark suite in benchmarks/ measures nodina against a ~150-line pure-Python reference scheduler. nodina ties or beats it on every case (deep chains and small graphs 3-4x faster); see benchmarks/RESULTS.md and benchmarks/BASELINE.md.

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

nodina-1.0.0.tar.gz (170.8 kB view details)

Uploaded Source

Built Distributions

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

nodina-1.0.0-cp314-cp314-win_amd64.whl (257.8 kB view details)

Uploaded CPython 3.14Windows x86-64

nodina-1.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (873.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

nodina-1.0.0-cp314-cp314-macosx_11_0_arm64.whl (272.1 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

nodina-1.0.0-cp314-cp314-macosx_10_15_x86_64.whl (276.6 kB view details)

Uploaded CPython 3.14macOS 10.15+ x86-64

nodina-1.0.0-cp313-cp313-win_amd64.whl (254.7 kB view details)

Uploaded CPython 3.13Windows x86-64

nodina-1.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (883.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

nodina-1.0.0-cp313-cp313-macosx_11_0_arm64.whl (268.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

nodina-1.0.0-cp313-cp313-macosx_10_13_x86_64.whl (273.3 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

File details

Details for the file nodina-1.0.0.tar.gz.

File metadata

  • Download URL: nodina-1.0.0.tar.gz
  • Upload date:
  • Size: 170.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nodina-1.0.0.tar.gz
Algorithm Hash digest
SHA256 730c061c762935fa054da16459f4852e5e78177b47ab1a7d42a96d43c825e278
MD5 21998f954efbe5962f56d61ed76ac8c0
BLAKE2b-256 048d72af5b430f2c4c2ad46a2fcfb4895098376cf6ac18db89583d1ad007421c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0.tar.gz:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: nodina-1.0.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 257.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nodina-1.0.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 783f15497eb507251b78818934b752bf4d198f7d8a70e8d46a0becc924943fea
MD5 5fafadf8c4aaaeb20f44f8a62c4bfa12
BLAKE2b-256 a0e4c731b46dc05b8648662444c22f54b45cd35c648d5cfee00bb202108bb974

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp314-cp314-win_amd64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nodina-1.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cad4810402bbd834238e9cb86bc6720e207001b8053741f7f5ad25e5b2cc12d0
MD5 1ffdaed199f9c1c148beae9ed1d13b90
BLAKE2b-256 53bcd4570ac1f2d05ed4369b22990313e6a3fe934980cd55285d8ad8f90a716d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nodina-1.0.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9d56820295b414df24e3bdc8160c27b87995b81ef3a422c293bb31568a8a8a8b
MD5 2adc18da981f5152007880ece188c534
BLAKE2b-256 6d101102275c18a7e8fa2b8646db39abff405994fcaa47279b93eeaf53b9be4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp314-cp314-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for nodina-1.0.0-cp314-cp314-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 b8c9fabe7916e46224e656c86386e981c59470c615749de5d7e73c0bae31fa3b
MD5 ebc8b44d8a3c8790572e9c9fc6b5f8ef
BLAKE2b-256 9d92cb8c7fa07f2ba952f616e4be08d6ccef2028704de82185b9f1f928a422b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp314-cp314-macosx_10_15_x86_64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: nodina-1.0.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 254.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nodina-1.0.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 46d4fda9ed2948290bfe7a269607f31c8fe266db87c13c0cede17ba88bb57494
MD5 0dab0d67ec16dcac81069b608bc492f1
BLAKE2b-256 779aeec91b3293d40b6fe58c150febfbfa18d38b4550bf0bafa469376479b443

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for nodina-1.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 604519cccf84bdc847a6e1afb18f8785280918bcfb61dd2ef420a6a2f1460858
MD5 46484e5671473fbaee6ecffddbfdfa50
BLAKE2b-256 ec09c7aac21906b7356f697ae8648afb99212fcc21fb9e00bf37c413c304c49e

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for nodina-1.0.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07964ed435415f0c859a7515b728131da726a7e1b15e25dbe2e93f4b84719725
MD5 98d520101b903d1c466fa00a3a13cd34
BLAKE2b-256 e96925e54a394291822a0617c476c012e2b64d41009317e0c3952db10be3c5d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodina-1.0.0-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for nodina-1.0.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 209401ff98babcb6e4cc10a44139eb1d7148a7667d5d8a332404a13b73f74281
MD5 7ad3435a1844e37492bcff4bf94eab14
BLAKE2b-256 08e4680c807cc04b94f8992afa203a89a3e5d83fb04e2a37e376ea7f762c7f4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodina-1.0.0-cp313-cp313-macosx_10_13_x86_64.whl:

Publisher: release.yml on luwqz1/nodina

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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