Skip to main content

A simple async wrapper for typer

Project description

async-typer

async-typer is a simple async wrapper for the typer library. We already have a lot of async implementations for our applications, but we can't use them easily with typer. With this simple wrapper, we can use async functions in CLI with typer-like interface. And async-typer have more features than typer to solve our real-world problems in a more elegant way.

Installation

pip install async-typer

How to use

from async_typer import AsyncTyper


app = AsyncTyper()

@app.command()
def foo():
    service.work()

@app.async_command()
async def bar():
    await service.work_async()

FastAPI-like event handlers

Handle startup and shutdown events with async or sync functions.

app.add_event_handler("startup", redis_async_pool_manager.init_redis_pool)
app.add_event_handler("shutdown", redis_async_pool_manager.close_redis_pool)

Please check the typer documentation for more information.

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

async_typer-0.1.10.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

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

async_typer-0.1.10-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file async_typer-0.1.10.tar.gz.

File metadata

  • Download URL: async_typer-0.1.10.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for async_typer-0.1.10.tar.gz
Algorithm Hash digest
SHA256 69a857a2b66a8604e4bac3b5c44a6384b35da9f5314c7847da561e874b2bad39
MD5 d476c648815b9432c8672bd8415474e0
BLAKE2b-256 255f04c052bf7f8633f7fd3dd67cd8f3542a2aff432fa1e5b14b737465b44e0f

See more details on using hashes here.

File details

Details for the file async_typer-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: async_typer-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for async_typer-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 25aadaf6e54c1d47a9c2d6a2bbb0832a2a2fe700be4bb52f38843514d724b380
MD5 6626b446a51a5c8e41ac5eb3be058c1f
BLAKE2b-256 b7971d78783a1a568537f5d29c236dfc3e1723fbc651d3c94005ac5724aa26ca

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