Skip to main content

Run async functions in Rust

Project description

aion

Async job scheduling for Python, powered by Rust’s Tokio runtime.

aion lets you schedule and run asynchronous jobs in Python with Rust-level performance. It bridges Python’s asyncio world with Rust’s high-performance Tokio runtime — giving you a faster, safer way to execute async tasks, periodic jobs, and cron-like schedules.

✨ Features

  • 🚀 Powered by Rust Tokio — concurrency with minimal overhead
  • 🧩 Python async compatible — runs within existing asyncio loops
  • Job scheduling — supports delayed, periodic, and cron-style scheduling
  • 🔄 Thread-safe — Rust-backed atomic control and synchronization
  • 🧠 Lightweight — no background daemon or external broker required

📦 Installation

Install directly from PyPI (once published):

pip install aion

Or, build from source using Maturin:

git clone gitlab@gitlab.balaenaquant.com:balaenaquant/core/aion.git
cd aion
uvx maturin develop

🧠 Quick Start

Here’s a simple example showing how to schedule async jobs using aion.

import asyncio
from datetime import timedelta
from aion import Scheduler, Trigger

async def hello():
    print("Hello from Aion!")

async def main():
    scheduler = Scheduler()

    # Run every 1 second
    await scheduler.schedule(handler=hello, trigger=Trigger.Interval(timedelta(seconds=1)))

    # Run immediately
    await hello()

    # Keep the scheduler running
    await scheduler.start()

asyncio.run(main())

Cron expressions

You can also schedule jobs using cron-like syntax:

import asyncio
from aion import Scheduler, Trigger

async def report():
    print("Generating report...")

async def main():
    scheduler = Scheduler()
    await scheduler.schedule(handler=report, trigger=Trigger.Cron("0 * * * *"))  # Run every hour
    await scheduler.start()

asyncio.run(main())

⚙️ API Overview

Function / Class Description
Scheduler Core job scheduler managing async task lifetimes.
Scheduler.schedule Puts an async function onto the scheduler.
Scheduler.start Starts the scheduler, this will block forever.
Scheduler.pause Pause a scheduled job, can be resumed.
Scheduler.resume Resumes a paused job, no effect if job is not paused.
Scheduler.shutdown Shutdown the scheduler, all scheduled jobs will also exit.
Trigger Represents a method of invoking a job.

🧪 Testing

aion uses pytest and pytest-asyncio.

Run all tests:

uv run pytest -v

🛠️ Developer Guide

To rebuild the Python extension:

uv sync --reinstall # rebuild the rust lib and loads it into venv

To check the Rust code:

cargo check
cargo test

To format code:

cargo fmt
ruff check . --fix

Directory structure

aion/
├── src/              # Rust sources
├── aion/             # Python module
├── examples/         # Usage examples
├── tests/            # Python tests
├── Cargo.toml        # Rust dependencies
└── pyproject.toml    # Python packaging

📄 License

Copyright © 2025 Balaena Quant

All rights reserved. This is a proprietary and confidential work. Unauthorized use, duplication, or distribution is prohibited.

🌌 Why “Aion”?

In ancient Greek, Aion represents eternal time — the endless flow that powers all things. This library brings that concept to async programming: efficient, perpetual scheduling powered by Rust.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

bq_aion_rs-0.1.0-cp314-cp314-win_amd64.whl (397.3 kB view details)

Uploaded CPython 3.14Windows x86-64

