bidict v0.21.2 Release NotesRelease Date: 2020-09-07 // about 1 year ago
🚀 Please see https://bidict.readthedocs.io/en/v0.21.2/changelog.html for the changes in this release.
Previous changes from v0.21.0
type hints <https://www.python.org/dev/peps/pep-0484/>__! ⌨️ ✅
Adding type hints to :mod:
bidictposes particularly interesting challenges due to the combination of generic types, dynamically-generated types (such as :ref:
inverse bidict classes <extending:Dynamic Inverse Class Generation>and :func:
namedbidicts <bidict.namedbidict>), and complicating optimizations such as the use of slots and weakrefs.
It didn't take long to hit bugs and missing features in the state of the art for type hinting in Python today, e.g. missing higher-kinded types support (
python/typing#548 <https://github.com/python/typing/issues/548#issuecomment-621195693>), too-narrow type hints for :class:
python/typeshed#4435 <https://github.com/python/typeshed/issues/4435>), a :class:
typing.Genericbug in Python 3.6 (
BPO-41451 <https://bugs.python.org/issue41451>__), etc.
That said, this release should provide a solid foundation for code using :mod:
bidictthat enables static type checking.
As always, if you spot any opportunities to improve :mod:
bidict(including its new type hints), please don't hesitate to submit a PR!
- ➕ Add :class:
other-bidict-types:Bidict Types Diagramhas been updated accordingly.
⬇️ Drop support for Python 3.5, which reaches end of life on 2020-09-13, represents a tiny percentage of bidict downloads on
PyPI Stats <https://pypistats.org/packages/bidict>, and lacks support for
variable type hint syntax <https://www.python.org/dev/peps/pep-0526/>,
ordered dicts <https://stackoverflow.com/a/39980744>, and :attr:`object.init_subclass__`.
✂ Remove the no-longer-needed
🚚 Move :ref:
inverse bidict class access <extending:Dynamic Inverse Class Generation>from a property to an attribute set in :attr:
~bidict.BidictBase.__init_subclass__, to save function call overhead on repeated access.
bidict.OrderedBidictBase.__iter__no longer accepts a
reversekeyword argument so that it matches the signature of :meth:
__module__attribute of various :mod:
bidicttypes (using :func:
sys._getframewhen necessary) so that private, internal modules are not exposed e.g. in classes' repr strings.
~bidict.namedbidictnow immediately raises :class:
TypeErrorif the provided
base_typedoes not provide
~object.__getstate__, rather than succeeding with a class whose instances may raise :class:
AttributeErrorwhen these attributes are accessed.