%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
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
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
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
* Tue Apr 25 2023 Python_Bot - 0.1.2-1
- Package Spec generated