Skip to content

Latest commit

 

History

History
823 lines (610 loc) · 28.6 KB

CHANGELOG.rst

File metadata and controls

823 lines (610 loc) · 28.6 KB

Changelog

Sponsor

If you or your organization depends on bidict, please consider sponsoring bidict on GitHub.

Tip

Watch bidict releases on GitHub to be notified when new versions of bidict are published. Click the "Watch" dropdown, choose "Custom", and then choose "Releases".

0.23.1 (2024-02-18)

Fix a regression in 0.23.0 that could defeat type inference of a bidict's key type and value type when running in Python 3.8 or 3.9. :issue:`310`

0.23.0 (2024-02-14)

Primarily, this release simplifies bidict by removing minor features that are no longer necessary or that have little to no apparent usage, and it also includes some performance optimizations.

Specifically, initializing or updating a bidict is now up to 70% faster in microbenchmarks.

The changes in this release will also make it easier to maintain and improve bidict in the future, including further potential performance optimizations.

It also contains several other improvements.

0.22.1 (2022-12-31)

0.22.0 (2022-03-23)

0.21.4 (2021-10-23)

Explicitly declare support for Python 3.10 as well as some minor internal improvements.

0.21.3 (2021-09-05)

0.21.2 (2020-09-07)

0.21.1 (2020-09-07)

This release was yanked and replaced with the 0.21.2 release, which actually provides the intended changes.

0.21.0 (2020-08-22)

0.20.0 (2020-07-23)

The following breaking changes are expected to affect few if any users.

Remove APIs deprecated in the previous release:

0.19.0 (2020-01-09)

0.18.4 (2020-11-02)

  • Backport fix from v0.20.0 that removes bidict.BidirectionalMapping.__subclasshook__ due to lack of use and maintenance cost.

0.18.3 (2019-09-22)

0.18.2 (2019-09-08)

  • Warn that Python 2 support will be dropped in a future release when Python 2 is detected.

0.18.1 (2019-09-03)

0.18.0 (2019-02-14)

  • Rename bidict.BidirectionalMapping.inv to :attr:`~bidict.BidirectionalMapping.inverse` and make :attr:`bidict.BidictBase.inv` an alias for :attr:`~bidict.BidictBase.inverse`. :issue:`86`

  • bidict.BidirectionalMapping.__subclasshook__ now requires an inverse attribute rather than an inv attribute for a class to qualify as a virtual subclass. This breaking change is expected to affect few if any users.

  • Add Python 2/3-compatible bidict.compat.collections_abc alias.

  • Stop testing Python 3.4 on CI, and warn when Python 3 < 3.5 is detected rather than Python 3 < 3.3.

    Python 3.4 reaches end of life on 2019-03-18. As of January 2019, 3.4 represents only about 3% of bidict downloads on PyPI Stats.

0.17.5 (2018-11-19)

Improvements to performance and delegation logic, with minor breaking changes to semi-private APIs.

  • Remove the __delegate__ instance attribute added in the previous release. It was overly general and not worth the cost.

    Instead of checking self.__delegate__ and delegating accordingly each time a possibly-delegating method is called, revert back to using "delegated-to-fwdm" mixin classes (now found in bidict._delegating_mixins), and resurrect a mutable bidict parent class that omits the mixins as :class:`bidict.MutableBidict`.

  • Rename __repr_delegate__ to _repr_delegate.

0.17.4 (2018-11-14)

Minor code, interop, and (semi-)private API improvements.

  • :class:`~bidict.OrderedBidict` optimizations and code improvements.

    Use bidicts for the backing _fwdm and _invm mappings, obviating the need to store key and value data in linked list nodes.

  • Refactor proxied- (i.e. delegated-) to-_fwdm logic for better composability and interoperability.

    Drop the _Proxied* mixin classes and instead move their methods into :class:`~bidict.BidictBase`, which now checks for an object defined by the BidictBase.__delegate__ attribute. The BidictBase.__delegate__ object will be delegated to if the method is available on it, otherwise a default implementation (e.g. inherited from :class:`~collections.abc.Mapping`) will be used otherwise. Subclasses may set __delegate__ = None to opt out.

    Consolidate _MutableBidict into :class:`bidict.bidict` now that the dropped mixin classes make it unnecessary.

  • Change __repr_delegate__ to simply take a type like :class:`dict` or :class:`list`.

  • Upgrade to latest major sortedcontainers version (from v1 to v2) for the extending:``SortedBidict`` Recipes.

  • bidict.compat.{view,iter}{keys,values,items} on Python 2 no longer assumes the target object implements these methods, as they're not actually part of the :class:`~collections.abc.Mapping` interface, and provides fallback implementations when the methods are unavailable. This allows the extending:``SortedBidict`` Recipes to continue to work with sortedcontainers v2 on Python 2.

