CLI value guards for argparse and Typer.
Project description
cliguards
CLI value guards for argparse and Typer.
argparse
Use guards as native argparse type= converters:
import argparse
from cliguards import PathGuard
parser = argparse.ArgumentParser()
parser.add_argument("--input", type=PathGuard.file("tsv", "tsv.gz"))
args = parser.parse_args()
Typer
Install the optional Typer extra:
pip install "cliguards[typer]"
Use fluent adapters with Annotated:
from pathlib import Path
from typing import Annotated
import typer
from cliguards import PathGuard
app = typer.Typer()
@app.command()
def run(
input: Annotated[
Path,
PathGuard.file("tsv", "tsv.gz").as_typer_option("--input"),
],
) -> None:
typer.echo(input)
Public API
from cliguards import HexColorGuard, NumericRangeGuard, PathGuard
V1 guards are single-value guards. They do not expose public specs, public guard error classes, automatic help generation, or multi-value helpers.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cliguards-0.1.0.tar.gz.
File metadata
- Download URL: cliguards-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69b4e207f47149905e1a83ee6cc1ffd4ff051be24a853a2ffecd9fb0c203991d
|
|
| MD5 |
5dcb4b2ffc5847094d4ffd9f74992f40
|
|
| BLAKE2b-256 |
2380f0834ca31c685c18ac89f2d6a97662305b231eedf104689b59689735cbd9
|
Provenance
The following attestation bundles were made for cliguards-0.1.0.tar.gz:
Publisher:
publish.yml on FuqingZh/cliguards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cliguards-0.1.0.tar.gz -
Subject digest:
69b4e207f47149905e1a83ee6cc1ffd4ff051be24a853a2ffecd9fb0c203991d - Sigstore transparency entry: 2057892975
- Sigstore integration time:
-
Permalink:
FuqingZh/cliguards@08f41bd94dfb21cdacf4ed2ccac82d49c6b3a583 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/FuqingZh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08f41bd94dfb21cdacf4ed2ccac82d49c6b3a583 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cliguards-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cliguards-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea1341b5e839405f49aaebfd452f2c9b780350fc739fad0414e4c193febfcc96
|
|
| MD5 |
4a8890de5c4bb1512a83d2ba0d1ebdb5
|
|
| BLAKE2b-256 |
31bbcd8b5028315b0431f58d49fea05d0a2bba4b3a954724dd34a523a91286a2
|
Provenance
The following attestation bundles were made for cliguards-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on FuqingZh/cliguards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cliguards-0.1.0-py3-none-any.whl -
Subject digest:
ea1341b5e839405f49aaebfd452f2c9b780350fc739fad0414e4c193febfcc96 - Sigstore transparency entry: 2057893488
- Sigstore integration time:
-
Permalink:
FuqingZh/cliguards@08f41bd94dfb21cdacf4ed2ccac82d49c6b3a583 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/FuqingZh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@08f41bd94dfb21cdacf4ed2ccac82d49c6b3a583 -
Trigger Event:
push
-
Statement type: