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()):
...
Metadata
Release files for typer-tools 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| typer_tools-0.1.6.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| typer_tools-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / typer_tools-0.1.6.tar.gz
| Download URL | typer_tools-0.1.6.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa83428796b1d1a2a088ba478dfb6accc3c779d77f46ad3384e237866409a793
|
|
BLAKE2b-256 checksum How to use checksums |
422f5d051ea33489e860ccd151d7dec9909b57d3e4655fbaf4cfd9845954e7e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.10
|
Release files / typer_tools-0.1.6-py3-none-any.whl
| Download URL | typer_tools-0.1.6-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01ceb778eb03d8033697f5172d1de0a2deee41b5c1c7140ff2127118d974cde8
|
|
BLAKE2b-256 checksum How to use checksums |
fca2aee3b629c622cd32c993b3c8bdbd879a41b972329b0a94a6268e643326e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.10
|