Commit Graph

55 Commits

Author SHA1 Message Date
jab ce345d49ba Rename .inv to .inverse and add an alias for .inv.
bidict.BidirectionalMapping.__subclasshook__ now requires an ``inverse`` attribute
rather than an ``inv`` attribute for a class to qualify as a virtual subclass.

Closes #86.
2019-02-13 19:50:22 -05:00
jab d13fd9bb8a resurrect delegating mixins instead of __delegate__ + other refinements
e.g. s/__repr_delegate__/_repr_delegate

Also
- update
- update from pytest 3 to 4
- add CII best practices badge
- prepare for 0.17.5 release
2018-11-19 09:37:38 -05:00
jab afdf2f4f61 Various improvements.
- 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.
2018-11-05 15:52:59 -05:00
jab 204486026b include referral query params in tidelift urls 2018-10-17 11:21:45 -04:00
jab cec2d51de2 docs tweaks, tidelift 2018-10-17 11:16:43 -04:00
jab c2e98c022b restore download count badge \O/
+ improvements to custom.css
2018-08-14 21:44:39 -04:00
jab d014d17075 readme tweaks 2018-07-22 19:44:38 -04:00
jab cb1d80c97c tweak docs, setup.py, travis, and hypothesis tests
- 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.
2018-04-19 15:52:02 +07:00
jab 543d517ad9 bidict.pairs -> _iteritems_args_kw, docs + other small improvements
- 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
2018-04-06 11:28:44 +07:00
jab 6912e2c8f9 docs tweaks 2018-03-04 14:16:05 +11:00
jab 4234bf8ce3 split back out (Ordered)BidictBase classes, improve namedbidict validation, docs 2018-02-27 10:29:56 +11:00
jab 423f60e026 improve docs 2018-02-24 20:14:42 +11:00
jab 153ce361b3 tiny cosmetic docs tweaks 2018-02-13 23:13:24 +11:00
jab 24b3d9b7dc various improvements
- 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.
2018-02-13 12:34:33 +11:00
jab b046db134e include usage example in README 2018-02-13 10:51:08 +11:00
jab e3b749358c readme tweaks 2018-01-15 22:02:08 -05:00
jab 1a67961423 flesh out "learning from bidict" outline 2018-01-02 19:24:44 -05:00
jab 6f374c7d3c add "learning from bidict" docs 2018-01-02 15:32:06 -05:00
jab 51c75d2bb0 another round of refinements
- Make OrderedBidict.__eq__ always order-insensitive.
  Add OrderedBidict.equals_order_sensitive for order-sensitive comparison.
  Drop OrderedBidict.ordered_cls and bidict.compat.Reversible.

- Add test coverage for bidict.metadata.

- Use setuptools_scm for automatic version discovery from source control.
  Drop bidict/VERSION file and associated machinery.

- Ditch testing macOS on Travis, it's just too slow.
  Testing on Linux should suffice.

- Ditch using pyenv on Travis to save time and complexity.
  Travis now has a better set of Python versions available out-of-the-box.

