bicker
Tiny, fully typed CLI argument parser: declare your args as a class.
pip install bicker
No dependencies.
Usage
from typing import Literal
from bicker import flag, opt, parse_args, pos
class Args:
src: str = pos(description="Image to resize")
dst: str = pos("out.png", description="Where to save it")
width: int = opt(800, "-w", metavar="PX", description="Target width")
fmt: Literal["png", "jpg"] = opt("png", "-f", description="Output format")
verbose: bool = flag("-v", description="Print progress")
args = parse_args(Args)
args is an Args instance, so your type checker knows args.width is an int and
args.fmt is Literal["png", "jpg"]. No casts, no stubs, no plugins.
$ python resize.py -h
Usage: resize.py [-w PX] [-f {png,jpg}] [-v] src [dst]
Positionals:
src Image to resize
[dst] Where to save it
Options:
-w, --width PX Target width
-f, --fmt {png,jpg} Output format
-v, --verbose Print progress
-h, --help Show this message and exit
$ python resize.py cat.jpg -f gif
error: -f must be one of: "png", "jpg"
Usage: resize.py [-w PX] [-f {png,jpg}] [-v] src [dst]
Output is colored in a terminal, unless NO_COLOR is set.
Declaring arguments
| Declaration | Gives |
|---|---|
pos() |
A required positional |
pos(default) |
An optional positional (after the required ones) |
opt(default, "-c") |
An option: --name VALUE, plus an optional short key |
flag("-v") |
A bool option without a value, False unless given |
Each takes an optional description= for help. Options and flags also take long= to
change their long key (which defaults to the field name, with _ as -), and options
take metavar= to change their placeholder in help.
Types: str, int, float, or a Literal of strings or ints (which only allows its
values). Annotate a field as list[...] of any of these to take several values:
class Args:
point: list[int] = pos(nargs=2) # Exactly 2
files: list[str] = pos() # One or more: the remaining positionals
tags: list[str] = opt([], "-t") # Repeatable: -t a -t b
ids: list[int] = opt([], nargs=(1, 3)) # Given 1 to 3 times
A list positional must come last, unless nargs fixes its count.
Mistakes in the class itself (e.g. an unsupported type or a key used twice) raise
TypeError as soon as parse_args runs.
Parsing
Command lines follow GNU conventions: options and positionals can be mixed, values can
be attached (--width=400, -w400), short flags can be grouped (-vq), long keys can be
shortened to any unambiguous prefix (--wid), and everything after -- is a positional.
parse_args also takes description=, epilog= and examples= for the help page, and
a few settings like prog= and help_keys=. See its docstring for all of them.
Not supported (yet)
- Subcommands
- Other value types (e.g.
Path,Enum) - Required options
- Short-only options
--version- Custom colors
Feature requests are welcome: open an issue.
License
MIT
Metadata
Release files for bicker 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bicker-1.0.0.tar.gz | 12.7 kB | Without provenance | Details for bicker-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bicker-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for bicker-1.0.0-py3-none-any.whl |
Total release size: 27.5 kB
Release files / bicker-1.0.0.tar.gz
| Download URL | bicker-1.0.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
97c2d8bf6869b1a25151c501a7cf3fd5ca3e59a1c4722f4735fd8d69ac5f88d7
|
|
BLAKE2b-256 checksum How to use checksums |
e4dc468811f196b28f13503c02ec9bccf3e4eb0aa40599bdf863192ca17461cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bicker-1.0.0-py3-none-any.whl
| Download URL | bicker-1.0.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efad0b0e0aaeb05bd9e88e6e24f07868dc2b2b914b88516d027371a8629c6e98
|
|
BLAKE2b-256 checksum How to use checksums |
3a8932f7e409f1674ca9e260777772cb17507ba748271eb6b9acdf49ca600044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for bicker 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.