Skip to main content

No project description provided

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. 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.8.tar.gz (1.6 kB view hashes)

Uploaded Source

Built Distribution

async_typer-0.1.8-py3-none-any.whl (2.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page