summaryrefslogtreecommitdiff
path: root/python-aiocli.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-aiocli.spec')
-rw-r--r--python-aiocli.spec320
1 files changed, 320 insertions, 0 deletions
diff --git a/python-aiocli.spec b/python-aiocli.spec
new file mode 100644
index 0000000..49cbe9b
--- /dev/null
+++ b/python-aiocli.spec
@@ -0,0 +1,320 @@
+%global _empty_manifest_terminate_build 0
+Name: python-aiocli
+Version: 1.8.0
+Release: 1
+Summary: Simple and lightweight async console runner.
+License: MIT
+URL: https://pypi.org/project/aiocli/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/50/a1/d48d5d9574d5433ec66fe58bb390d7453a49058d210f20ac30f85e8a3db7/aiocli-1.8.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-build
+Requires: python3-setuptools
+Requires: python3-twine
+Requires: python3-wheel
+Requires: python3-pre-commit
+Requires: python3-tomli
+Requires: python3-types-toml
+Requires: python3-mkdocs
+Requires: python3-mkdocs-material
+Requires: python3-black
+Requires: python3-isort
+Requires: python3-bandit
+Requires: python3-liccheck
+Requires: python3-mypy
+Requires: python3-pylint
+Requires: python3-psutil
+Requires: python3-pytest
+Requires: python3-pytest-asyncio
+Requires: python3-pytest-cov
+Requires: python3-pytest-xdist
+
+%description
+# Async cli client/commander framework
+
+[![PyPI version](https://badge.fury.io/py/aiocli.svg)](https://badge.fury.io/py/aiocli)
+[![PyPIDownloads](https://static.pepy.tech/badge/aiocli)](https://pepy.tech/project/aiocli)
+[![CI](https://github.com/aiopy/python-aiocli/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/aiopy/python-aiocli/actions/workflows/ci.yml)
+
+aiocli is a Python library for simple and lightweight async console runner.
+
+Full compatibility with argparse module and highly inspired by aiohttp module.
+
+## Installation
+
+Use the package manager [pip](https://pypi.org/project/aiocli/) to install aiocli.
+
+```bash
+pip install aiocli
+```
+
+## Documentation
+
+- Visit [aiocli docs](https://aiopy.github.io/python-aiocli/).
+
+## Usage
+
+```python
+from logging import getLogger, Logger, StreamHandler
+from os import getenv
+
+from aiocli.commander import run_app, Application, Depends, State
+
+app = Application(state={
+ 'envs': {
+ 'LOGGER_NAME': str(getenv('LOGGER_NAME', 'example_app')),
+ 'LOGGER_LEVEL': str(getenv('LOGGER_LEVEL', 'INFO')),
+ }
+})
+
+def _get_logger(state: State) -> Logger:
+ logger = getLogger(state.get('envs')['LOGGER_NAME'])
+ logger.setLevel(state.get('envs')['LOGGER_LEVEL'])
+ handler = StreamHandler()
+ logger.addHandler(handler)
+ return logger
+
+@app.command(name='greet:to', positionals=[('name', {'default': 'World!'})])
+async def handle_greeting(name: str, logger: Logger = Depends(_get_logger)) -> int:
+ logger.info(f'Hello {name}')
+ return 0
+
+@app.command(name='div', optionals=[('--a', {'type': float}), ('--b', {'type': float})])
+async def handle_division(a: float, b: float, logger: Logger = Depends(_get_logger)) -> int:
+ try:
+ logger.info(f'Result {a} / {b} = {(a / b)}')
+ return 0
+ except BaseException as err:
+ logger.error(f'Error: {err}')
+ return 1
+
+# python3 main.py <command> <positionals> <optionals>
+if __name__ == '__main__':
+ run_app(app)
+```
+
+## Requirements
+
+- Python >= 3.7
+
+## Contributing
+
+Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
+
+Please make sure to update tests as appropriate.
+
+## License
+
+[MIT](https://github.com/aiopy/python-aiocli/blob/master/LICENSE)
+
+
+%package -n python3-aiocli
+Summary: Simple and lightweight async console runner.
+Provides: python-aiocli
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-aiocli
+# Async cli client/commander framework
+
+[![PyPI version](https://badge.fury.io/py/aiocli.svg)](https://badge.fury.io/py/aiocli)
+[![PyPIDownloads](https://static.pepy.tech/badge/aiocli)](https://pepy.tech/project/aiocli)
+[![CI](https://github.com/aiopy/python-aiocli/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/aiopy/python-aiocli/actions/workflows/ci.yml)
+
+aiocli is a Python library for simple and lightweight async console runner.
+
+Full compatibility with argparse module and highly inspired by aiohttp module.
+
+## Installation
+
+Use the package manager [pip](https://pypi.org/project/aiocli/) to install aiocli.
+
+```bash
+pip install aiocli
+```
+
+## Documentation
+
+- Visit [aiocli docs](https://aiopy.github.io/python-aiocli/).
+
+## Usage
+
+```python
+from logging import getLogger, Logger, StreamHandler
+from os import getenv
+
+from aiocli.commander import run_app, Application, Depends, State
+
+app = Application(state={
+ 'envs': {
+ 'LOGGER_NAME': str(getenv('LOGGER_NAME', 'example_app')),
+ 'LOGGER_LEVEL': str(getenv('LOGGER_LEVEL', 'INFO')),
+ }
+})
+
+def _get_logger(state: State) -> Logger:
+ logger = getLogger(state.get('envs')['LOGGER_NAME'])
+ logger.setLevel(state.get('envs')['LOGGER_LEVEL'])
+ handler = StreamHandler()
+ logger.addHandler(handler)
+ return logger
+
+@app.command(name='greet:to', positionals=[('name', {'default': 'World!'})])
+async def handle_greeting(name: str, logger: Logger = Depends(_get_logger)) -> int:
+ logger.info(f'Hello {name}')
+ return 0
+
+@app.command(name='div', optionals=[('--a', {'type': float}), ('--b', {'type': float})])
+async def handle_division(a: float, b: float, logger: Logger = Depends(_get_logger)) -> int:
+ try:
+ logger.info(f'Result {a} / {b} = {(a / b)}')
+ return 0
+ except BaseException as err:
+ logger.error(f'Error: {err}')
+ return 1
+
+# python3 main.py <command> <positionals> <optionals>
+if __name__ == '__main__':
+ run_app(app)
+```
+
+## Requirements
+
+- Python >= 3.7
+
+## Contributing
+
+Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
+
+Please make sure to update tests as appropriate.
+
+## License
+
+[MIT](https://github.com/aiopy/python-aiocli/blob/master/LICENSE)
+
+
+%package help
+Summary: Development documents and examples for aiocli
+Provides: python3-aiocli-doc
+%description help
+# Async cli client/commander framework
+
+[![PyPI version](https://badge.fury.io/py/aiocli.svg)](https://badge.fury.io/py/aiocli)
+[![PyPIDownloads](https://static.pepy.tech/badge/aiocli)](https://pepy.tech/project/aiocli)
+[![CI](https://github.com/aiopy/python-aiocli/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/aiopy/python-aiocli/actions/workflows/ci.yml)
+
+aiocli is a Python library for simple and lightweight async console runner.
+
+Full compatibility with argparse module and highly inspired by aiohttp module.
+
+## Installation
+
+Use the package manager [pip](https://pypi.org/project/aiocli/) to install aiocli.
+
+```bash
+pip install aiocli
+```
+
+## Documentation
+
+- Visit [aiocli docs](https://aiopy.github.io/python-aiocli/).
+
+## Usage
+
+```python
+from logging import getLogger, Logger, StreamHandler
+from os import getenv
+
+from aiocli.commander import run_app, Application, Depends, State
+
+app = Application(state={
+ 'envs': {
+ 'LOGGER_NAME': str(getenv('LOGGER_NAME', 'example_app')),
+ 'LOGGER_LEVEL': str(getenv('LOGGER_LEVEL', 'INFO')),
+ }
+})
+
+def _get_logger(state: State) -> Logger:
+ logger = getLogger(state.get('envs')['LOGGER_NAME'])
+ logger.setLevel(state.get('envs')['LOGGER_LEVEL'])
+ handler = StreamHandler()
+ logger.addHandler(handler)
+ return logger
+
+@app.command(name='greet:to', positionals=[('name', {'default': 'World!'})])
+async def handle_greeting(name: str, logger: Logger = Depends(_get_logger)) -> int:
+ logger.info(f'Hello {name}')
+ return 0
+
+@app.command(name='div', optionals=[('--a', {'type': float}), ('--b', {'type': float})])
+async def handle_division(a: float, b: float, logger: Logger = Depends(_get_logger)) -> int:
+ try:
+ logger.info(f'Result {a} / {b} = {(a / b)}')
+ return 0
+ except BaseException as err:
+ logger.error(f'Error: {err}')
+ return 1
+
+# python3 main.py <command> <positionals> <optionals>
+if __name__ == '__main__':
+ run_app(app)
+```
+
+## Requirements
+
+- Python >= 3.7
+
+## Contributing
+
+Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
+
+Please make sure to update tests as appropriate.
+
+## License
+
+[MIT](https://github.com/aiopy/python-aiocli/blob/master/LICENSE)
+
+
+%prep
+%autosetup -n aiocli-1.8.0
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-aiocli -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 17 2023 Python_Bot <Python_Bot@openeuler.org> - 1.8.0-1
+- Package Spec generated