From 3c2a1c4aa5dd6a3c4078ca199b7ad0ac942bb6bf Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Wed, 12 Apr 2023 02:12:20 +0000 Subject: automatic import of python-more-click --- .gitignore | 1 + python-more-click.spec | 396 +++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 398 insertions(+) create mode 100644 python-more-click.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..66d271a 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/more_click-0.1.2.tar.gz diff --git a/python-more-click.spec b/python-more-click.spec new file mode 100644 index 0000000..4f01d48 --- /dev/null +++ b/python-more-click.spec @@ -0,0 +1,396 @@ +%global _empty_manifest_terminate_build 0 +Name: python-more-click +Version: 0.1.2 +Release: 1 +Summary: More click. +License: MIT +URL: https://github.com/cthoyt/more_click +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/cf/c7/da345a948fb09129c524e81209c32c07c56f5e30786b973116247c4eba61/more_click-0.1.2.tar.gz +BuildArch: noarch + +Requires: python3-click +Requires: python3-coverage +Requires: python3-pytest + +%description +# more_click + + + PyPI + + + PyPI - Python Version + + + PyPI - License + + + DOI + + +Extra stuff for click I use in basically every repo + +## More Options + +The module `more_click.options` has several options (pre-defined instances of `click.option()`) that I use often. First, +`verbose_option` makes it easy to adjust the logger of your package using `-v`. + +There are also several that are useful for web stuff, including + +| Name | Type | Flag | +| ------------------------ | ---- | -------- | +| `more_click.host_option` | str | `--host` | +| `more_click.port_option` | str | `--port` | + +## Web Tools + +In many packages, I've included a Flask web application in `wsgi.py`. I usually use the following form inside `cli.py` +file to import the web application and keep it insulated from other package-related usages: + +```python +# cli.py +import click +from more_click import host_option, port_option + + +@click.command() +@host_option +@port_option +def web(host: str, port: str): + from .wsgi import app # modify to point to your module-level flask.Flask instance + app.run(host=host, port=port) + + +if __name__ == '__main__': + web() +``` + +However, sometimes I want to make it possible to run via `gunicorn` from the CLI, so I would use the following +extensions to automatically determine if it should be run with Flask's development server or gunicorn. + +```python +# cli.py +import click +from more_click import host_option, port_option, with_gunicorn_option, workers_option, run_app + + +@click.command() +@host_option +@port_option +@with_gunicorn_option +@workers_option +def web(host: str, port: str, with_gunicorn: bool, workers: int): + from .wsgi import app # modify to point to your module-level flask.Flask instance + run_app(app=app, with_gunicorn=with_gunicorn, host=host, port=port, workers=workers) + + +if __name__ == '__main__': + web() +``` + +For ultimate lazy mode, I've written a wrapper around the second: + +```python +# cli.py +from more_click import make_web_command + +web = make_web_command('my_package_name.wsgi:app') + +if __name__ == '__main__': + web() +``` + +This uses a standard `wsgi`-style string to locate the app, since you don't want to be eagerly importing the app in your +CLI since it might rely on optional dependencies like Flask. If your CLI has other stuff, you can include the web +command in a group like: + +```python +# cli.py +import click +from more_click import make_web_command + + +@click.group() +def main(): + """My awesome CLI.""" + + +make_web_command('my_package_name.wsgi:app', group=main) + +if __name__ == '__main__': + main() +``` + + +%package -n python3-more-click +Summary: More click. +Provides: python-more-click +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-more-click +# more_click + + + PyPI + + + PyPI - Python Version + + + PyPI - License + + + DOI + + +Extra stuff for click I use in basically every repo + +## More Options + +The module `more_click.options` has several options (pre-defined instances of `click.option()`) that I use often. First, +`verbose_option` makes it easy to adjust the logger of your package using `-v`. + +There are also several that are useful for web stuff, including + +| Name | Type | Flag | +| ------------------------ | ---- | -------- | +| `more_click.host_option` | str | `--host` | +| `more_click.port_option` | str | `--port` | + +## Web Tools + +In many packages, I've included a Flask web application in `wsgi.py`. I usually use the following form inside `cli.py` +file to import the web application and keep it insulated from other package-related usages: + +```python +# cli.py +import click +from more_click import host_option, port_option + + +@click.command() +@host_option +@port_option +def web(host: str, port: str): + from .wsgi import app # modify to point to your module-level flask.Flask instance + app.run(host=host, port=port) + + +if __name__ == '__main__': + web() +``` + +However, sometimes I want to make it possible to run via `gunicorn` from the CLI, so I would use the following +extensions to automatically determine if it should be run with Flask's development server or gunicorn. + +```python +# cli.py +import click +from more_click import host_option, port_option, with_gunicorn_option, workers_option, run_app + + +@click.command() +@host_option +@port_option +@with_gunicorn_option +@workers_option +def web(host: str, port: str, with_gunicorn: bool, workers: int): + from .wsgi import app # modify to point to your module-level flask.Flask instance + run_app(app=app, with_gunicorn=with_gunicorn, host=host, port=port, workers=workers) + + +if __name__ == '__main__': + web() +``` + +For ultimate lazy mode, I've written a wrapper around the second: + +```python +# cli.py +from more_click import make_web_command + +web = make_web_command('my_package_name.wsgi:app') + +if __name__ == '__main__': + web() +``` + +This uses a standard `wsgi`-style string to locate the app, since you don't want to be eagerly importing the app in your +CLI since it might rely on optional dependencies like Flask. If your CLI has other stuff, you can include the web +command in a group like: + +```python +# cli.py +import click +from more_click import make_web_command + + +@click.group() +def main(): + """My awesome CLI.""" + + +make_web_command('my_package_name.wsgi:app', group=main) + +if __name__ == '__main__': + main() +``` + + +%package help +Summary: Development documents and examples for more-click +Provides: python3-more-click-doc +%description help +# more_click + + + PyPI + + + PyPI - Python Version + + + PyPI - License + + + DOI + + +Extra stuff for click I use in basically every repo + +## More Options + +The module `more_click.options` has several options (pre-defined instances of `click.option()`) that I use often. First, +`verbose_option` makes it easy to adjust the logger of your package using `-v`. + +There are also several that are useful for web stuff, including + +| Name | Type | Flag | +| ------------------------ | ---- | -------- | +| `more_click.host_option` | str | `--host` | +| `more_click.port_option` | str | `--port` | + +## Web Tools + +In many packages, I've included a Flask web application in `wsgi.py`. I usually use the following form inside `cli.py` +file to import the web application and keep it insulated from other package-related usages: + +```python +# cli.py +import click +from more_click import host_option, port_option + + +@click.command() +@host_option +@port_option +def web(host: str, port: str): + from .wsgi import app # modify to point to your module-level flask.Flask instance + app.run(host=host, port=port) + + +if __name__ == '__main__': + web() +``` + +However, sometimes I want to make it possible to run via `gunicorn` from the CLI, so I would use the following +extensions to automatically determine if it should be run with Flask's development server or gunicorn. + +```python +# cli.py +import click +from more_click import host_option, port_option, with_gunicorn_option, workers_option, run_app + + +@click.command() +@host_option +@port_option +@with_gunicorn_option +@workers_option +def web(host: str, port: str, with_gunicorn: bool, workers: int): + from .wsgi import app # modify to point to your module-level flask.Flask instance + run_app(app=app, with_gunicorn=with_gunicorn, host=host, port=port, workers=workers) + + +if __name__ == '__main__': + web() +``` + +For ultimate lazy mode, I've written a wrapper around the second: + +```python +# cli.py +from more_click import make_web_command + +web = make_web_command('my_package_name.wsgi:app') + +if __name__ == '__main__': + web() +``` + +This uses a standard `wsgi`-style string to locate the app, since you don't want to be eagerly importing the app in your +CLI since it might rely on optional dependencies like Flask. If your CLI has other stuff, you can include the web +command in a group like: + +```python +# cli.py +import click +from more_click import make_web_command + + +@click.group() +def main(): + """My awesome CLI.""" + + +make_web_command('my_package_name.wsgi:app', group=main) + +if __name__ == '__main__': + main() +``` + + +%prep +%autosetup -n more-click-0.1.2 + +%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-more-click -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed Apr 12 2023 Python_Bot - 0.1.2-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..cf9601e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +cb1e412ce364d9f752accf3e920cacff more_click-0.1.2.tar.gz -- cgit v1.2.3