* Ditch setup.py in favor of setuptools' PEP 621 support. Ref:
https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
* Declare development dependencies in pyproject.toml rather than
requirements/*.in
* Ditch pip-compile-multi which does not support sourcing deps from pyproject.toml
* Compile dependencies into dev-deps/*.txt rather than requirements/*.txt
* Don't include development-related files in the sdist or wheel.
* Drop less important bidict.metadata attributes
(__maintainer__, __email__, __status__, __keywords__, __project_urls__)
and make __author__ a dictionary with "name" and "email" keys
to match the standard format in pyproject.toml.
* Switch from install-extras to requirements.in + pip-tools for
deterministic installation of dependencies.
* Do not use the isolated pre-commit environment for the pylint
hook as per
https://github.com/pre-commit/pre-commit/issues/813#issuecomment-413220498.
* Use setuptools_scm's new parentdir_prefix_version feature to fix#115.
See pypa/setuptools_scm#477.
* Drop sphinx_autodoc_typehints; use equivalent functionality now built
into Sphinx.
* Don't bother with Mac build on Travis
* No need to enable coverage on PyPy3 now that there's no PyPy-specific code
* Move more coverage line excludes to config
* Update old email address.
* Deprecate ``bidict.OVERWRITE`` and ``bidict.IGNORE``.
A :class:`UserWarning` will now be emitted if these are used.
:attr:`bidict.DROP_OLD` and :attr:`bidict.DROP_NEW` should be used instead.
* Rename ``DuplicationPolicy`` to :class:`~bidict.OnDupAction`
(and implement it via an :class:`~enum.Enum`).
A :class:`~bidict.OnDupAction` may be one of
:attr:`~bidict.RAISE`,
:attr:`~bidict.DROP_OLD`, or
:attr:`~bidict.DROP_NEW`.
* Expose the new :class:`~bidict.OnDup` class,
a named (*key*, *val*, *kv*) tuple of :class:`~bidict.OnDupAction`\s
that should be taken upon encountering
the 3 kinds of duplication that can occur.
* Provide the
:attr:`~bidict.ON_DUP_DEFAULT`,
:attr:`~bidict.ON_DUP_RAISE`, and
:attr:`~bidict.ON_DUP_DROP_OLD`
:class:`~bidict.OnDup` convenience instances.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv`` arguments
of :meth:`~bidict.bidict.put` and :meth:`~bidict.bidict.putall`.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new *on_dup* argument,
which takes an :class:`~bidict.OnDup` instance.
Use it like this: ``bi.put(1, 2, OnDup(key=DROP_NEW))``.
Or better yet, pass one of the
``ON_DUP_*`` convenience instances
instead if possible.
See the updated :ref:`basic-usage:Values Must Be Unique` docs for more info.
* Deprecate the
``on_dup_key``, ``on_dup_val``, and ``on_dup_kv``
bidict class attributes.
A :class:`UserWarning` will now be emitted if these are used.
They have been subsumed by the new
:attr:`~bidict.bidict.on_dup` class attribute,
which takes an :class:`~bidict.OnDup` instance.
See the updated :doc:`extending` docs for example usage.
* Move
:meth:`bidict.BidictBase.values` to
:meth:`bidict.BidirectionalMapping.values`,
since the implementation is generic.
* No longer use ``__all__`` in ``bidict/__init__.py``.
* Cap max_size rather than disabling health checks and deadline as a
less heavyhanded way to improve hypothesis test reliability on Travis.
Also:
* Raise ImportError on Python < 2.7, rather than allowing the
SyntaxError caused by 2.7+ syntax (e.g. dict comprehensions).
* Cosmetic, small refactor of _update().
bidict.BidirectionalMapping.__subclasshook__ now requires an ``inverse`` attribute
rather than an ``inv`` attribute for a class to qualify as a virtual subclass.
Closes#86.
- 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
:attr:`~bidict.BidictBase.__delegate__` attribute.
The :attr:`~bidict.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 :attr:`~bidict.BidictBase.__repr_delegate__`
to take simply a type like :class:`dict` or :class:`list`.
- Upgrade to latest major
`sortedcontainers <https://github.com/grantjenks/python-sortedcontainers>`__
version (from v1 to v2)
for the :ref:`extending:Sorted Bidict Recipes`.
- ``bidict.compat.{view,iter}{keys,values,items}`` on Python2
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 :ref:`extending:Sorted Bidict Recipes`
to continue to work with sortedcontainers v2 on Python2.
- Test code in docs via Sphinx rather than pytest.
Enables running Python version-dependent tests conditionally
rather than skipping them altogether, as well as hiding import
statements (via `testsetup`) that otherwise just add noise.
Run tests (viz. pytest and Sphinx doctest) via a new
run-tests.py script.
- improve basic usage and "Why can't I just use a dict?" docs
- rename _static -> assets
- use forward declarations of custom rst interpreted text roles we use that
sphinx defines and that PyPI and GitHub couldn't handle otherwise (e.g.
:doc:), rather than stripping them out in setup.py
- move __keywords__ and __url__ from setup.py into bidict/metadata.py
- add __version_info__ metadata attribute
- import bidict/metadata.py in setup.py rather than `exec`ing it
- add back Python 3.4 to Travis test matrix
- improve hypothesis settings for max_examples_5000 profile
(used in nightly CI builds)
- suppress hypothesis's hung_test health check for max_examples_5000 profile
to prevent flaky tests caused by failed health checks. Avoids errors like:
E hypothesis.errors.FailedHealthCheck: Your test has been running for
at least five minutes. This is probably not what you intended, so by
default Hypothesis turns it into an error.
E See https://hypothesis.readthedocs.io/en/latest/healthchecks.html for
more information about this. If you want to disable just this health
check, add HealthCheck.hung_test to the suppress_health_check settings
for this test.
- improve coverage
- use latest pip on travis
- update to tox 3
- guard Python < 3.3 warning with PYMAJOR == 3 condition
- docs improvements, esp. for viewing on GitHub:
- fix `foo <bar>`__ link syntax (always use two underscores)
- use `.. code: python` for code blocks to enable GitHub syntax highlighting
- ditch `.. include::` which GitHub does not support
- use sphinx.ext.autosectionlabel
- only wrap linkcheck with travis_retry
- s/sibbell/libraries.io
- Make :func:`bidict.FrozenOrderedBidict.__iter__` slightly more efficient.
- :func:`~bidict.frozenbidict.__repr__` no longer dynamically checks
for a ``__reversed__`` method to determine whether to use an ordered or
unordered ``__repr__`` delegate. Now it always just calls the new
:func:`~bidict.frozenbidict.__repr_delegate__` instead, which may be
explicitly overridden as needed.