Also use a new --hypothesis-profile=less-examples by default.
Finally, remove --benchmark-* options from pytest.ini (which disabled
pytest-benchmark anyway) so that pytest-benchmark need not be installed
only to avoid an error that the --benchmark-disable option is
unrecognized.
`typing.TypeAlias` was added in Python 3.10. In Python <= 3.9, using
`typing.TypeAlias` as a type hint confuses mypy.
To avoid this, either `typing_extensions.TypeAlias` must be used, or the
`TypeAlias` type hint may be dropped entirely in favor of relying on
type inference. Based on the current, limited usage of `TypeAlias`,
the latter is preferable.
Run mypy as part of automated tests for every supported Python version
to catch such issues in the future.
...that uses a new cachegrind runner to exercise
tests/microbenchmarks.py in CI and compare against baseline benchmark
results. A run will fail if any benchmark slows down by 10% or more. Add
a 'benchmark' tox environment to facilitate running benchmarks locally.
Also remove use of `@override` to improve performance, and include some
other minor code improvements.
- Use positional-only syntax rather than typing.overload's for various
methods now that 3.7 is no longer supported. This works around
mypyc/mypyc#961 but is also preferable on its own merits.
- Other minor changes to enable `mypyc _base.py` to successfully
compile, such as not assuming `BidictBase.__dict__`.
- Use `typing.override` on 3.12.
- Prefer `alias = t.Tuple[...]` over `alias = 'tuple[...]'`, because
this will allow ruff's pyupgrade rules to automatically rewrite these
to `alias = tuple[...]` once we drop support for 3.8.
- Other minor code, docs, and test improvements.
CI:
- Enable coverage for 3.11 now that we use typing.override on 3.12+ and
use a dummy impl on <3.12.
- Increase max-examples for the "more-examples" hypothesis profile to 999.
With max-examples=500, the latest scheduled test run on GitHub Actions
took under 5 minutes, so we can afford to increase this a lot more.
- Use the "more-examples" profile for all jobs in the test matrix for
scheduled test runs, since we can afford it.
- Fix `bidict(None)` bug (should raise TypeError).
- Simplify hypothesis tests, especially by using stateful testing.
- Add overriding type hints for `inv` for each bidict type
(not just for `inverse`).
- Improve docs and fix readthedocs build as of move to python3.12 for
building docs.
...now that Python 3.7 is no longer supported.
frozenbidict now provides everything that FrozenOrderedBidict provided
(including reversibility) on all supported Python versions, with less
space overhead.
Closes#290.
Also prune very old release notes from the CHANGELOG.
Searching all of GitHub reveals very low usage, and users are better off
just making an instance of an out-of-the-box bidict type and giving it
a good name, as in `element_by_symbol = bidict.bidict({"C": "carbon"})`.
Most notably, __init__, update(), and related methods now handle
SupportsKeysAndGetItem objects that are not mappings the same way that
collections.abc.MutableMapping.update() does.
Also apply changes from pyupgrade.
Python 3.7 reached end of life on 2023-06-27 and is no longer supported
by all of bidict's development dependencies (e.g. hypothesis).
No longer advertise support for 3.7 in the project metadata, and remove
3.7 from the tox test matrix and in CI.
Also switch to using separate requirements files per Python version,
which allows pinning to dependencies' hashes.
Finally, don't bother adding dynamic optional-dependencies to
pyproject.toml, it's causing problems with lockfiles that use hashes.
* Use pytest-sphinx to have pytest run doctests in Sphinx docs rather
than using Sphinx to run these via run_tests.py.
* Sphinx is no longer a test dependency, which allows upgrading to
Sphinx 6.0 while still being able to run the tests with Python 3.7.
(Sphinx 6.0 dropped support for 3.7.)
* Use conftest.py rather than testsetup or doctest_global_setup, which
pytest-sphinx does not currently support.
* Don't use :skipif: in doctest:: directives since pytest-sphinx does
not currently support it (thisch/pytest-sphinx#9). Instead just
don't ever run the one doctest that was using this, since the
behavior it was testing is also covered by several tests in
test_properties.py that do still properly get run conditionally
(specifically, the "freed on zero refcount" tests are still run on
CPython but not PyPy).
* Don't use >>> for code we don't want to test, since pytest-sphinx
will otherwise still run it even if it's in a code-block directive
(and sprinkling `# doctest: SKIP` everywhere as an alternative is
noisy).
* Add pytest-clarity to dev dependencies and pass -vv to pytest by
default to enable pytest-clarity's nicer diffs in development.
* Add type hints to tests and no longer exclude them from type checking.
* Fix the return type hint of bidict.inverted() to return an Iterator
(aliased as ItemsIter), not an Iterable.
* Rename the internal type alias for Iterable[Tuple[KT, VT]] from
IterItems to Items, and likewise MapOrIterItems to MapOrItems.
* 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.
- Ensure that (un)pickling OrderedBidicts is order-preserving.
- Refactor __reduce__, _reduce_factory, and _init_from
to use new private constructor _from_other.
- NamedBidictBase and GeneratedBidictInverse marker classes
don't need to derive from BidictBase.