Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-click-option-group for openSUSE:Factory checked in at 2023-06-21 22:39:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-click-option-group (Old) and /work/SRC/openSUSE:Factory/.python-click-option-group.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-click-option-group" Wed Jun 21 22:39:00 2023 rev:3 rq:1094129 version:0.5.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-click-option-group/python-click-option-group.changes 2023-05-18 15:18:35.573630303 +0200 +++ /work/SRC/openSUSE:Factory/.python-click-option-group.new.15902/python-click-option-group.changes 2023-06-21 22:39:48.774354466 +0200 @@ -1,0 +2,10 @@ +Tue Jun 20 16:50:45 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.5.6: + * Add `optgroup.help_option` decorator to add help option to + the group (PR #50) + * Use GitHub Actions instead of Travis CI for CI + * Delete tox runner + * Add Python 3.11 to the setup classifiers + +------------------------------------------------------------------- Old: ---- click-option-group-0.5.5.tar.gz New: ---- click-option-group-0.5.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-click-option-group.spec ++++++ --- /var/tmp/diff_new_pack.3BfeQE/_old 2023-06-21 22:39:49.270357451 +0200 +++ /var/tmp/diff_new_pack.3BfeQE/_new 2023-06-21 22:39:49.274357475 +0200 @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-click-option-group -Version: 0.5.5 +Version: 0.5.6 Release: 0 Summary: Option groups missing in Click License: BSD-3-Clause ++++++ click-option-group-0.5.5.tar.gz -> click-option-group-0.5.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/CHANGELOG.md new/click-option-group-0.5.6/CHANGELOG.md --- old/click-option-group-0.5.5/CHANGELOG.md 2022-10-12 14:10:45.000000000 +0200 +++ new/click-option-group-0.5.6/CHANGELOG.md 2023-06-10 00:10:10.000000000 +0200 @@ -1,5 +1,12 @@ # Changelog +## v0.5.6 (09.06.2023) + +* Add `optgroup.help_option` decorator to add help option to the group (PR [#50](https://github.com/click-contrib/click-option-group/pull/50)) +* Use GitHub Actions instead of Travis CI for CI +* Delete tox runner +* Add Python 3.11 to the setup classifiers + ## v0.5.5 (12.10.2022) * Add `tests/` directory to tarball diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/PKG-INFO new/click-option-group-0.5.6/PKG-INFO --- old/click-option-group-0.5.5/PKG-INFO 2022-10-12 14:11:38.767334500 +0200 +++ new/click-option-group-0.5.6/PKG-INFO 2023-06-10 00:15:42.220123300 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: click-option-group -Version: 0.5.5 +Version: 0.5.6 Summary: Option groups missing in Click Home-page: https://github.com/click-contrib/click-option-group Author: Eugene Prilepin @@ -23,6 +23,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Requires-Python: >=3.6,<4 Description-Content-Type: text/markdown Provides-Extra: docs @@ -128,6 +129,13 @@ # Changelog +## v0.5.6 (09.06.2023) + +* Add `optgroup.help_option` decorator to add help option to the group (PR [#50](https://github.com/click-contrib/click-option-group/pull/50)) +* Use GitHub Actions instead of Travis CI for CI +* Delete tox runner +* Add Python 3.11 to the setup classifiers + ## v0.5.5 (12.10.2022) * Add `tests/` directory to tarball diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/click_option_group/_core.py new/click-option-group-0.5.6/click_option_group/_core.py --- old/click-option-group-0.5.5/click_option_group/_core.py 2022-10-12 13:46:29.000000000 +0200 +++ new/click-option-group-0.5.6/click_option_group/_core.py 2023-06-10 00:00:09.000000000 +0200 @@ -3,9 +3,9 @@ import collections import inspect import weakref -from collections.abc import Callable from typing import ( Any, + Callable, Dict, List, Mapping, @@ -173,7 +173,7 @@ return name, help_ def option(self, *param_decls: str, **attrs: Any) -> Callable: - """Decorator attaches an grouped option to the command + """Decorator attaches a grouped option to the command The decorator is used for adding options to the group and to the Click-command """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/click_option_group/_decorators.py new/click-option-group-0.5.6/click_option_group/_decorators.py --- old/click-option-group-0.5.5/click_option_group/_decorators.py 2021-10-12 12:37:33.000000000 +0200 +++ new/click-option-group-0.5.6/click_option_group/_decorators.py 2023-06-09 23:22:06.000000000 +0200 @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from typing import Optional, NamedTuple, List, Tuple, Dict, Any, Type +from typing import (Callable, Optional, NamedTuple, List, + Tuple, Dict, Any, Type, TypeVar) -import collections.abc as abc import collections import warnings import inspect @@ -15,6 +15,11 @@ raise_mixing_decorators_error, ) +T = TypeVar('T') +F = TypeVar('F', bound=Callable) + +Decorator = Callable[[F], F] + class OptionStackItem(NamedTuple): param_decls: Tuple[str, ...] @@ -62,8 +67,8 @@ """ def __init__(self) -> None: - self._decorating_state: Dict[abc.Callable, List[OptionStackItem]] = collections.defaultdict(list) - self._not_attached_options: Dict[abc.Callable, List[click.Option]] = collections.defaultdict(list) + self._decorating_state: Dict[Callable, List[OptionStackItem]] = collections.defaultdict(list) + self._not_attached_options: Dict[Callable, List[click.Option]] = collections.defaultdict(list) self._outer_frame_index = 1 def __call__(self, @@ -140,7 +145,7 @@ return decorator - def option(self, *param_decls, **attrs): + def option(self, *param_decls, **attrs) -> Decorator: """The decorator adds a new option to the group The decorator is lazy. It adds option decls and attrs. @@ -164,7 +169,30 @@ return decorator - def _add_not_attached_option(self, func, param_decls): + def help_option(self, *param_decls, **attrs) -> Decorator: + """This decorator adds a help option to the group, which prints + the command's help text and exits. + """ + if not param_decls: + param_decls = ('--help',) + + attrs.setdefault('is_flag', True) + attrs.setdefault('is_eager', True) + attrs.setdefault('expose_value', False) + attrs.setdefault('help', 'Show this message and exit.') + + if 'callback' not in attrs: + def callback(ctx, _, value): + if not value or ctx.resilient_parsing: + return + click.echo(ctx.get_help(), color=ctx.color) + ctx.exit() + + attrs['callback'] = callback + + return self.option(*param_decls, **attrs) + + def _add_not_attached_option(self, func, param_decls) -> None: click.option( *param_decls, all_not_attached_options=self._not_attached_options, @@ -175,7 +203,7 @@ self._not_attached_options[callback].append(params[-1]) @staticmethod - def _filter_not_attached(options): + def _filter_not_attached(options: List[T]) -> List[T]: return [opt for opt in options if not isinstance(opt, _NotAttachedOption)] @staticmethod diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/click_option_group/_helpers.py new/click-option-group-0.5.6/click_option_group/_helpers.py --- old/click-option-group-0.5.5/click_option_group/_helpers.py 2021-10-12 12:37:33.000000000 +0200 +++ new/click-option-group-0.5.6/click_option_group/_helpers.py 2023-06-09 23:22:06.000000000 +0200 @@ -1,18 +1,19 @@ # -*- coding: utf-8 -*- -from typing import List, Tuple +from typing import Callable, Tuple, List, TypeVar, NoReturn -import collections.abc as abc import random import string import click +F = TypeVar('F', bound=Callable) + FAKE_OPT_NAME_LEN = 30 -def get_callback_and_params(func) -> Tuple[abc.Callable, List[click.Option]]: +def get_callback_and_params(func) -> Tuple[Callable, List[click.Option]]: """Returns callback function and its parameters list :param func: decorated function or click Command @@ -28,11 +29,11 @@ return func, params -def get_fake_option_name(name_len: int = FAKE_OPT_NAME_LEN, prefix: str = 'fake'): +def get_fake_option_name(name_len: int = FAKE_OPT_NAME_LEN, prefix: str = 'fake') -> str: return f'--{prefix}-' + ''.join(random.choices(string.ascii_lowercase, k=name_len)) -def raise_mixing_decorators_error(wrong_option: click.Option, callback: abc.Callable): +def raise_mixing_decorators_error(wrong_option: click.Option, callback: Callable) -> NoReturn: error_hint = wrong_option.opts or [wrong_option.name] raise TypeError(( @@ -41,6 +42,6 @@ )) -def resolve_wrappers(f): +def resolve_wrappers(f: F) -> F: """Get the underlying function behind any level of function wrappers.""" return resolve_wrappers(f.__wrapped__) if hasattr(f, "__wrapped__") else f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/click_option_group/_version.py new/click-option-group-0.5.6/click_option_group/_version.py --- old/click-option-group-0.5.5/click_option_group/_version.py 2022-10-12 14:09:48.000000000 +0200 +++ new/click-option-group-0.5.6/click_option_group/_version.py 2023-06-10 00:10:10.000000000 +0200 @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -__version__ = '0.5.5' +__version__ = '0.5.6' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/click_option_group.egg-info/PKG-INFO new/click-option-group-0.5.6/click_option_group.egg-info/PKG-INFO --- old/click-option-group-0.5.5/click_option_group.egg-info/PKG-INFO 2022-10-12 14:11:38.000000000 +0200 +++ new/click-option-group-0.5.6/click_option_group.egg-info/PKG-INFO 2023-06-10 00:15:42.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: click-option-group -Version: 0.5.5 +Version: 0.5.6 Summary: Option groups missing in Click Home-page: https://github.com/click-contrib/click-option-group Author: Eugene Prilepin @@ -23,6 +23,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Requires-Python: >=3.6,<4 Description-Content-Type: text/markdown Provides-Extra: docs @@ -128,6 +129,13 @@ # Changelog +## v0.5.6 (09.06.2023) + +* Add `optgroup.help_option` decorator to add help option to the group (PR [#50](https://github.com/click-contrib/click-option-group/pull/50)) +* Use GitHub Actions instead of Travis CI for CI +* Delete tox runner +* Add Python 3.11 to the setup classifiers + ## v0.5.5 (12.10.2022) * Add `tests/` directory to tarball diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/click_option_group.egg-info/requires.txt new/click-option-group-0.5.6/click_option_group.egg-info/requires.txt --- old/click-option-group-0.5.5/click_option_group.egg-info/requires.txt 2022-10-12 14:11:38.000000000 +0200 +++ new/click-option-group-0.5.6/click_option_group.egg-info/requires.txt 2023-06-10 00:15:42.000000000 +0200 @@ -1,7 +1,7 @@ Click<9,>=7.0 [docs] -sphinx<6,>=3.0 +sphinx Pallets-Sphinx-Themes m2r2 @@ -11,5 +11,5 @@ [tests_cov] pytest pytest-cov -coverage<6 +coverage coveralls diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/setup.py new/click-option-group-0.5.6/setup.py --- old/click-option-group-0.5.5/setup.py 2022-10-12 14:09:21.000000000 +0200 +++ new/click-option-group-0.5.6/setup.py 2023-06-10 00:01:34.000000000 +0200 @@ -37,9 +37,9 @@ 'Click>=7.0,<9', ], extras_require={ - 'docs': ['sphinx>=3.0, <6', 'Pallets-Sphinx-Themes', 'm2r2'], + 'docs': ['sphinx', 'Pallets-Sphinx-Themes', 'm2r2'], 'tests': ['pytest'], - 'tests_cov': ['pytest', 'pytest-cov', 'coverage <6', 'coveralls'], + 'tests_cov': ['pytest', 'pytest-cov', 'coverage', 'coveralls'], }, url='https://github.com/click-contrib/click-option-group', project_urls={ @@ -68,5 +68,6 @@ 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ], ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/click-option-group-0.5.5/tests/test_click_option_group.py new/click-option-group-0.5.6/tests/test_click_option_group.py --- old/click-option-group-0.5.5/tests/test_click_option_group.py 2021-10-12 12:37:33.000000000 +0200 +++ new/click-option-group-0.5.6/tests/test_click_option_group.py 2023-06-10 00:00:09.000000000 +0200 @@ -733,6 +733,30 @@ assert "bar" not in result.output +@pytest.mark.parametrize('param_decls, options, output', [ + ((), ['--help'], '--help'), + (('-h', '--help'), ['-h'], '-h, --help'), + (('-h', '--help'), ['--help'], '-h, --help'), +]) +def test_help_option(runner, param_decls, options, output): + @click.command() + @optgroup('Help Options') + @optgroup.help_option(*param_decls) + def cli() -> None: + click.echo('Running command.') + + result = runner.invoke(cli) + assert not result.exception + assert 'Running command.' in result.output + assert 'Usage:' not in result.output + + result = runner.invoke(cli, options) + assert not result.exception + assert 'Running command.' not in result.output + assert 'Usage:' in result.output + assert output in result.output + + def test_wrapped_functions(runner): def make_z(): """A unified option interface for making a `z`."""