- Add support for "python setup.py test" and use that on Travis.
2017-11-20 22:27:27 -05:00
jab 92b3e9c5e8 switch to codecov for automatic combining of coverage reports 2017-11-20 13:28:38 -05:00
jab 64ed7278d8
more API and code improvements
including:
- simplify type hierarchy, merging the frozen types into the base types
- upgrade to latest hypothesis (3.38.0)
- use Reversible for order-sensitive FrozenOrderedBidict.__eq__
- fix bug where bidict._on_dup_kv was not set to ON_DUP_VAL as documented
- drop leading underscore from attrs that should be public
- improve setup.py/metadata
- rename DuplicationBehavior -> DuplicationPolicy
- drop ON_DUP_VAL duplication policy in preference to just using None
- reduce ordered bidict memory usage and speed up copy
2017-11-19 22:24:08 -05:00
jab 4b86b57689 docs tweaks 2017-11-17 23:54:56 -05:00
jab 22f4e78d09
numerous fixes and improvements (#43)
- .travis.yml and setup.py tweaks
- add regression tests for -O bug and document fix
- Make OrderedBidict equality comparison order-sensitive in more cases.
- Add bidict.BidictBase.ordered class attribute.
- Replacing OrderedBidictBase._should_compare_order_sensitive()
  with OrderedBidictBase.should_compare_order_sensitive_to().
- Revert the optimizations in v0.13.0 to make FrozenOrderedBidict instances
  that have the same items in different order have different hash values.
- Remove FrozenBidictBase.
- Remove frozenbidict._USE_ITEMSVIEW_HASH and
  frozenorderedbidict._HASH_NITEMS_MAX
2017-11-17 22:35:40 -05:00
jab 033083ca26
various code and CI improvements + dependency updates (#42) 2017-11-16 15:44:51 -05:00
jab 050e61e0f7 update to latest deps; tests + docs improvements 2017-10-11 10:26:22 -04:00
jab 2a47714a21 docs: factor out versioneye prompt from changelog and include in readme too 2017-03-31 14:58:44 -04:00
jab 4a8e94026f upgrade to latest hypothesis (3.7.0) 2017-03-25 12:34:43 -04:00
jab 76df49a206 docs tweaks 2017-03-17 12:16:45 -04:00
jab 2c7c53d7b4 prepare for 0.13.1 release 2017-03-15 16:43:23 -04:00
jab 9eb335239d update to latest pre-commit, fix typo 2017-01-30 18:06:57 -05:00
jab 803fa3faf1 bump version to 0.13.1.dev0 post release 2017-01-19 00:26:21 -05:00
jab 887e078907 squashed changes for 0.13.0
- support Python 3.6, refactor CI/test setup, increase test coverage
- refactor BidirectionalMapping, BidictBase, OrderedBidictBase,
  FrozenBidictBase, and subclasses
- move frozenorderedbidict into _frozen and looseorderedbidict into _loose
- register bidict as a virtual subclass of MutableMapping rather than
  inheriting from it directly. This makes it clearer that it does not use any
  of the concrete generic methods that MutableMapping provides.
- improve performance and flexibility of frozenbidict and
  frozenorderedbidict hashing
- docs, including new type-hierarchy.png diagram
- rm unused imap, ifilter, izip_longest from compat, add PYPY
- update to latest versions of dependencies
- restore benchmarking on travis
2017-01-09 10:37:31 -05:00
jab b7815c5318 deps, docs linking fixes/improvements, skip benchmarking for now 2016-12-06 18:09:45 -05:00
jab 6c6290a7a9 update to latest pytest (3.0.0) 2016-08-21 22:17:05 -04:00
jab b6a56d794b prepare for 0.12.0 release 2016-07-03 23:52:45 -04:00
jab fec24ddcaf update docs badge to point to master 2016-07-03 17:56:40 -04:00
jab 79228b78e3 squashed changes for 0.12.0 2016-06-28 00:05:23 -04:00
jab b1bff55987 tweak badges (including adding requires.io badge) 2016-01-13 11:52:26 -05:00
jab 2633febeaf adopt open code of conduct 2016-01-11 22:42:39 -05:00
jab c2f975b5ff docs + badges tweaks
- add participation section to intro
- rm paypal, bountysource, and star badges from set of status badges
- docs badge now links to "stable" version
- add contributing to sphinx docs
- add favicon to sphinx docs
- fix logo and gumroad image urls
2015-12-23 12:16:19 -05:00
jab 8acaa62355 fix docs badge 2015-12-20 22:29:25 -05:00
jab 2074f4b0d8 implement stricter 1-to-1 checking + many fixes + improvements
See the changelog for full details.

Closes #21.
2015-12-20 22:05:22 -05:00
jab 20083b0379 tweak contributing docs 2015-11-28 09:30:29 -05:00
jab cc479de4c4 logo, badges, docs, support via gumroad 2015-11-28 08:15:40 -05:00
jab 5f40c86694 py35 2015-09-14 10:11:56 -04:00
jab 34ae95f926 increase test coverage, fix compare to OrderedDict 2015-05-26 12:29:48 -04:00
jab b84561b94c tweak changelog, readme, missing bidicts in stdlib 2015-04-30 14:49:31 -04:00
jab dc56464fd6 docs improvements 2015-04-27 18:20:04 -04:00
jab fe7e7217cb refactor, tests + docs improvements
- break up single bidict.py module into multiple separate modules inside
  "bidict" package
  - new bidict.util and bidict.compat modules
  - move/rename bidict.fancy_iteritems to bidict.util.pairs
  - move bidict.iteritems and bidict.viewitems to bidict.compat
- condense docstrings by moving more documentation into separate sphinx pages
  in "docs" dir and doctests into separate files in new "tests" dir
- initial work on property-based testing using hypothesis
- adopt pytest
- bump to 0.9.0-dev
2015-04-27 11:08:27 -04:00
jab 81e89f54b2 0.3.1 release 2014-10-11 13:08:25 -04:00