No project description provided
Project description
aclick
aclick is a python library extending click
with the support for typing. It uses function signatures to
automatically register options to parsers. Please refer to the documentation.
The following features are currently supported:
- Positional-only parameters are added as click Arguments, other parameters become click Options.
- Docstring is automatically parsed and used to generate command and parameter descriptions.
- Arguments with
int
,float
,str
,bool
values both with and without default value. - Complex structures of classes and dataclasses that are automatically inlined as a single string, e.g.,
class1("arg1", arg2=class2())
. - Complex structures of classes and dataclasses that are expanded as individual options with the
hierarchical=True
option enabled. - Type
Union
of complex classes both inlined and hierarchical. - Type
Optional
of inlined complex classes. - Type
Literal
of strings. - Lists and tuples of both the primitive and inlined complex types.
- For other features please refer to the documentation.
Installation
Install the library from pip:
$ pip install aclick
Getting started
Import aclick
instead of click
:
# python main.py test --arg2 4
import aclick
@aclick.command()
def example(arg1: str, /, arg2: int = 5):
pass
example()
When using click.groups
:
# python main.py example test --arg2 4
import aclick
@aclick.group()
def main():
pass
@main.command('example')
def example(arg1: str, /, arg2: int = 5):
pass
main()
For further details please look at the documentation.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aclick-0.1.0.tar.gz
(18.9 kB
view details)
Built Distribution
aclick-0.1.0-py3-none-any.whl
(20.0 kB
view details)
File details
Details for the file aclick-0.1.0.tar.gz
.
File metadata
- Download URL: aclick-0.1.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 604499c3de045c18cf6ed470f8f3865a9a7a5f991dc7ebbbe27635b96ded0aa7 |
|
MD5 | e39515e21a80eccc333e9ee60dcec9e3 |
|
BLAKE2b-256 | 74711429a950319752b34f35734bbd143f06b7dc634f850c506f9954cd793818 |
File details
Details for the file aclick-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: aclick-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7b0ccbd39a8932715a74a480808c27e47dbc911d30eaacbe285624adba2b7b4 |
|
MD5 | f3557d2543580487fe388cc9a4f95234 |
|
BLAKE2b-256 | 47a95e48c548d27bf8cff4ad4d14df5594c3ed09ea488c3ea42781a5646baa88 |