Skip to main content

Simple tools for Typer CLI

Project description

Typer Tools

Simple tools for Typer CLI

pip install typer-tools

Options Anywhere

Typer does not support making cli -v export and cli export -v work the same way. But we can handle:

from typer_tools import option

Verbose = option(False, '-v', '--verbose') # drop-in replacement for typer.Option

@app.callback()
def main(verbose: bool = Verbose):
  ...

@app.command()
def export(verbose: bool = Verbose):
  ...

Dependency Injection

Typer does not support dependency injection. But we can handle:

from typer_tools import Dependency

def parse_client(
  host: str = typer.Option(..., '--host', help='HTTP host'), # or our own `option`, plain better
  port: int = typer.Option(80, '--port', help='HTTP port'),
  token: str = typer.Option(..., '--token', help='Access token')
) -> Client:
  ...

dep = Dependency(parse_client)

@typer.command()
@dep.inject
def main(some_option: str, client: Client = dep.Depends()):
  ...

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

typer_tools-0.1.5.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

typer_tools-0.1.5-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file typer_tools-0.1.5.tar.gz.

File metadata

  • Download URL: typer_tools-0.1.5.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for typer_tools-0.1.5.tar.gz
Algorithm Hash digest
SHA256 3b45f91f0bee2e913e5e517e2ceb59b2970c40ac76a99f44c9ceb4ab98591144
MD5 10e9ded08c450695a3293d7bf0eb0e06
BLAKE2b-256 c22b64edc7654daba1d82209db8e7771d7b6f51a85b0d54967c697802b68efa0

See more details on using hashes here.

File details

Details for the file typer_tools-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: typer_tools-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for typer_tools-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 55ab80380eebc03717b93d8a504240efe46bda2783220d7e9109a36577aea392
MD5 edd3c3d225757d653f93f01d8f7cad8d
BLAKE2b-256 d24c5a973f4f7a4d0fba85d7868a842c7370ffe48ca8d22c2e06dff712431d4c

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