bq_aion_rs-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (497.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

bq_aion_rs-0.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (487.2 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

bq_aion_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.0 MB view details)

Uploaded CPython 3.14macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

bq_aion_rs-0.1.0-cp313-cp313-win_amd64.whl (396.4 kB view details)

Uploaded CPython 3.13Windows x86-64

bq_aion_rs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (497.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

bq_aion_rs-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (486.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

bq_aion_rs-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

bq_aion_rs-0.1.0-cp312-cp312-win_amd64.whl (396.6 kB view details)

Uploaded CPython 3.12Windows x86-64

bq_aion_rs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (498.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

bq_aion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (486.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

bq_aion_rs-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.0 MB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file bq_aion_rs-0.1.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 7d8a30b80277dc286968e51a936bcd9149ac01c06db422e631432d64d42e7cb2
MD5 4865b8aeacc79c8b9f6d11b0bced9e70
BLAKE2b-256 271227bd61eae7c3704ed529b07454efce418fc7a496d21a03a6ea2d1c2ec97e

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9535e1ec48461630d3e7f40c83c40ec5bb69f26b2a52facefab94fd8d65a4d14
MD5 a6a5d408534703bcd4a84763e77b47f1
BLAKE2b-256 1b9d0021ba30b8458f0ecc819de76a4d62a967f4f74979139877bd9a3df632ad

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 691b077ebc722584545d25f62471868cc2ae60a469a3a381aa974193da3ff86a
MD5 596198e57487f6a08aa9d7b97bcd7031
BLAKE2b-256 8754bd372633643ce15dc09fd56309969fb0f9f89d2a5df73e696547f01a2d23

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 4bccde19716aef29ed2d02790bb110f2e8aa9cc447559be138fb35413d649b7b
MD5 f43e31ab756656140e51a62a14ca17c4
BLAKE2b-256 1840749cb1fccc5b04ac5677d8e5d8c5082604ea5109c013e369f65d62f3c9ec

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7c58c47cfe0cf303f4f66214c44eb25c7e80ef9b7c664986d039a54b63008362
MD5 7a3e3c4d775dd24eed7faaf14ad7c41d
BLAKE2b-256 7968e2165b4219b5480c3c482eb631a2be128f0cd6126f4cf63d2f25d9ed63aa

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c98b12c07e7203a39fe70cd1eab2671872871798462a1b4f31b0f518e78c0033
MD5 4cc538107c0902cba878092303bb950d
BLAKE2b-256 54a9eb65310a2ea53617ad15ddf08265972bfe104e1782ba06387e23bff1d998

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 22f8c7c38f6719d46f41c341f4b7a8c041f2d42c9975427d7aa9aaaa38ab4c07
MD5 4292999e709b485da0c03c2aefe32f15
BLAKE2b-256 aa4c51b9dff63b0b13620a311e19e5b720dc3831e5e0fe66b2b99ca377ae83b5

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 a127d2583784ea1a3a4ee582add7e094606425037c645c956663c2de9418e3f9
MD5 27d81c7b008726c0599e39e2dd752557
BLAKE2b-256 2159a73f2969a0cb80b5d71703ac7950122ca54e118f9a59abab4e0885145fb5

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 efc0bd259a3b76ed6ab6c65cc83fb43b1ac5ca00239b739dc5ce90008d4e84a3
MD5 226effc04b12f1618df77f6f5342f514
BLAKE2b-256 652aa08741c9063c2f5228790f2a5fb195e3476f194858fd9e8fcd79635d1db2

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d3e358707f180a8fa3a25f49f9a54e7c232eab91fab80b595a01c8728363d95
MD5 7baed7827c49fd6e1b72b195162443d0
BLAKE2b-256 67c3c8ed604be9915720d4f2d20fe50c1b5484d2500fabfded1926a31ba0f9f3

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ded2436e72caca8161d67695981ebda3ecb90d605eb7d49df060497a6fb9d9cb
MD5 2faf43e14a17b9f30f9153cb6d0fb22a
BLAKE2b-256 3b52f5c8c2e127ae64bf4dfc690029b869e66e90e1d3946bd0e234a73f865736

See more details on using hashes here.

File details

Details for the file bq_aion_rs-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for bq_aion_rs-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 35ce6387eebde033c552dd5bbe8b5b7a45497e72a6a3ead3b0244c7a0a1ea5c0
MD5 6c0b02c3d3fc2ca534bb17260a7c8205
BLAKE2b-256 4daf9913e286a3a27370f8cc8755504305f05bdbb93b39dd792c60a7d7b5a919

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