Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-cyclopts for openSUSE:Factory
checked in at 2026-12-05 19:10:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-cyclopts (Old)
and /work/SRC/openSUSE:Factory/.python-cyclopts.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cyclopts"
Sat Dec 5 19:10:18 2026 rev:33 rq:1403087 version:5.7.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-cyclopts/python-cyclopts.changes
2026-12-04 15:27:15.709382154 +0100
+++
/work/SRC/openSUSE:Factory/.python-cyclopts.new.1340718/python-cyclopts.changes
2026-12-05 19:12:15.254851869 +0100
@@ -1,0 +2,17 @@
+Fri Dec 4 15:16:18 UTC 2026 - Martin Pluskal <[email protected]>
+
+- Update to 5.7.2:
+ * Treat typing.Final[X] and ReadOnly[X] as X (e.g. a dataclass
+ field annotated Final[int])
+ * Pydantic fields declared with an alias (or validation_alias)
+ keep their value from the CLI, config and JSON instead of
+ silently falling back to the default (requires pydantic>=2.11)
+ * Environment values split by a delimiter have each element's
+ surrounding whitespace stripped, and empty elements are
+ dropped instead of becoming Path(".")
+ * A custom Parameter.env_var_split with the documented
+ (type_, val) signature no longer raises TypeError
+ * A Parameter(count=True) flag that isn't given now uses the
+ function's default (and config/env values) instead of always 0
+
+-------------------------------------------------------------------
Old:
----
cyclopts-5.7.1.tar.gz
New:
----
cyclopts-5.7.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-cyclopts.spec ++++++
--- /var/tmp/diff_new_pack.iG6QNy/_old 2026-12-05 19:12:15.863877552 +0100
+++ /var/tmp/diff_new_pack.iG6QNy/_new 2026-12-05 19:12:15.865877637 +0100
@@ -18,7 +18,7 @@
%bcond_without libalternatives
Name: python-cyclopts
-Version: 5.7.1
+Version: 5.7.2
Release: 0
Summary: Intuitive, easy CLIs based on python type hints
License: Apache-2.0
++++++ cyclopts-5.7.1.tar.gz -> cyclopts-5.7.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/PKG-INFO new/cyclopts-5.7.2/PKG-INFO
--- old/cyclopts-5.7.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/cyclopts-5.7.2/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.5
Name: cyclopts
-Version: 5.7.1
+Version: 5.7.2
Summary: Intuitive, easy CLIs based on type hints.
Project-URL: Homepage, https://github.com/BrianPugh/cyclopts
Project-URL: Repository, https://github.com/BrianPugh/cyclopts
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/cyclopts/_env_var.py
new/cyclopts-5.7.2/cyclopts/_env_var.py
--- old/cyclopts-5.7.1/cyclopts/_env_var.py 2020-02-02 01:00:00.000000000
+0100
+++ new/cyclopts-5.7.2/cyclopts/_env_var.py 2020-02-02 01:00:00.000000000
+0100
@@ -31,7 +31,8 @@
By default, split on ``;`` on Windows and ``:`` otherwise.
* Otherwise, if the ``type_`` is an ``Iterable``, split on whitespace by
default.
- Leading/trailing whitespace of each output element will be stripped.
+
+ Leading/trailing whitespace of each output element is stripped, and empty
elements are dropped.
This function is the default value for :attr:`cyclopts.App.env_var_split`.
@@ -56,6 +57,6 @@
if count > 1 or consume_all:
if delimiter is None and _is_path(type_):
delimiter = os.pathsep
- return val.split(delimiter)
+ return [x for x in (element.strip() for element in
val.split(delimiter)) if x]
else:
return [val]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/cyclopts/_version.py
new/cyclopts-5.7.2/cyclopts/_version.py
--- old/cyclopts-5.7.1/cyclopts/_version.py 2020-02-02 01:00:00.000000000
+0100
+++ new/cyclopts-5.7.2/cyclopts/_version.py 2020-02-02 01:00:00.000000000
+0100
@@ -18,7 +18,7 @@
commit_id: str | None
__commit_id__: str | None
-__version__ = version = '5.7.1'
-__version_tuple__ = version_tuple = (5, 7, 1)
+__version__ = version = '5.7.2'
+__version_tuple__ = version_tuple = (5, 7, 2)
__commit_id__ = commit_id = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/cyclopts/annotations.py
new/cyclopts-5.7.2/cyclopts/annotations.py
--- old/cyclopts-5.7.1/cyclopts/annotations.py 2020-02-02 01:00:00.000000000
+0100
+++ new/cyclopts-5.7.2/cyclopts/annotations.py 2020-02-02 01:00:00.000000000
+0100
@@ -15,7 +15,7 @@
from enum import Enum, Flag
from functools import partial
from types import UnionType
-from typing import Annotated, Any, Literal, NotRequired, Required, Union,
Unpack, get_args, get_origin
+from typing import Annotated, Any, Final, Literal, NotRequired, Required,
Union, Unpack, get_args, get_origin
import attrs
@@ -29,6 +29,10 @@
NoneType = type(None)
AnnotatedType = type(Annotated[int, 0])
+_TYPE_QUALIFIERS = frozenset(
+ q for q in (Required, NotRequired, Final, getattr(typing, "ReadOnly",
None)) if q is not None
+)
+
ITERABLE_TYPES = {
Iterable,
typing.Sequence,
@@ -174,7 +178,7 @@
type_alias: bool = True,
annotated: bool = True,
optional: bool = True,
- required: bool = True,
+ qualifiers: bool = True,
new_type: bool = True,
) -> type:
"""Perform all simplifying resolutions.
@@ -190,8 +194,9 @@
optional
If True (default), strips NoneType from Optional/Union types.
Set to False when you need to preserve NoneType for conversion.
- required
- If True (default), strips Required/NotRequired wrappers.
+ qualifiers
+ If True (default), strips type-qualifier wrappers
+ (``Required``, ``NotRequired``, ``ReadOnly``, ``Final``).
new_type
If True (default), resolves NewType to its underlying type.
"""
@@ -207,8 +212,8 @@
type_ = resolve_annotated(type_)
if optional:
type_ = resolve_optional(type_)
- if required:
- type_ = resolve_required(type_)
+ if qualifiers:
+ type_ = resolve_qualifier(type_)
if new_type:
type_ = resolve_new_type(type_)
return type_
@@ -267,8 +272,23 @@
return None
-def resolve_required(type_: Any) -> type:
- if get_origin(type_) in (Required, NotRequired):
+def is_type_qualifier(origin: Any) -> bool:
+ """Whether ``origin`` is a type qualifier: ``Required``, ``NotRequired``,
``ReadOnly`` or ``Final``.
+
+ Qualifiers describe the attribute that holds a value and leave the value's
type unchanged.
+ """
+ if origin is None:
+ return False
+ if origin in _TYPE_QUALIFIERS:
+ return True
+ # Before 3.13, ``ReadOnly`` only exists in typing_extensions; an
annotation using it means it's already imported.
+ typing_extensions = sys.modules.get("typing_extensions")
+ return typing_extensions is not None and origin is
getattr(typing_extensions, "ReadOnly", None)
+
+
+def resolve_qualifier(type_: Any) -> type:
+ """Unwrap one type qualifier, e.g. ``Final[X]`` -> ``X``."""
+ if is_type_qualifier(get_origin(type_)):
type_ = get_args(type_)[0]
return type_
@@ -347,7 +367,7 @@
def contains_enum(hint) -> bool:
"""Whether an ``Enum`` appears anywhere in ``hint`` (through
``Annotated``, unions, iterables, aliases)."""
- hint = resolve(hint, annotated=False, optional=False, required=False)
+ hint = resolve(hint, annotated=False, optional=False, qualifiers=False)
return is_enum(hint) or any(contains_enum(arg) for arg in get_args(hint)
if arg is not Ellipsis)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/cyclopts/argument/_argument.py
new/cyclopts-5.7.2/cyclopts/argument/_argument.py
--- old/cyclopts-5.7.1/cyclopts/argument/_argument.py 2020-02-02
01:00:00.000000000 +0100
+++ new/cyclopts-5.7.2/cyclopts/argument/_argument.py 2020-02-02
01:00:00.000000000 +0100
@@ -832,6 +832,20 @@
self.tokens.append(token.evolve(value="", implicit_value={}))
return explicit_empty_mapping
+ def _parse_count(self, token: Token) -> int:
+ """Parse an explicit count (``--verbose=3``, or a config/env value)
from ``token.value``.
+
+ Plain ``int()``: a count is a number of occurrences, so fractional
values like ``"1.5"``
+ are rejected rather than rounded (unlike general int coercion via
``_int``), as are negatives.
+ """
+ try:
+ count = int(token.value)
+ except ValueError:
+ raise CoercionError(token=token, argument=self, target_type=int)
from None
+ if count < 0:
+ raise CoercionError(token=token, argument=self, msg="Count values
must be non-negative.")
+ return count
+
def _convert_pydantic(self):
if self.has_tokens:
import pydantic
@@ -844,7 +858,11 @@
keyless_value = self._keyless_json_value()
unstructured_data = self._json() if keyless_value is UNSET else
keyless_value
try:
- return
pydantic.TypeAdapter(self.field_info.annotation).validate_python(unstructured_data)
+ adapter = pydantic.TypeAdapter(self.field_info.annotation)
+ # The dict is keyed by python field names; ``by_name``
(pydantic>=2.11) lets aliased fields accept them.
+ if parse_version(pydantic.__version__) >= (2, 11):
+ return adapter.validate_python(unstructured_data,
by_name=True)
+ return adapter.validate_python(unstructured_data)
except pydantic.ValidationError as e:
self._handle_pydantic_validation_error(e, value=keyless_value)
else:
@@ -896,7 +914,13 @@
if not self.parse:
out = UNSET
elif self.parameter.count:
- out = sum(token.implicit_value for token in self.tokens if
token.implicit_value is not UNSET)
+ if not self.tokens:
+ return UNSET # Absent flag: leave the function's default
alone.
+ # Config and env tokens carry only a string ``value``; parse it
like ``--verbose=3``.
+ out = sum(
+ self._parse_count(token) if token.implicit_value is UNSET else
token.implicit_value
+ for token in self.tokens
+ )
elif self._explicit_none:
# The whole value is ``None``, so no child (e.g. a required field
of ``Foo | None``) converts alone.
for child in self.children_recursive:
@@ -1300,6 +1324,9 @@
def env_var_split(self, value: str, delimiter: str | None = None) ->
list[str]:
"""Split a given value with :meth:`.Parameter.env_var_split`."""
+ # A custom splitter only has to accept ``(type_, val)``, so
``delimiter`` is passed only when given.
+ if delimiter is None:
+ return self.parameter.env_var_split(self.hint, value)
return self.parameter.env_var_split(self.hint, value,
delimiter=delimiter)
def _split_env_value(self, value: str, keys: tuple[str, ...] = ()) ->
list[str]:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/cyclopts/bind.py
new/cyclopts-5.7.2/cyclopts/bind.py
--- old/cyclopts-5.7.1/cyclopts/bind.py 2020-02-02 01:00:00.000000000 +0100
+++ new/cyclopts-5.7.2/cyclopts/bind.py 2020-02-02 01:00:00.000000000 +0100
@@ -860,30 +860,11 @@
if match.argument.parameter.count:
if cli_values:
# An attached ``=value`` (e.g. --verbose=3) explicitly
sets the count.
- # Plain ``int()`` parse: a count is a number of
occurrences, so
- # fractional values like "1.5" are rejected rather than
rounded
- # (unlike general int coercion via ``_int``), as are
negatives.
# The non-empty ``value`` marks the token as an explicit
# assignment, which ``Argument.append`` forbids combining
with
# other occurrences.
- value = cli_values[-1]
- try:
- count_value = int(value)
- except ValueError:
- raise CoercionError(
- token=CliToken(keyword=match.matched_token,
value=value),
- argument=match.argument,
- target_type=int,
- ) from None
- if count_value < 0:
- raise CoercionError(
- token=CliToken(keyword=match.matched_token,
value=value),
- argument=match.argument,
- msg="Count values must be non-negative.",
- )
- match.argument.append(
- CliToken(keyword=match.matched_token, value=value,
implicit_value=count_value)
- )
+ token = CliToken(keyword=match.matched_token,
value=cli_values[-1])
+
match.argument.append(token.evolve(implicit_value=match.argument._parse_count(token)))
else:
match.argument.append(CliToken(keyword=match.matched_token, implicit_value=1))
elif match.implicit_value is not UNSET:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cyclopts-5.7.1/cyclopts/field_info.py
new/cyclopts-5.7.2/cyclopts/field_info.py
--- old/cyclopts-5.7.1/cyclopts/field_info.py 2020-02-02 01:00:00.000000000
+0100
+++ new/cyclopts-5.7.2/cyclopts/field_info.py 2020-02-02 01:00:00.000000000
+0100
@@ -26,6 +26,7 @@
is_pydantic,
is_pydantic_leaf,
is_pydantic_secret,
+ is_type_qualifier,
is_typeddict,
is_union,
resolve,
@@ -134,14 +135,23 @@
return attrs.evolve(self, **kwargs)
+def _type_qualifiers(annotation) -> set:
+ """Origins of the qualifiers wrapping ``annotation``, which may nest (e.g.
``ReadOnly[NotRequired[int]]``)."""
+ out = set()
+ while is_type_qualifier(origin := get_origin(annotation :=
resolve_annotated(annotation))):
+ out.add(origin)
+ annotation = get_args(annotation)[0]
+ return out
+
+
def _typed_dict_field_infos(typeddict) -> dict[str, FieldInfo]:
# The ``__required_keys__`` and ``__optional_keys__`` attributes of
TypedDict are kind of broken in <cp3.11.
out = {}
for name, annotation in get_type_hints(typeddict,
include_extras=True).items():
- origin = get_origin(resolve_annotated(annotation))
- if origin is Required:
+ qualifiers = _type_qualifiers(annotation)
+ if Required in qualifiers:
required = True
- elif origin is NotRequired:
+ elif NotRequired in qualifiers:
required = False
elif typeddict.__total__: # Fields are REQUIRED by default.
required = True
@@ -175,8 +185,9 @@
for python_name, pydantic_field in model.model_fields.items():
names = []
if pydantic_field.alias:
- # Register a CLI name only if the model would actually accept it
during
- # validation (cyclopts builds the model via
TypeAdapter.validate_python).
+ # Register the CLI names the model's config accepts from its
callers. Cyclopts
+ # itself always validates by field name (``by_name=True`` in
``_convert_pydantic``),
+ # so this choice only decides which spellings the CLI exposes.
# * validate_by_name -> field names are accepted.
# * validate_by_alias -> aliases are accepted (defaults to True).
# populate_by_name is the pre-2.11 spelling of validate_by_name;
it is not