Skip to main content

Combines anyio and typer together for writing asynchronous commandlines

Project description

AnyioTyper

Wraps In Typer with Anyio, unlike Async-Typer AnyioTyper's goal is to allow customization with different eventloops

from anyio_typer import AnyioTyper, Option
from typing import Annotated
app = AnyioTyper()

# This example uses a library called cyares you can install it with `pip install cyares`

# NOTE: winloop is supported by default if your on a windows operating system
@app.uvloop_command()
async def uvloop(
    host:str,
    rt:Annotated[str, Option(help="A Type of record to uncover", show_default=True)] = "A" 
    ):
    """Use Uvloop or Winloop for DNS Resolving"""
    
    from cyares.aio import DNSResolver

    async with DNSResolver(["8.8.8.8", "8.8.4.4"]) as resolver:
        result = await resolver.query(host, rt)
    print(result)

@app.trio_command()
async def trio(
    host:str,
    rt:Annotated[str, Option(help="A Type of record to uncover", show_default=True)] = "A" 
    ):
    """Use Trio for DNS Resolving"""
    from cyares.trio import DNSResolver

    async with DNSResolver(["8.8.8.8", "8.8.4.4"]) as resolver:
        result = await resolver.query(host, rt)
    print(result)


if __name__ == "__main__":
    app()

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

anyio_typer-0.0.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.

anyio_typer-0.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file anyio_typer-0.0.0.tar.gz.

File metadata

  • Download URL: anyio_typer-0.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for anyio_typer-0.0.0.tar.gz
Algorithm Hash digest
SHA256 afa4b70cd3835a1559d2e6bec01560b816a431306305fe08290a16cae63703a6
MD5 decd4e5315a3723b56e2c07045470511
BLAKE2b-256 40a1792e5397aa70ed37e3da608cdd3884841c588c4eabb57294fb5fc870af46

See more details on using hashes here.

File details

Details for the file anyio_typer-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: anyio_typer-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for anyio_typer-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7fd8c96bea170af38b0f202d8f11f695fdfa24d5f3dfb5fbb5eada5cbc5300f
MD5 a3c07e4c76fb85316d0c6cc8b8912273
BLAKE2b-256 08676752e2df7178af1cb4782cc00e7b668033a1570e5184a29683a7f79c282b

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