Build a Python CLI for your app, just using type hints and docstrings.
Project Links
Meta
Author: Daniel Townsend
Requires Python: >=3.9.0
Classifiers
License
- OSI Approved :: MIT License
Programming Language
- Python
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: Implementation :: CPython
targ
Build a Python CLI for your app, just using type hints and docstrings.
Just register your type annotated functions, and that's it - there's no special syntax to learn, and it's super easy.
# main.py
from targ import CLI
def add(a: int, b: int):
"""
Add the two numbers.
:param a:
The first number.
:param b:
The second number.
"""
print(a + b)
if __name__ == "__main__":
cli = CLI()
cli.register(add)
cli.run()
And from the command line:
>>> python main.py add 1 1
2
To get documentation:
>>> python main.py add --help
add
===
Add the two numbers.
Usage
-----
add a b
Args
----
a
The first number.
b
The second number.
Documentation
The full documentation is available on Read the Docs.
Jul 09, 2025
0.6.0
May 19, 2025
0.5.0
Mar 21, 2024
0.4.0
Mar 23, 2023
0.3.8
Apr 08, 2022
0.3.7
Nov 03, 2021
0.3.6
Aug 09, 2021
0.3.5
Jun 22, 2021
0.3.4
May 13, 2021
0.3.3
May 13, 2021
0.3.2
May 13, 2021
0.3.1
May 13, 2021
0.3.0
May 12, 2021
0.2.0
Jan 25, 2021
0.1.9
Nov 15, 2020
0.1.8
Oct 23, 2020
0.1.7
Jun 10, 2020
0.1.6
May 07, 2020
0.1.5
Apr 24, 2020
0.1.4
Apr 22, 2020
0.1.3
Apr 22, 2020
0.1.2
Apr 21, 2020
0.1.1
Apr 18, 2020
0.1.0