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.1.0.tar.gz (4.6 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.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: asyncx_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 b8b4fa78c1c35f1764149785a67257a1378292fa1331c6a0f6e6cd134393602e
MD5 b2492ace2bb2607858da2c5a9ddc65db
BLAKE2b-256 de5cbd999ee9828610954bb3c529cb1992bbd0865c48ce9009eb9d79f766eb2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: asyncx_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17fd0f3dbaee6fbb5085fbf4e0dcc9ccd35bf475ff46dee1e400c41e0a3142ab
MD5 6f79e10a18c0ccdffddb9a1b0cad099d
BLAKE2b-256 d8313fbec182d953e1459b0c429f27a88b4eb4f456e6da044af3d755f83d15cd

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