Up to [cvs.NetBSD.org] / pkgsrc / devel / py-utils
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
py-utils: updated to 4.2.1 4.2.1 Resolve relative names with two or more leading dots in import_global
py-utils: updated to 4.2.0
4.2.0
Deprecate batch sizes below 1 in batcher, and in abatcher without an interval. 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'. 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. 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. 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. 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. 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. 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. 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.
py-utils: updated to 4.1.4 4.1.4 Build from the source distribution with uv_build 0.13 and later. The build requirement was uv_build>=0.11,<0.13, so a frontend other than uv, such as python -m build or a distribution package build, refused to build 4.1.3 once uv_build 0.13 was the installed version.
py-utils: updated to 4.1.2 4.1.2 Count the time that passed across a daylight saving change in timesince for a timezone-aware datetime. Raise the error of a tzinfo whose utcoffset() raises or returns something other than a timedelta from timesince, where 4.1.1 printed a wall-clock difference.
py-utils: updated to 4.1.0 4.1.0 Keep UniqueList membership in sync when replacing an indexed item, and leave membership unchanged when the index is out of range, contributed Keep UniqueList membership in sync for slice assignment, extend, pop, remove, clear, += and *=, so extend and += no longer add duplicates and removed values can be added again. Accept one-shot iterables in UniqueList slice assignment, allow a slice to reuse the values it replaces, and reject a slice that repeats a value. Make copy.copy and copy.deepcopy of a UniqueList return a working copy with its own membership. Leave UniqueList membership unchanged when insert fails, and answer in for an unhashable value the way a list does. Make CastedDict and LazyCastedDict load from pickle on every protocol, including pickles written by 4.0.1, and stop copy.copy and copy.deepcopy from casting the stored values a second time. Cast what setdefault and |= store in a CastedDict or LazyCastedDict. A None default is stored as it is. Cast the key of a LazyCastedDict once when it is stored. It was cast twice. Let keyword arguments win over the mapping in update and the constructor of the casted dicts, as dict does. Make != the opposite of == for SliceableDeque, and compare unequal to a set when an item is unhashable. Remove the iterable of mappings from the DictUpdateArgs type alias. The code never accepted that shape. Log the traceback in Logged.exception(), and name the caller in every record of Logged instead of logger.py. Code that passed stacklevel=2 to work around the wrong caller now points one frame too high. Stop Logurud from crashing on a message with a brace in it. A message without arguments is logged as written, so braces that were doubled to avoid the crash now show doubled. Keep the value of a class that combines Logged or Logurud with a type such as int or str. Use the whole match in to_int and to_float for a pattern without a group, and never return a negative power from scale_1024. Count every day once in timesince, describe a negative timedelta by its size, and accept a timezone-aware datetime. Keep an acronym whole before an underscore or a digit in camel_to_underscore, so HTTP_OK becomes http_ok. Let import_global import a nested module that nothing imported before. Cancel the pending item of abatcher when the consumer stops early. A source that is an async generator ends at that point, where a leaked task used to take its next item. Restart the interval of abatcher after a full batch, and accept an iterator whose __anext__ returns a future. Accept a plain function as on_timeout in aio_generator_timeout_detector. Truncate format_time exactly for a precision below one second, and print the placeholder for nan. Limit the first sleep of timeout_generator and aio_timeout_generator to maximum_interval. Let acount count down to a stop with a negative step. Log a skipped call of sample through the logger of its module instead of the root logger, which installed a handler on it. Keep the name, docstring and signature of a function under listify, and leave the annotations of the wrapped function alone in wraps_classmethod. Return the value of total_seconds() from timedelta_to_seconds for a duration with a fraction. Correct docstrings that described something else than the code does, among them to_str returning bytes and the timeouts that read 0 as none. Run the timing tests on a fake clock, so they no longer depend on sleep accuracy, and ship conftest.py in the sdist.
py-utils: updated to 4.0.1 4.0.1 Allow uv_build 0.12.x, contributed Keep the python_utils.types export list unique. Delay newly published dependencies and development tools by 14 days before resolution.
py-utils: updated to 4.0.0 Version 4.0 is a modernization release: the public helpers you already rely on are unchanged, but the package underneath is faster to import, stricter about types, and built with a modern toolchain.
Fix PLIST after py-setuptools update; bump depends and revision
py-utils: updated to 3.9.1 3.9.1 Made tests far more reliable and fixed python_requires
py-*: remove unused tool dependency py-setuptools includes the py-wheel functionality nowadays
py-utils: updated to 3.9.0 3.9.0 Unknown changes
py-utils: updated to 3.8.2 v3.8.2 Windows can also return an OSError instead of a ValueError for a fromtimestamp overflow
py-utils: updated to 3.8.1 v3.8.1 fixed silly typo v3.8.0 Added slicabledeque
py-utils: updated to 3.7.0 v3.7.0 Fixed several typing issues and added more thorough tests v3.6.1 Increased typing-extensions version requirement v3.6.0 Added extra containers such as UniqueList and SlicableDeque. Added full pyright strict and mypy type checks
py-utils: updated to 3.5.2 v3.5.2 Added import shortcuts for container classes v3.5.1 Improved type hinting v3.5.0 Added unique list container
py-utils: updated to 3.4.5 v3.4.5 Added TracebackType to types v3.4.4 Added py.typed v3.4.3 Added py.typed v3.4.2 Added py.typed v3.4.1 Added py.typed v3.4.0 added more type hints, full pyright and mypy support and added py.typed file
py-utils: updated to 3.3.3 v3.3.3: fixed issue with not submitting tasks to `asyncio.wait` v3.3.2: Fixed bug with batcher skipping items in the case of timeouts v3.3.1: improved generator timeout handling v3.3.0: Added (asyncio) generators for automatic batching and timeout detection v3.2.3: Fixed loguru stack location
py-utils: updated to 3.1.0 v3.1.0: dropped python 3.6 support because it is deprecated and so we can somewhat use | as type union
py-utils: update to 3.0.0. 3.0.0 Python 3 update including full type hinting, asyncio tools, typing shortcuts and listify decorator for generators 2.7.1 Small documentation updates 2.7.0 added automated tox github action tests
*: bump PKGREVISION for egg.mk users They now have a tool dependency on py-setuptools instead of a DEPENDS
py-utils: mark as not for python 2.7 Also mark its users that way
py-utils: updated to 2.6.0 v2.6.0 added exponential timeout growth
py-utils: updated to 2.5.6 2.5.6: Unknown changes
Import python-utils-2.4.0 from pypi as devel/py-utils From the web page: > Python Utils is a collection of small Python functions and classes > which make common patterns shorter and easier. It is by no means a > complete collection but it has served me quite a bit in the past and I > will keep extending it.