Skip to main content

非同期タスク管理・同期/非同期変換ライブラリ

Project description

AsyncX Tools

非同期タスク管理のためのPythonライブラリです。

機能

  • 複数の非同期タスクの並行実行
  • タスクの優先順位付け
  • エラーハンドリング
  • タスクの進捗監視
  • リソース制限のサポート
  • 同期処理から非同期処理への変換
  • 非同期処理から同期処理への変換

インストール

pip install asyncx-tools

使用例

タスク管理

from asyncx import TaskManager, Task

async def main():
    manager = TaskManager()
    
    # タスクの作成
    task1 = Task("task1", priority=1)
    task2 = Task("task2", priority=2)
    
    # タスクの実行
    await manager.run_tasks([task1, task2])

同期処理から非同期処理への変換

from asyncx import sync_to_async

# 同期関数
def heavy_calculation(x: int, y: int) -> int:
    # 重い処理
    return x + y

# 非同期関数に変換
async_heavy_calculation = sync_to_async(heavy_calculation)

# 使用例
async def main():
    result = await async_heavy_calculation(1, 2)
    print(result)  # 3

非同期処理から同期処理への変換

from asyncx import async_to_sync

# 非同期関数
async def async_operation(x: int, y: int) -> int:
    await asyncio.sleep(0.1)
    return x + y

# 同期関数に変換
sync_operation = async_to_sync(async_operation)

# 使用例
result = sync_operation(1, 2)
print(result)  # 3

ライセンス

MIT License

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

asyncx_tools-0.2.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

asyncx_tools-0.2.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file asyncx_tools-0.2.0.tar.gz.

File metadata

  • Download URL: asyncx_tools-0.2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for asyncx_tools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ded67e8a94bd6454d841f2a4ec5a6dddd6fe770901c7ff99c23eb636141a2441
MD5 0bdfd6a3e202a3296de6a343ec261d7a
BLAKE2b-256 605ad3da34cc04083bc936810db4e3b6d3a2cd4215fed9e08fd249f6ec1019db

See more details on using hashes here.

File details

Details for the file asyncx_tools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: asyncx_tools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for asyncx_tools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40c1a2af05a320461a6262368584dce06ed9dc41758eaa875f72e38ede1c5687
MD5 d73318d5ec64d974054cec45594b15bb
BLAKE2b-256 198581666ca96fbaf9f1f212c12bc4d7f1be23f53cc882d653349a3a176c7943

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