0.17.3 (2018-09-18)

  • Improve packaging by adding a pyproject.toml and by including more supporting files in the distribution. #81
  • Drop pytest-runner and support for running tests via python setup.py test in preference to pytest or python -m pytest.

0.17.2 (2018-04-30)

Memory usage improvements

  • Use less memory in the linked lists that back :class:`~bidict.OrderedBidict`s by storing node data unpacked rather than in (key, value) tuple objects.

0.17.1 (2018-04-28)

Bugfix Release

Fix a regression in 0.17.0 that could cause erroneous behavior when updating items of an :class:`~bidict.OrderedBidict`'s inverse, e.g. some_ordered_bidict.inv[foo] = bar.

0.17.0 (2018-04-25)

Speedups and memory usage improvements

Misc

0.16.0 (2018-04-06)

Minor code and efficiency improvements to :func:`~bidict.inverted` and bidict._iter._iteritems_args_kw (formerly bidict.pairs()).

Minor Breaking API Changes

The following breaking changes are expected to affect few if any users.

  • Rename bidict.pairs()bidict._iter._iteritems_args_kw.

0.15.0 (2018-03-29)

Speedups and memory usage improvements

  • Use slots to speed up bidict attribute access and reduce memory usage. On Python 3, instantiating a large number of bidicts now uses ~57% the amount of memory that it used before, and on Python 2 only ~33% the amount of memory that it used before, in a simple but representative benchmark.
  • Use weakrefs to refer to a bidict's inverse internally, no longer creating a strong reference cycle. Memory for a bidict that you create can now be reclaimed in CPython as soon as you no longer hold any references to it, rather than having to wait for the next garbage collection. See the new addendum:``bidict`` Avoids Reference Cycles documentation. :issue:`24`
  • Make :func:`bidict.BidictBase.__eq__` significantly more speed- and memory-efficient when comparing to a non-:class:`dict` :class:`~collections.abc.Mapping`. (Mapping.__eq__()'s inefficient implementation will now never be used.) The implementation is now more reusable as well.
  • Make :func:`bidict.OrderedBidictBase.__iter__` as well as equality comparison slightly faster for ordered bidicts.

Minor Bugfixes

  • namedbidict now verifies that the provided keyname and valname are distinct, raising :class:`ValueError` if they are equal.
  • namedbidict now raises :class:`TypeError` if the provided base_type is not a :class:`~bidict.BidirectionalMapping`.
  • If you create a custom bidict subclass whose _fwdm_cls differs from its _invm_cls (as in the FwdKeySortedBidict example from the extending:``SortedBidict`` Recipes), the inverse bidirectional mapping type (with _fwdm_cls and _invm_cls swapped) is now correctly computed and used automatically for your custom bidict's :attr:`~bidict.BidictBase.inverse` bidict.

Misc

Minor Breaking API Changes

The following breaking changes are expected to affect few if any users.

  • Split back out the :class:`~bidict.BidictBase` class from :class:`~bidict.frozenbidict` and :class:`~bidict.OrderedBidictBase` from FrozenOrderedBidict, reverting the merging of these in 0.14.0. Having e.g. issubclass(bidict, frozenbidict) == True was confusing, so this change restores issubclass(bidict, frozenbidict) == False.

    See the updated other-bidict-types:Bidict Types Diagram and other-bidict-types:Polymorphism documentation.

  • Rename:

    • bidict.BidictBase.fwdm._fwdm
    • bidict.BidictBase.invm._invm
    • bidict.BidictBase.fwd_cls._fwdm_cls
    • bidict.BidictBase.inv_cls._invm_cls
    • bidict.BidictBase.isinv._isinv

    Though overriding _fwdm_cls and _invm_cls remains supported (see extending), this is not a common enough use case to warrant public names. Most users do not need to know or care about any of these.

  • The :attr:`~bidict.RAISE`, OVERWRITE, and IGNORE duplication policies are no longer available as attributes of DuplicationPolicy, and can now only be accessed as attributes of the :mod:`bidict` module namespace, which was the canonical way to refer to them anyway. It is now no longer possible to create an infinite chain like DuplicationPolicy.RAISE.RAISE.RAISE...

  • Make bidict.pairs() and :func:`bidict.inverted` no longer importable from bidict.util, and now only importable from the top-level :mod:`bidict` module. (bidict.util was renamed bidict._util.)

  • Pickling ordered bidicts now requires at least version 2 of the pickle protocol. If you are using Python 3, :obj:`pickle.DEFAULT_PROTOCOL` is 3 anyway, so this will not affect you. However if you are using in Python 2, :obj:`~pickle.DEFAULT_PROTOCOL` is 0, so you must now explicitly specify the version in your :func:`pickle.dumps` calls, e.g. pickle.dumps(ob, 2).