Commit Graph

87 Commits

Author SHA1 Message Date
Joshua Bronson b9074f96c7 Use pyproject.toml instead of setup.py, etc.
* 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.
2022-12-03 21:32:49 -05:00
Joshua Bronson 28a3311aed Minor docs improvements 2022-08-23 09:34:50 -04:00
Joshua Bronson e7c73dd1f7 Upgrade dev dependencies, minor fixes+workarounds to docs dependencies 2022-08-06 16:06:00 -04:00
Joshua Bronson ae6ea7d397 Minor docs improvements. 2022-07-21 10:00:53 -04:00
Joshua Bronson 045f8bf4c6 Try scarf.sh Documentation Insights.
Add "bidict-readme" and "bidict-docs" tracking pixels.
2022-06-29 21:59:32 +00:00
Joshua Bronson 3dc702cf7e rm workaround for py3.11-beta2 pytest issue now that beta3 is out 2022-06-03 15:29:19 -04:00
Joshua Bronson 72c65a17ce typo 2022-03-23 11:51:48 -04:00
Joshua Bronson 97ce6a3be5 Minor docs improvements. 2022-03-23 11:15:32 -04:00
Joshua Bronson 3050f9866b Minor docs improvements. 2022-02-27 19:21:03 -05:00
Joshua Bronson e7e456e885 Minor docs improvements 2022-02-16 12:24:19 -05:00
Joshua Bronson 2ab42ade03 Minor improvements, mostly to docs.
- Switch to Furo theme.
- Fix some links reported as broken by Sphinx's `make linkcheck`.
- No longer use autodoc private members. Avoids noisy Sphinx warnings.
- No longer generate duplicate section labels in Changelog.
  Avoids noisy Sphinx warnings.
- Remove logo, codecov badge, and add num-sponsors badge.
- Rename bidict._iter.iteritems_args_kw -> ...iteritems_args
2022-02-10 11:44:57 -05:00
Joshua Bronson 1c9d7bec53 Minor code and docs changes. 2022-02-07 11:42:09 -05:00
Joshua Bronson 1caa13f95c Minor code and docs improvements. 2022-01-03 17:18:24 -05:00
Joshua Bronson 1dfff770ca Upgrade dev dependencies, drop support for py36 2021-12-22 17:22:03 -05:00
Joshua Bronson 0fd39b984b Use white-background logo in README.
Improves visibility when viewed in GitHub with dark mode themes.
2021-07-11 13:01:13 -04:00
Joshua Bronson 801e743b80 Add codespell pre-commit hook + fix typos it found 2021-04-24 13:27:18 -04:00
Joshua Bronson bd4e652ae4 master -> main 2021-03-29 14:05:22 -04:00
Joshua Bronson 32f82e77ce Minor docs improvements 2021-01-10 12:13:28 -05:00
Joshua Bronson 11567533fe Move CI to GitHub Actions, fix version typo in metadata.py 2020-12-20 10:50:41 -05:00
Joshua Bronson 8c161ca64c Improve installation, dev, and release tooling.
* 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.
2020-11-28 10:09:31 -05:00
jab e5c38fde27 Misc. minor improvements to CI, coverage, docs
* 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.
2020-09-07 10:06:49 -04:00
Joshua Bronson 0ad5284f75 Finish first pass at adding type hints.
Fixes #93.
2020-08-12 10:22:25 -04:00
jab c1e297c824 minor improvements to docs, CI, setuptools_scm pin 2020-07-01 09:27:28 -04:00
jab 3af1499708 docs improvements 2020-01-10 22:31:19 -05:00
jab 0ec3b8b3e7 Various API changes and other improvements.
* 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.
2020-01-07 17:20:25 -05:00
jab 0ade432982 Docs improvements (incl. refreshed tag line). 2020-01-01 14:11:48 -05:00
jab 19e92326cb Update help.github.com URL to new 301 redirect. 2019-11-05 19:23:14 -05:00
jab cd73edd854 Remove Python 2 support.
Closes #97.
2019-11-03 21:54:54 -05:00
jab 46beafb51e Bump to Python 3.8 on Travis and 3.7 on AppVeyor (no 3.8 yet), update to latest pylint (2.4.3) + astroid (2.1.0) + associated code style changes to appease them 2019-10-26 11:03:09 -04:00
jab c37db858b9 Warn that PY2 support will be dropped in a future release.
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().
2019-09-08 09:00:51 -04:00
jab b2eca8ebad Docs tweaks
* Fix Tidelift badges. Tidelift broke their URLs:
  https://forum.tidelift.com/t/new-urls-for-project-badges/288

* hack around more Alabaster CSS issues
2019-09-07 20:04:06 -04:00
jab 94d42de53b Fix #94 - buggy unpickling and deepcopying.
Also fix some docs links broken in the previous commit.
2019-09-02 17:07:03 -04:00
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