arglite
A lightweight, explicit argument parsing library for Python programs.
arglite is for when you want a simple CLI parser without the boilerplate of argparse. Declare your flags, access them as attributes, and get on with your program.
Quick example
demo.py
import arglite
arglite.parser.require("name", type=str)
arglite.parser.optional("count", default=1, type=int)
arglite.parser.flag("verbose")
def main():
print(arglite.parser.name)
print(arglite.parser.count)
print(arglite.parser.verbose)
if __name__ == "__main__":
main()
Output:
Why arglite?
- Explicit declarations — no reflection, no source-code scanning, no magic.
- Short syntax —
-nis automatically derived from--name. - Type conversion — get
int,float,bool, or raw strings. - YAML config — move flag metadata into
.arglite.yaml. - Help built-in —
-h/--helpprints a Rich table of all flags.