Skip to content

v4.2.0

Choose a tag to compare

@wolph wolph released this 05 Nov 10:39
· 16 commits to develop since this release
v4.2.0
6dc4a1c
  • Deprecate batch sizes below 1 in batcher, and in abatcher without an interval, contributed by @tongwentao in PR #64. A DeprecationWarning is issued when iteration starts, before the source is consumed, and the results and errors stay as they were. A test suite that turns warnings into errors fails on such a size from this release on. These sizes will raise ValueError in 5.0. With an interval, abatcher keeps accepting None or a size below 1 as no size limit, without a warning.
  • Accept a value that does not equal itself, such as float('nan'), when it is assigned back to its own slot of a UniqueList with on_duplicate='raise', contributed by @ShahadatTest in PR #65. 4.1.4 raised ValueError: Duplicate value for it, while any other value could already be assigned to its own slot.
  • Import the lazy exports that a module's __getattr__ serves for the names in its __all__ with import_global, contributed by @ShahadatTest in PR #66. 4.1.4 skipped every name that dir() does not list. On Python 3.13 and later, import_global('typing') now also imports AsyncContextManager, ContextManager, ForwardRef, Match and Pattern, as it already did on 3.10 to 3.12. A lazy export that fails to resolve is still skipped.
  • Apply the key and value casts of a LazyCastedDict in get, as indexing already did, contributed by @ShahadatTest in PR #67. On an int-keyed dict, d.get('3') now finds the key stored as 3, and get returns the cast value where 4.1.4 returned the raw stored value. A raw value that the value cast rejects now raises from get as it does from d[k]. dict.get(d, k) still reads the raw value.
  • Annotate the default of to_float as int | float, contributed by @rupayon123 in PR #69. The documented to_float('abc', default=0.0) was a type error under mypy and pyright. A # type: ignore added for it is now reported as unused under mypy --strict.
  • Keep from python_utils.types import * working on Python 3.15, contributed by @maoxor in PR #70. Python 3.15 removed typing.ByteString and typing.no_type_check_decorator, so the star import raised AttributeError there. Both names stay exported on 3.10 to 3.14, at their 4.1.4 positions in __all__, and 3.15 joins the CI matrix and the classifiers.
  • Choose the binary prefix of scale_1024 from the exact integer threshold, contributed by @ShahadatTest in PR #71. 4.1.4 took the prefix from a logarithm, which rounded an integer just below a boundary up to it: scale_1024(2**60 - 1, 9) returned (1.0, 6) and scale_1024(2**50 - 1, 9) returned (0.9999999999999991, 5), while scale_1024(2**40 - 1, 9) already returned (1023.9999999990687, 3). Every power now behaves like the lower ones: (1024.0, 5) and (1023.9999999999991, 4), so a progressbar2 DataSize prints 1024.0 PiB where 4.1.4 printed 1.0 EiB for a value a few bytes below an exbibyte. Only ints take the exact comparison. Any other number goes through float() as before.
  • Keep the return type of a custom container in acontainer, contributed by @ShahadatTest in PR #72. The overloads only typed list, set and tuple, so await acontainer(source, frozenset) was a type error under mypy and pyright and its result came back as Any, while the call already worked at runtime. A fourth overload types any factory that takes the collected items, so frozenset[int] and deque[int] are inferred now. Runtime behaviour is unchanged. A # type: ignore written for such a call is now reported as unused under mypy --strict, and a factory that does not return a collection, such as sum, is rejected with type-var instead of call-overload.

Signed on 2026-11-12 with ppt sign, after the release.
The files above are the exact PyPI uploads for this version, verified by sha256 against PyPI before signing.
Each file has a GPG signature (.asc, key 149325FD15904E9C4EB89E95E81444E9CE1F695D) and a Sigstore bundle (.sigstore.json).
SHA256SUMS.asc signs the checksum list.
Rebuilt files, if any: none.
How to verify: https://github.com/WoLpH/python-project-tools/blob/master/VERIFY.md