Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-immutabledict for openSUSE:Factory checked in at 2023-08-10 15:34:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-immutabledict (Old) and /work/SRC/openSUSE:Factory/.python-immutabledict.new.11712 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-immutabledict" Thu Aug 10 15:34:49 2023 rev:3 rq:1103297 version:3.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-immutabledict/python-immutabledict.changes 2023-07-10 16:41:00.466938752 +0200 +++ /work/SRC/openSUSE:Factory/.python-immutabledict.new.11712/python-immutabledict.changes 2023-08-10 15:35:03.544597330 +0200 @@ -1,0 +2,13 @@ +Thu Aug 10 09:28:31 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 3.0.0: + * copy() (breaking change): remove the option to pass keyword + arguments (which were present as key/value pairs in the copy). + Now the method doesn't take any arguments (it behaves the same + as a normal dict). + * Python versions: drop Python 3.7 support + * Typing: fixes + - Make the key covariant. Thanks to @spacether for the PR #244 + - Fix key/value typing missing for ImmutableOrderedDict + +------------------------------------------------------------------- Old: ---- immutabledict-2.2.5.tar.gz New: ---- immutabledict-3.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-immutabledict.spec ++++++ --- /var/tmp/diff_new_pack.WuNNTI/_old 2023-08-10 15:35:04.096600771 +0200 +++ /var/tmp/diff_new_pack.WuNNTI/_new 2023-08-10 15:35:04.100600797 +0200 @@ -24,18 +24,17 @@ %define psuffix %{nil} %bcond_with test %endif -%define github_user corenting %define short_name immutabledict %{?sle15_python_module_pythons} Name: python-%{short_name}%{psuffix} -Version: 2.2.5 +Version: 3.0.0 Release: 0 Summary: Immutable wrapper around dictionaries (a fork of frozendict) License: MIT Group: Development/Languages/Python URL: https://github.com/corenting/immutabledict Source: https://files.pythonhosted.org/packages/source/i/immutabledict/immutabledict-%{version}.tar.gz -BuildRequires: %{python_module flit-core} +BuildRequires: %{python_module base >= 3.8} BuildRequires: %{python_module pip} BuildRequires: %{python_module poetry-core} BuildRequires: %{python_module setuptools} @@ -48,7 +47,7 @@ BuildRequires: python-rpm-macros BuildArch: noarch %if %{with test} -BuildRequires: %{python_module %{short_name}} +BuildRequires: %{python_module %{short_name} = %version} %endif %python_subpackages ++++++ immutabledict-2.2.5.tar.gz -> immutabledict-3.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/immutabledict-2.2.5/PKG-INFO new/immutabledict-3.0.0/PKG-INFO --- old/immutabledict-2.2.5/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/immutabledict-3.0.0/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +1,16 @@ Metadata-Version: 2.1 Name: immutabledict -Version: 2.2.5 +Version: 3.0.0 Summary: Immutable wrapper around dictionaries (a fork of frozendict) Home-page: https://github.com/corenting/immutabledict License: MIT Keywords: immutable,dictionary Author: Corentin Garcia Author-email: corent...@gmail.com -Requires-Python: >=3.7,<4.0 +Requires-Python: >=3.8,<4.0 Classifier: Development Status :: 5 - Production/Stable Classifier: License :: OSI Approved :: MIT License Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 @@ -34,14 +33,13 @@ It implements the complete mapping interface and can be used as a drop-in replacement for dictionaries where immutability is desired. The immutabledict constructor mimics dict, and all of the expected interfaces (iter, len, repr, hash, getitem) are provided. Note that an immutabledict does not guarantee the immutability of its values, so the utility of hash method is restricted by usage. -The only difference is that the copy() method of immutable takes variable keyword arguments, which will be present as key/value pairs in the new, immutable copy. - ## Installation -Available as `immutabledict` on : -- [pypi](https://pypi.org/project/immutabledict/) -- [conda-forge](https://anaconda.org/conda-forge/immutabledict) (community-maintained, not an official release) -- alpine as [py3-immutabledict](https://pkgs.alpinelinux.org/packages?name=py3-immutabledict) (community-maintained, not an official release) +Official release in [on pypy](https://pypi.org/project/immutabledict/) as `immutabledict`. + +**Community-maintained** releases are available: +- On [conda-forge](https://anaconda.org/conda-forge/immutabledict) as `immutabledict` +- On [various package repositories](https://repology.org/project/python:immutabledict/versions) ## Example @@ -54,8 +52,9 @@ ## Differences with the old original frozendict package -- Dropped support of EOL Python versions (version 1.0.0 supports Python 3.5, versions <= 2.2.1 supports Python 3.6) +- Dropped support of EOL Python versions (older versions of the library may support older Python versions) - Fixed `collections.Mapping` deprecation warning - Typing - [PEP 584 union operators](https://www.python.org/dev/peps/pep-0584/) +- Keep the same signature for `copy()` as `dict` (starting with immutabledict 3.0.0), don't accept extra keyword arguments. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/immutabledict-2.2.5/README.md new/immutabledict-3.0.0/README.md --- old/immutabledict-2.2.5/README.md 2023-07-04 12:37:42.630829800 +0200 +++ new/immutabledict-3.0.0/README.md 2023-07-21 20:13:55.780401200 +0200 @@ -10,14 +10,13 @@ It implements the complete mapping interface and can be used as a drop-in replacement for dictionaries where immutability is desired. The immutabledict constructor mimics dict, and all of the expected interfaces (iter, len, repr, hash, getitem) are provided. Note that an immutabledict does not guarantee the immutability of its values, so the utility of hash method is restricted by usage. -The only difference is that the copy() method of immutable takes variable keyword arguments, which will be present as key/value pairs in the new, immutable copy. - ## Installation -Available as `immutabledict` on : -- [pypi](https://pypi.org/project/immutabledict/) -- [conda-forge](https://anaconda.org/conda-forge/immutabledict) (community-maintained, not an official release) -- alpine as [py3-immutabledict](https://pkgs.alpinelinux.org/packages?name=py3-immutabledict) (community-maintained, not an official release) +Official release in [on pypy](https://pypi.org/project/immutabledict/) as `immutabledict`. + +**Community-maintained** releases are available: +- On [conda-forge](https://anaconda.org/conda-forge/immutabledict) as `immutabledict` +- On [various package repositories](https://repology.org/project/python:immutabledict/versions) ## Example @@ -30,7 +29,8 @@ ## Differences with the old original frozendict package -- Dropped support of EOL Python versions (version 1.0.0 supports Python 3.5, versions <= 2.2.1 supports Python 3.6) +- Dropped support of EOL Python versions (older versions of the library may support older Python versions) - Fixed `collections.Mapping` deprecation warning - Typing - [PEP 584 union operators](https://www.python.org/dev/peps/pep-0584/) +- Keep the same signature for `copy()` as `dict` (starting with immutabledict 3.0.0), don't accept extra keyword arguments. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/immutabledict-2.2.5/immutabledict/__init__.py new/immutabledict-3.0.0/immutabledict/__init__.py --- old/immutabledict-2.2.5/immutabledict/__init__.py 2023-07-04 12:37:42.630829800 +0200 +++ new/immutabledict-3.0.0/immutabledict/__init__.py 2023-07-21 20:13:55.780401200 +0200 @@ -3,10 +3,10 @@ from collections import OrderedDict from typing import Any, Dict, Iterable, Iterator, Mapping, Optional, Type, TypeVar -__version__ = "2.2.5" +__version__ = "3.0.0" _K = TypeVar("_K") -_V = TypeVar("_V") +_V = TypeVar("_V", covariant=True) class immutabledict(Mapping[_K, _V]): @@ -22,7 +22,7 @@ @classmethod def fromkeys( cls, seq: Iterable[_K], value: Optional[_V] = None - ) -> "immutabledict[_K, _V]": + ) -> immutabledict[_K, _V]: return cls(cls.dict_cls.fromkeys(seq, value)) def __init__(self, *args: Any, **kwargs: Any) -> None: @@ -35,8 +35,8 @@ def __contains__(self, key: object) -> bool: return key in self._dict - def copy(self, **add_or_replace: _V) -> immutabledict[_K, _V]: - return self.__class__(self, **add_or_replace) + def copy(self) -> immutabledict[_K, _V]: + return self.__class__(self) def __iter__(self) -> Iterator[_K]: return iter(self._dict) @@ -45,7 +45,7 @@ return len(self._dict) def __repr__(self) -> str: - return "%s(%r)" % (self.__class__.__name__, self._dict) + return "{}({!r})".format(self.__class__.__name__, self._dict) def __hash__(self) -> int: if self._hash is None: @@ -74,12 +74,9 @@ raise TypeError(f"'{self.__class__.__name__}' object is not mutable") -class ImmutableOrderedDict(immutabledict): +class ImmutableOrderedDict(immutabledict[_K, _V]): """ An immutabledict subclass that maintains key order. - - Not necessary anymore as for Python >= 3.7 order is guaranteed with the normal - immutabledict class, but kept for compatibility purpose. """ dict_cls = OrderedDict diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/immutabledict-2.2.5/pyproject.toml new/immutabledict-3.0.0/pyproject.toml --- old/immutabledict-2.2.5/pyproject.toml 2023-07-04 12:37:42.630829800 +0200 +++ new/immutabledict-3.0.0/pyproject.toml 2023-07-21 20:13:55.780401200 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "immutabledict" -version = "2.2.5" +version = "3.0.0" description = "Immutable wrapper around dictionaries (a fork of frozendict)" authors = ["Corentin Garcia <corent...@gmail.com>"] license = "MIT" @@ -20,7 +20,7 @@ "Bug Tracker" = "https://github.com/corenting/immutabledict/issues" [tool.poetry.dependencies] -python = "^3.7" +python = "^3.8" [tool.poetry.dev-dependencies] black = "*" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/immutabledict-2.2.5/tests/test_immutabledict.py new/immutabledict-3.0.0/tests/test_immutabledict.py --- old/immutabledict-2.2.5/tests/test_immutabledict.py 2023-07-04 12:37:42.630829800 +0200 +++ new/immutabledict-3.0.0/tests/test_immutabledict.py 2023-07-21 20:13:55.780401200 +0200 @@ -1,80 +1,115 @@ +from typing import Any, Dict, Union import pytest from immutabledict import ImmutableOrderedDict, immutabledict class TestImmutableDict: - def test_cannot_assign_value(self): + def test_covariance(self) -> None: + """ + Not a real unit test, but test covariance + as mypy runs on the tests. + """ + + class Base: + pass + + class One(Base): + pass + + class Two(Base): + pass + + # Value test + my_dict: immutabledict[str, Union[Base, One]] = immutabledict() + second_dict: immutabledict[str, Two] = immutabledict({"t": Two()}) + my_dict = second_dict + assert my_dict == second_dict + + def test_cannot_assign_value(self) -> None: with pytest.raises(AttributeError): - immutabledict().setitem("key", "value") + immutabledict().setitem("key", "value") # type: ignore - def test_from_keys(self): - keys = ("a", "b", "c") - immutable_dict = immutabledict.fromkeys(keys) + def test_from_keys(self) -> None: + keys = ["a", "b", "c"] + immutable_dict: immutabledict[str, Any] = immutabledict.fromkeys(keys) assert "a" in immutable_dict assert "b" in immutable_dict assert "c" in immutable_dict - def test_init_and_compare(self): + def test_init_and_compare(self) -> None: normal_dict = {"a": "value", "b": "other_value"} - immutable_dict = immutabledict(normal_dict) + immutable_dict: immutabledict[str, str] = immutabledict(normal_dict) assert immutable_dict == normal_dict - def test_get_existing(self): - immutable_dict = immutabledict({"a": "value"}) + def test_get_existing(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict({"a": "value"}) assert immutable_dict["a"] == "value" - def test_get_not_existing(self): - immutable_dict = immutabledict({"a": "value"}) + def test_get_not_existing(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict({"a": "value"}) with pytest.raises(KeyError): immutable_dict["b"] - def test_contains(self): - immutable_dict = immutabledict({"a": "value"}) + def test_contains(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict({"a": "value"}) assert "a" in immutable_dict - def test_contains_not_existing(self): - immutable_dict = immutabledict({"a": "value"}) + def test_contains_not_existing(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict({"a": "value"}) assert "b" not in immutable_dict - def test_copy(self): - original = immutabledict({"a": "value"}) + def test_copy(self) -> None: + original: immutabledict[str, str] = immutabledict({"a": "value"}) copy = original.copy() assert original == copy + assert id(original) != id(copy) - def test_iter(self): - immutable_dict = immutabledict({"a": "value", "b": "other_value"}) - itered_keys = {x for x in immutable_dict} + def test_iter(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict( + {"a": "value", "b": "other_value"} + ) + itered_keys = set(immutable_dict) assert immutable_dict.keys() == itered_keys - def test_len(self): - immutable_dict = immutabledict({"a": "value", "b": "other_value"}) + def test_len(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict( + {"a": "value", "b": "other_value"} + ) assert len(immutable_dict) == 2 - def test_len_empty(self): - immutable_dict = immutabledict({}) + def test_len_empty(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict({}) assert len(immutable_dict) == 0 - def test_repr(self): - immutable_dict = immutabledict({"a": "value", "b": "other_value"}) + def test_repr(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict( + {"a": "value", "b": "other_value"} + ) repr_ret = repr(immutable_dict) assert repr_ret.startswith("immutabledict") assert repr_ret.endswith(")") - def test_repr_should_eval(self): - immutable_dict = immutabledict({"a": "value", "b": "other_value"}) + def test_repr_should_eval(self) -> None: + immutable_dict: immutabledict[str, str] = immutabledict( + {"a": "value", "b": "other_value"} + ) eval_ret = eval(repr(immutable_dict)) assert immutable_dict == eval_ret - def test_hash(self): - first_dict = immutabledict({"a": "value", "b": "other_value"}) - second_dict = immutabledict({"a": "value", "b": "other_value"}) + def test_hash(self) -> None: + first_dict: immutabledict[str, str] = immutabledict( + {"a": "value", "b": "other_value"} + ) + second_dict: immutabledict[str, str] = immutabledict( + {"a": "value", "b": "other_value"} + ) assert hash(first_dict) == hash(second_dict) - def test_union_operator_merge(self): - first_dict = immutabledict({"a": "a", "b": "b"}) - second_dict = immutabledict({"a": "A", "c": "c"}) + def test_union_operator_merge(self) -> None: + first_dict: immutabledict[str, str] = immutabledict({"a": "a", "b": "b"}) + second_dict: immutabledict[str, str] = immutabledict({"a": "A", "c": "c"}) merged_dict = first_dict | second_dict assert isinstance(merged_dict, immutabledict) assert merged_dict == { @@ -85,9 +120,9 @@ assert first_dict == {"a": "a", "b": "b"} assert second_dict == {"a": "A", "c": "c"} - def test_union_operator_merge_with_dict(self): - first_dict = dict({"a": "a", "b": "b"}) - second_dict = immutabledict({"a": "A", "c": "c"}) + def test_union_operator_merge_with_dict_first(self) -> None: + first_dict: Dict[str, str] = dict({"a": "a", "b": "b"}) + second_dict: immutabledict[str, str] = immutabledict({"a": "A", "c": "c"}) merged_dict = first_dict | second_dict assert isinstance(merged_dict, dict) assert merged_dict == { @@ -98,8 +133,9 @@ assert first_dict == {"a": "a", "b": "b"} assert second_dict == {"a": "A", "c": "c"} - first_dict = immutabledict({"a": "a", "b": "b"}) - second_dict = dict({"a": "A", "c": "c"}) + def test_union_operator_merge_with_dict_second(self) -> None: + first_dict: immutabledict[str, str] = immutabledict({"a": "a", "b": "b"}) + second_dict: Dict[str, str] = dict({"a": "A", "c": "c"}) merged_dict = first_dict | second_dict assert isinstance(merged_dict, immutabledict) assert merged_dict == { @@ -110,8 +146,8 @@ assert first_dict == {"a": "a", "b": "b"} assert second_dict == {"a": "A", "c": "c"} - def test_union_operator_merge_fail(self): - first_dict = immutabledict({"a": "a", "b": "b"}) + def test_union_operator_merge_fail(self) -> None: + first_dict: immutabledict[str, str] = immutabledict({"a": "a", "b": "b"}) with pytest.raises(TypeError): first_dict | 0 @@ -119,16 +155,16 @@ with pytest.raises(TypeError): 0 | first_dict - def test_union_operator_update(self): - first_dict = immutabledict({"a": "a", "b": "b"}) - second_dict = immutabledict({"a": "A", "c": "c"}) + def test_union_operator_update(self) -> None: + first_dict: immutabledict[str, str] = immutabledict({"a": "a", "b": "b"}) + second_dict: immutabledict[str, str] = immutabledict({"a": "A", "c": "c"}) with pytest.raises(TypeError): first_dict |= second_dict - def test_union_operator_update_with_dict(self): - first_dict = dict({"a": "a", "b": "b"}) - second_dict = immutabledict({"a": "A", "c": "c"}) + def test_union_operator_update_with_dict_first(self) -> None: + first_dict: Dict[str, str] = dict({"a": "a", "b": "b"}) + second_dict: immutabledict[str, str] = immutabledict({"a": "A", "c": "c"}) first_dict |= second_dict assert isinstance(first_dict, dict) @@ -139,8 +175,9 @@ } assert second_dict == {"a": "A", "c": "c"} - first_dict = immutabledict({"a": "a", "b": "b"}) - second_dict = dict({"a": "A", "c": "c"}) + def test_union_operator_update_with_dict_second(self) -> None: + first_dict: immutabledict[str, str] = immutabledict({"a": "a", "b": "b"}) + second_dict: Dict[str, str] = dict({"a": "A", "c": "c"}) with pytest.raises(TypeError): first_dict |= second_dict @@ -150,15 +187,15 @@ class TestImmutableOrderedDict: - def test_ordered(self): - ordered = ImmutableOrderedDict( + def test_ordered(self) -> None: + ordered: ImmutableOrderedDict[str, str] = ImmutableOrderedDict( { "a": "1", "b": "2", "c": "3", } ) - itered_keys = [x for x in ordered] + itered_keys = list(ordered) assert itered_keys[0] == "a" assert itered_keys[1] == "b" assert itered_keys[2] == "c"