Commit Graph

92 Commits

Author SHA1 Message Date
jab 5f9cab9acf drop Py3.4 from Travis, update to latest flake8 + pydocstyle, improve lint_src spelling 2019-01-30 23:53:50 -05:00
Jake Waksbaum 638babdde5 Remove hypothesis-pytest dependency
According to https://pypi.org/project/hypothesis-pytest
hypothesis-pytest is deprecated and its functionality is included in
hypothesis.
2019-01-18 18:59:27 -05:00
jab 40378027bb update to pytest 4.1 and pytest-benchmark 3.2.0 which now supports it 2019-01-07 22:24:14 -05:00
jab 2e4a9be91c pin to pytest < 4.1 pending ionelmc/pytest-benchmark#124 2019-01-06 20:19:55 -05:00
jab ba1cba8523 happy 2019 2019-01-01 13:51:46 -05:00
jab c119d0b081 update to latest pylint and pre-commit hooks, rename + improve run_tests.py script 2018-12-27 21:27:57 -05:00
jab 6ec9a4a2e2 add comment explaining pylint<2.2 pin 2018-12-11 13:21:18 -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 1f5a66c355 improvements to pyproject.toml changes 2018-09-17 19:23:46 -04:00
Bernat Gabor 0d0c91fc75
use pyproject.toml to specify build dependencies 2018-09-14 20:56:28 +01:00
jab 764310e2fe small improvements to supporting files 2018-08-13 13:57:07 -04:00
jab a7bc83f05a pin to latest pylint 2018-08-01 21:13:43 -04:00
jab e2e55c1b50 appease pylint 2018-07-20 07:57:29 -04:00
jab 20e1c18af1 update to latest pylint (2.0.0) and appease it 2018-07-16 20:26:36 -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 1a8e11f163 strengthen too-weak assume(..) in test_eq_ne_hash, use "max_examples=5000" for nightly CI jobs, add .readthedocs.yml
The `assume(init_items != init_unequal)` was not sufficient
because it would allow cases like:

    bi_cls=bidict, other_cls=bidict, init_items=[(1, 0), (0, 1)], init_unequal=[(0, 1), (1, 0)]

causing the resulting bidicts' item sets to still be equal,
so assertions like

    assert items_match(some_bidict, other_unequal, relation=ne)

would fail.

Changing the assume to

    assume(set(init_items) != set(init_unequal))

fixes the issue.

Surprisingly, hypothesis only just found a failing example for this
for the first time (in https://travis-ci.org/jab/bidict/jobs/363962257)
despite having numerous opportunities to find it before.
Using a new max_examples=5000 hypothesis profile, only on nightly CI,
should help surface any remaining issues that hypothesis hasn't found yet,
without slowing commit-triggered tests with too much example generation.

Also improve Travis config:
- ditch ALLOW_FAIL=1, for some reason it didn't work
- comment out python 3.7-dev job while Travis is stuck on an old 3.7 alpha
- don't use "- |" command block where we want to see output after each command
- prefix more network-dependent commands with travis_retry

Finally, improve docs building setup:
- Factor out sphinx from "dev" extras_require to its own "docs" extras_require.
- Add a .readthedocs.yml to customize the readthedocs build.
  Use pip and the "docs" extras_require to get an up-to-date Sphinx version.
  Fixes some broken :ref:`addendum:...`  autosectionlabel links in learning-from-bidict.
2018-04-10 11:31:29 +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 aa704b3d6e improve hypothesis tests, use of setuptools_scm and linting 2018-02-26 10:44:21 +11:00
jab d0c6fdae3b happy 2018 2017-12-31 22:51:19 -05:00
jab 7fbc19090a appease latest pylint 2017-12-17 13:22:42 -05:00
jab c7002bf2b2 unbreak logo image in long_description for PyPI 2017-12-06 14:56:35 -05:00
jab 20376edfbf update dep specs to use >=curr,<next_major
this also updates to latest hypothesis (3.38.4)
2017-11-22 09:48:40 -05:00
jab 7f1653bb5b update to latest hypothesis (3.38.3) 2017-11-21 12:32:30 -05:00
jab 7b4d1df5fb Add pre-commit hooks + changes to appease them 2017-11-21 10:35:56 -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 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 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 e2acff57f6 update to latest hypothesis (3.17.0) and flake8 (3.4.1)
also enable pypy3 in tox.ini
2017-08-12 11:48:17 -04:00
jab 15d123df91 update to latest pytest (3.2.0) 2017-08-12 09:59:07 -04:00
jab 72b0928952 update to latest hypothesis (3.12.0) 2017-07-08 23:05:35 -04:00
jab ab3738ddd8 update to latest pytest (3.1.3), sphinx, and pre-commit 2017-07-05 12:22:04 -04:00
jab dd0b434b84 update to latest hypothesis (3.11.6) 2017-06-29 10:00:30 -04:00
jab bd1f840ae5 update to latest hypothesis (3.11.4) 2017-06-18 12:42:11 -04:00
jab bcac254ec1 update to latest pytest (3.1.2) and py (1.4.34) 2017-06-12 11:11:38 -04:00
jab 99cff11b2c update to latest hypothesis (3.11.3) 2017-06-12 11:06:09 -04:00
jab cbf19acb1e update to latest pytest (3.1.1) 2017-06-03 18:49:48 -04:00
jab d8f6f9a458 update to latest hypothesis (3.11.0) and pytest (3.1.0) 2017-05-25 14:59:26 -04:00
jab 8318d28586 update to latest coverage, sphinx, and pre-commit 2017-05-21 15:08:22 -04:00
jab d7d6e40879 update to latest hypothesis (3.9.0) and pytest-cov (2.5.1) 2017-05-21 14:10:01 -04:00
jab e87a6c31c3 update deps, --cov-branch 2017-05-10 14:35:23 -04:00
jab 86dfe1bb67 update to latest tox (2.7.0) 2017-04-08 16:39:06 -04:00
jab 05f3224782 update to latest coverage (4.4b1) 2017-04-05 18:54:02 -04:00
jab 577458dcf0 update to latest sphinx (1.5.5) 2017-04-04 17:14:44 -04:00
jab ab657f9353 update to latest pytest-benchmark and pre-commit 2017-03-28 13:53: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 19f7e9f90a change license to MPLv2 2017-03-15 16:43:05 -04:00