Arguments parser with class for Python, inspired by StructOpt
Project description
Welcome to ClassOpt 👋
Arguments parser with class for Python, inspired by StructOpt
Install
pip install classopt
Usage
Import ClassOpt
and define the Opt class with decorator.
from classopt import ClassOpt
@ClassOpt
class Opt:
arg_int: int
arg_str: str
if __name__ == "__main__":
opt = Opt.from_args()
print(opt.arg_int, opt.arg_str)
Run with command line arguments.
$ python main.py --arg_int 5 --arg_str hello
5 hello
Run tests
poetry run pytest
Author
👤 moisutsu
Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2021 moisutsu.
This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator
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
classopt-0.1.0.tar.gz
(2.9 kB
view hashes)