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-scheduler

## 🧠 Quick Start

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

```python
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.

aion_scheduler-0.1.0-cp314-cp314-win_amd64.whl (397.2 kB view details)

Uploaded CPython 3.14Windows x86-64

aion_scheduler-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (496.8 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

aion_scheduler-0.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (488.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

aion_scheduler-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

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

Uploaded CPython 3.13Windows x86-64

aion_scheduler-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (496.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

aion_scheduler-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (487.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

aion_scheduler-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

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

Uploaded CPython 3.12Windows x86-64

aion_scheduler-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (497.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

aion_scheduler-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (487.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

aion_scheduler-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 aion_scheduler-0.1.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 31aab3f7e32cee4ba86e27e3e326299910006a6bc09b2e979a51101362e369da
MD5 2af338ed900e0530230b9d7cf3e3ee39
BLAKE2b-256 830d4d5f67e56385ca867da41c9aed03e15547d1d0ba0772ecb9e7113187b991

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78ec8c506de28e0472ed17f69c2417272ec9bf466e0a5590addf46d8d438997d
MD5 2cc216a2db69dc175746d2e7adb6dc31
BLAKE2b-256 70e855a3858491cb056a3ad9b2453055487e1e9ca38accaf568dc64fff2fdf2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 479c7f47d1aa1c6145502b607d768c48bc64c3849491ef36ae4f571c5aadfd5e
MD5 5ad0c5d174ae9060b7944ae992656955
BLAKE2b-256 a79eb9175527fb36b951f33c6eb4d547dc3c33c5ce16ae0fbf04daf9c80c2704

See more details on using hashes here.

File details

Details for the file aion_scheduler-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 aion_scheduler-0.1.0-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 1d126404b875685c37f33f085dfdd883fc42c98f01eebfda984ddf0c86479717
MD5 6a7a15199d381d5d265be59ee5b1fcb4
BLAKE2b-256 3d929c6da196f6b4629f4ac89068b72b5289e70aa019af0edc164c471a484fdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 89c1ac501fa379f8ba7ea76bc20ad4c519e58b897dde2813122eeac6060dee64
MD5 f412da08051e7c2816f53e48786aba18
BLAKE2b-256 96708f5dd2ddca29497ab05bca84f9360bf6efb6bef3be2a22758f461809601c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 adefe96b4c340d3d569a797c8ff470ba94b604f919a160394b279cebd13ac1f8
MD5 d526bcc8cad7f19a45a79597de564e99
BLAKE2b-256 52983205a039ad3f1ea5dec5dea1a4414e60000bbb784437446f7d5721781506

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bf5856644173a9083839f013e2e0fed3417b54cd8d66ebf364a2bff8ac6b80d9
MD5 024a54f29e2bf973f14b57f67bd828e2
BLAKE2b-256 549d7554862914d12c465e07ccafc1332025cc3ca5d760b7deac90ddee33f43e

See more details on using hashes here.

File details

Details for the file aion_scheduler-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 aion_scheduler-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b828235b3299dfae9f5950b2bea0d5e2e30bcc85b7d9011a1de0ce50a7cb5d74
MD5 41e90a354a837abd6119ffa9b72592b1
BLAKE2b-256 176e4237d4d9ab9172cb23cf37593d440f7c5353b713778e2226af546b066797

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cb103b73eb517fd658615a84f7d5c10e491304c3f5014373358bfc0393f0d382
MD5 1146f678264e28b9771f7303dffaa4f3
BLAKE2b-256 7d9193d8ea3f2d8f82bef85c25a06aae82a3a0542e920cdf0888f54bb9714125

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94573995d4adc84240b7dbe385d3e38512cd3611933e7c18cc2e3a88c745f38f
MD5 2016c8c118c2335381d13eef5bfe6450
BLAKE2b-256 0cb9a818e47631e865e413b869d265d8ab115e016b067d431ede2e5b56e8853e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aion_scheduler-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b996917da7335715a5e1a2c7d09c3376203fc309075025e05689efa8bae0e3da
MD5 b107daacc6d9791566e8f79975fdbf78
BLAKE2b-256 021a5d8fb9f988c900cb6d39ad8f01a6f09232cc55adf8a854df3677aa242f24

See more details on using hashes here.

File details

Details for the file aion_scheduler-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 aion_scheduler-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9dc6ab1446a62b9fcafb7dfe102e08f5dea0c211549994d548740f4b03865eb7
MD5 90970b4a07a69c7449ac87249c3a6717
BLAKE2b-256 7b5bb5ef3fba77f15530dfdccf189c216330eae3d80f0cd68a99897c2d3c0736

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