argparse-action-0.5.2
توضیحات
configure argparse from function signature
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | argparse-action-0.5.2 |
| نام | argparse-action |
| نسخه کتابخانه | 0.5.2 |
| نگهدارنده | ['Nyiro Gergo'] |
| ایمیل نگهدارنده | ['gergo@nyiro.name'] |
| نویسنده | - |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/nyirog/argparse_action |
| آدرس اینترنتی | https://pypi.org/project/argparse-action/ |
| مجوز | Apache 2 |
[](https://github.com/nyirog/argparse_action/actions/workflows/makefile.yml)
# argparse_action
`argparse_action` aims to be a minimalistic extension of `argparse` and creates
cli options from the function signature given by `inspect.signature`.
```python
import argparse
import argparse_action
parser = argparse.ArgumentParser()
action = argparse_action.Action(parser)
@action.add("e")
def echo(word, upper=False):
print(word.upper() if upper else word)
namespace = parser.parse_args()
namespace.action(namespace)
```
Asumes that the code above is saved as `my_script.py`:
```
$ python3 my_script.py echo hello
hello
$ python3 my_script.py e hello
hello
$ python3 my_script.py echo --upper hello
HELLO
```
## Installation
```
pip install argparse_action
```
## Configuration
```
make dev
```
## CI check
The `check` make target collects the targets which are run by the CI server.
```sh
make check
```
### Testing
The `test` target requires a virtulenv where `argparse_action` is installed.
The `dev` target creates that virtualenv under `.venv` directory.
```
make test
```
### Formatting
The argparse_action project is formatted with `black`. The CI check invokes the
`check-format` target to ensure that the python files are formatted with
`black`.
```sh
make check-format
```
`black` can be run with the `format` make target.
```sh
make format
```
### Linter
The `lint` target runs `pylint` over the argparse_action project.
```sh
make lint
```
## Documentation
Documentation can be build with the `doc` make target. To ensure the documentation build
tools the `make dev` has to be executed once before `make doc`.
```
make doc
```
Online version can be read at [readthedocs.org](https://argparse-action.readthedocs.io/en/latest/index.html).
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl argparse-action-0.5.2:
pip install argparse-action-0.5.2.whl
نصب پکیج tar.gz argparse-action-0.5.2:
pip install argparse-action-0.5.2.tar.gz