package_description
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
Release history Release notifications | RSS feed
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.2.tar.gz
(2.9 kB
view details)
Built Distribution
File details
Details for the file typer_tools-0.1.2.tar.gz
.
File metadata
- Download URL: typer_tools-0.1.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e4d483197a343a2a16f8902a094f6750a45e6abdc2ad98fb6036f4798f8790a |
|
MD5 | b9589fdacb202a7c71a5d84921209619 |
|
BLAKE2b-256 | 3afccc8709696f3e6ee47ce59153d18bbf6dbdb5c967b7cd1cd177fc8c6faeb5 |
File details
Details for the file typer_tools-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: typer_tools-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 185911083f5b9e4142bf1005d751bafda2dccb08219406e292da205931266cfd |
|
MD5 | ded73e498190973f4b7302391307a539 |
|
BLAKE2b-256 | 867709e18cb9db87c23af89ceee588f3a44d31e9b24f4269e4ddd8339df7d009 |