Commit 0812cb5e authored by William Grzybowski's avatar William Grzybowski

New upstream version 0.18.0

parents
Copyright 2018 Joshua Bronson. All Rights Reserved.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
skip_tags: true
os: "Visual Studio 2017"
environment:
matrix:
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python36-x64"
build_script:
- "git --no-pager log -n2"
- "echo %APPVEYOR_REPO_COMMIT%"
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;;%PATH%"
- "python --version"
- "pip install -e .[test]"
test_script:
- "python run_tests.py"
[run]
branch=True
source=bidict
omit=
setup.py
[report]
precision = 1
exclude_lines =
pragma: no cover
return NotImplemented
# http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
[*.yml]
indent_size = 2
.benchmarks
.cache
.coverage
.hypothesis
.tox
bidict/_version.py
coverage.xml
htmlcov
queries:
- exclude: py/missing-equals
- exclude: py/conflicting-attributes
- exclude: py/unused-import
- exclude: py/import-and-import-from
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.1.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
- id: double-quote-string-fixer
# This stopped working so comment out for now (started applying to files that didn't need it):
# - id: fix-encoding-pragma
- id: check-yaml
# Keep in sync with flake8 version in setup.py and .travis.yml --
# check https://github.com/pre-commit/pre-commit-hooks/blob/master/setup.py
# for the version of flake8 that is included with this pre-commit repo.
- id: flake8
exclude: docs/conf.py
- repo: https://github.com/chewse/pre-commit-mirrors-pydocstyle
# Keep in sync with pydocstyle version in setup.py and .travis.yml
rev: v2.1.1
hooks:
- id: pydocstyle
exclude: bidict/_version.py
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.6
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: forbid-tabs
- id: remove-tabs
# This stopped working so comment out for now (started applying to files that didn't need it):
# - id: insert-license
# files: \.py$
# args:
# # Renamed LICENSE_HEADER -> .LICENSE_HEADER to avoid confusing licensee
# # (https://github.com/benbalter/licensee - what GitHub uses to detect license)
# - --license-filepath=.LICENSE_HEADER
- repo: https://github.com/pre-commit/mirrors-pylint
# Keep in sync with pylint version in setup.py and .travis.yml
rev: v2.2.2
hooks:
- id: pylint
# Needed to avoid ImportErrors when linting tests (keep in sync with versions in setup.py):
additional_dependencies: ["hypothesis<4","pytest<5", "sphinx<2"]
args:
# http://pylint.pycqa.org/en/latest/user_guide/run.html#parallel-execution
# > If the provided number is 0, then the total number of CPUs will be used.
- --jobs=0
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 1.10.2
hooks:
- id: shellcheck
- id: shfmt
# https://docs.pylint.org/en/latest/technical_reference/features.html
[MESSAGES CONTROL]
disable =
# Must inherit from object for Python 2 compatibility.
useless-object-inheritance,
# repeated-keyword check is buggy:
# https://github.com/PyCQA/pylint/issues/1843#issuecomment-419746286
repeated-keyword,
# bidict/_version.py is generated by setuptools_scm
ignore = _version.py
# Maximum number of parents for a class.
# The default of 7 results in "too-many-ancestors" for all bidict classes.
max-parents = 13
# Maximum number of arguments for a function.
# The default of 5 only leaves room for 4 args besides self for methods.
max-args=6
# http://docs.readthedocs.io/en/latest/yaml-config.html#requirements-file
# Don't build any extra formats
formats:
- none
build:
image: latest
python:
version: 3.6
pip_install: true
extra_requirements:
- docs
language: 'python'
# Default version used for jobs that don't override it.
python: '3.7'
# TODO: Update to 'bionic' once available.
# https://travis-ci.community/t/ubuntu-18-04-1-lts-bionic-beaver/1270
dist: 'xenial'
before_install: # Ensure we have the required versions of Python and Pip.
- 'echo "TRAVIS_PULL_REQUEST_SHA: $TRAVIS_PULL_REQUEST_SHA"'
- 'echo "TRAVIS_COMMIT: $TRAVIS_COMMIT"'
- 'git --no-pager log -n2'
# Travis does a shallow (--depth=50) clone by default.
# Clone the full history as requested by setuptools_scm.
- 'travis_retry git fetch --unshallow'
# Install Python on macOS since https://github.com/travis-ci/travis-ci/issues/2312 is WONTFIXed.
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
declare -r pyver="${TASK##*-}" # strip all chars up to and including the last -
declare -r python="python$pyver"
echo "TASK=$TASK -> pyver=$pyver python=$python"
if ! type "$python"; then
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap minrk/homebrew-python-frameworks
brew cask install "python-framework-${pyver/./}"
type "$python" || exit 1
fi
type python
"$python" --version
travis_retry curl https://bootstrap.pypa.io/get-pip.py | "$python"
"$python" -m pip install virtualenv
"$python" -m virtualenv ~/travis-env
source ~/travis-env/bin/activate
type python
fi
- 'python --version'
# https://github.com/python-trio/trio/issues/487#issuecomment-377931587
- 'echo "Installing latest pip..."'
- 'travis_retry curl https://bootstrap.pypa.io/get-pip.py | python'
- 'pip --version'
install: # Install our test dependencies.
- 'travis_retry pip install -U --upgrade-strategy=eager .[test$([[ "$COVERAGE" ]] && echo ",coverage")]'
before_script:
- 'pip list'
- |
if [[ "$TASK" == lint-* ]]; then
shopt -s globstar
export LINT_SRC=**/*.py
echo "LINT_SRC:" $LINT_SRC
fi
script: # Run the test suite.
# See tests/hypothesis/_setup_hypothesis.py
- 'export HYPOTHESIS_PROFILE=$([[ "$TRAVIS_EVENT_TYPE" == cron ]] && echo more-examples)'
- 'export PYTEST_ADDOPTS=$([[ "$COVERAGE" ]] && echo "--cov=bidict --cov-config=.coveragerc")'
- './run_tests.py'
after_script:
- |
if [[ "$COVERAGE" ]]; then
echo "Installing codecov..."
travis_retry pip install codecov || exit 1
echo
echo "Uploading coverage report to codecov..."
travis_retry codecov
fi
matrix:
allow_failures:
- env: 'ALLOW_FAIL=1'
fast_finish: true
include:
# Each job below performs a single task. Setting a per-job "TASK" env var
# causes Travis to clearly show each job's task in the web UI.
# "test*" tasks run the test suite with various Python versions.
# Travis runs jobs in the order defined below -> order jobs by priority.
## Test suite on Linux with latest CPython and PyPy 2 and 3 -> enable coverage.
- python: '3.7'
env: 'TASK=test-linux-cpython-3.7 COVERAGE=1'
- python: '2.7'
env: 'TASK=test-linux-cpython-2.7 COVERAGE=1'
- python: 'pypy3.5-6.0'
env: 'TASK=test-linux-pypy-3.5-6.0 COVERAGE=1'
- python: 'pypy2.7-6.0'
env: 'TASK=test-linux-pypy-2.7-6.0 COVERAGE=1'
## Test suite on Mac with latest CPython 2 and 3.
- python: '2.7'
env: 'TASK=test-mac-cpython-2.7'
os: 'osx'
language: 'generic'
- python: '3.7'
env: 'TASK=test-mac-cpython-3.7'
os: 'osx'
language: 'generic'
## Linting, static analysis, code style.
- env: 'TASK=lint-flake8'
before_install: 'skip'
install: 'travis_retry pip install "flake8<3.8"' # keep in sync with the version in setup.py
script: 'flake8 $LINT_SRC'
- env: 'TASK=lint-pylint'
before_install: 'skip'
install: 'travis_retry pip install "pylint<2.3" "hypothesis<4" "pytest<5" "Sphinx<2"' # keep in sync with the versions in setup.py
script: 'pylint --jobs=0 $LINT_SRC'
- env: 'TASK=lint-pydocstyle'
before_install: 'skip'
install: 'travis_retry pip install "pydocstyle<3.1"' # keep in sync with the version in setup.py
script: 'pydocstyle $LINT_SRC'
## Misc.
- env: 'TASK=docs-build'
before_install: 'skip'
install: 'travis_retry pip install "Sphinx<2"' # keep in sync with the version in setup.py
script: './build-docs.sh'
- env: 'TASK=test-with-optimization-flag' # make sure there are no relied-on side effects in assert statements
before_install: 'skip'
install: 'skip'
script: 'python -O -m doctest -o IGNORE_EXCEPTION_DETAIL -o ELLIPSIS tests/*.txt'
## Remaining CPython versions on Linux.
- python: '3.6'
env: 'TASK=test-linux-cpython-3.6'
- python: '3.5'
env: 'TASK=test-linux-cpython-3.5'
## Misc.
- env: 'TASK=docs-linkcheck ALLOW_FAIL=1'
before_install: 'skip'
install: 'travis_retry pip install "Sphinx<2"' # keep in sync with the version in setup.py
script: '(cd docs && travis_retry make linkcheck)'
- python: '3.8-dev'
env: 'TASK=test-linux-cpython-3.8-dev ALLOW_FAIL=1'
- stage: 'deploy-if-tag'
env: 'TASK=deploy-if-tag ALLOW_FAIL=1'
before_install: 'skip'
install: 'skip'
script: 'skip'
deploy:
- provider: 'pypi'
user: 'jab'
password:
secure: 'B9LLgXkTbtjeC/IbH4wh9PEBzvKEAuYo3EBNW5f1xuLqVqtsysIyxJa5ar/FQ4qwUCBwZPFAXFurN3lLzRhb2Tc04YQ0GYVv6f8lkzwrjoWau4iB9Qt/nnvdRa7KryEJvtenHCAnwoEUaADCjkZjwo6fIA0hEOLB6/AYfhfgXYA='
on:
tags: true
# Does this deploy all tags to PyPI, not just release tags?
# https://docs.travis-ci.com/user/deployment/pypi/ doesn't say.
distributions: 'sdist bdist_wheel'
before_cache:
- 'rm -rf "$HOME"/.cache/pip/log'
cache:
directories:
- '"$HOME"/.cache/pip'
- '"$HOME"/.hypothesis'
notifications:
webhooks:
urls:
- 'https://webhooks.gitter.im/e/bf64fb45a633c0935b9b'
email:
recipients: 'jab@math.brown.edu'
This diff is collapsed.
Code of Conduct
===============
Our Pledge
----------
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our
project and our community a harassment-free experience for everyone,
regardless of age, body size, disability, ethnicity, gender identity and
expression, level of experience, nationality, personal appearance, race,
religion, or sexual identity and orientation.
Our Standards
-------------
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual
attention or advances
- Trolling, insulting/derogatory comments, and personal or political
attacks
- Public or private harassment
- Publishing others' private information, such as a physical or
electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
Our Responsibilities
--------------------
Project maintainers are responsible for clarifying the standards of
acceptable behavior and are expected to take appropriate and fair
corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit,
or reject comments, commits, code, wiki edits, issues, and other
contributions that are not aligned to this Code of Conduct, or to ban
temporarily or permanently any contributor for other behaviors that they
deem inappropriate, threatening, offensive, or harmful.
Scope
-----
This Code of Conduct applies both within project spaces and in public
spaces when an individual is representing the project or its community.
Examples of representing a project or community include using an
official project e-mail address, posting via an official social media
account, or acting as an appointed representative at an online or
offline event. Representation of a project may be further defined and
clarified by project maintainers.
Enforcement
-----------
Instances of abusive, harassing, or otherwise unacceptable behavior may
be reported by contacting the project team at <jab@math.brown.edu>. All
complaints will be reviewed and investigated and will result in a
response that is deemed necessary and appropriate to the circumstances.
The project team is obligated to maintain confidentiality with regard to
the reporter of an incident. Further details of specific enforcement
policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in
good faith may face temporary or permanent repercussions as determined
by other members of the project's leadership.
Attribution
-----------
This Code of Conduct is adapted from the `Contributor
Covenant <https://www.contributor-covenant.org>`__, version 1.4, available at
`https://www.contributor-covenant.org/version/1/4 <https://www.contributor-covenant.org/version/1/4/>`__.
.. Forward declarations for all the custom interpreted text roles that
Sphinx defines and that are used below. This helps Sphinx-unaware tools
(e.g. rst2html, PyPI's and GitHub's renderers, etc.).
.. role:: doc
.. role:: ref
Contributors' Guide
===================
Bug reports, feature requests, patches, and other contributions are warmly welcomed.
Contribution should be as easy and friendly as possible.
Below are a few guidelines contributors should follow to facilitate the process.
Getting Started
---------------
- `Create a GitHub account <https://github.com/join>`__ if you don't have one
already.
- Search through the `issue tracker <https://github.com/jab/bidict/issues>`__
to see if an issue or pull request has already been created for what you're interested in.
If so, feel free to add comments to it or just hit the "subscribe" button to follow progress.
If not, you can `join the chat room <https://gitter.im/jab/bidict>`__ to discuss there,
or go ahead and `create a new issue <https://github.com/jab/bidict/issues/new>`__:
- Clearly describe the issue giving as much relevant context as possible.
- If it is a bug, include reproduction steps,
all known environments in which the bug is exhibited,
and ideally a failing test case.
- If you would like to contribute a patch,
make sure you've `created your own fork <https://github.com/jab/bidict/fork>`__
and have cloned it to your computer.
Making Changes
--------------
- Before making changes, please install the extra packages required for development:
``pip install -e .[dev]``
We use `EditorConfig <https://editorconfig.org/>`__
and `pre-commit <https://pre-commit.com/>`__
to help achieve uniform style and quality standards
across a diversity of development environments.
pre-commit gets installed when you run ``pip install -e .[dev]``
and ensures that various code checks are run before every commit
(look in ``.pre-commit-config.yaml`` to see which hooks are run).
EditorConfig allows us to provide a single ``.editorconfig`` file
to configure settings like indentation consistently
across a variety of suppored editors.
See https://editorconfig.org/#download to install the plugin for your editor.
- Create a topic branch off of master for your changes:
``git checkout -b <topic> master``
- Make commits of logical units.
- Match the existing code style and quality standards.
If you're adding a feature, include accompanying tests and documentation
demonstrating its correctness and usage.
- Run the tests locally with `tox <https://tox.readthedocs.io>`__
to make sure they pass for all supported Python versions
(see ``envlist`` in ``tox.ini`` for the complete list).
If you do not have all the referenced Python versions available locally,
you can also push the changes on your branch to GitHub
to automatically trigger a new `Travis-CI <https://travis-ci.org>`__ build,
which should run the tests for all supported Python versions.
You should be able to see the results at ``travis-ci.org/<user>/bidict``,
where ``<user>`` is the GitHub username you used to fork bidict.
- Create a concise but comprehensive commit message in the following style::
Include an example commit message in CONTRIBUTING guide #9999
Without this patch the CONTRIBUTING guide would contain no examples of
a model commit message. This is a problem because the contributor is left
to imagine what the commit message should look like and may not get it
right. This patch fixes the problem by providing a concrete example.
The first line is an imperative statement summarizing the changes with an
issue number from the tracker. The body describes the behavior without
the patch, why it's a problem, and how the patch fixes the problem.
Submitting Changes
------------------
- Push your changes to a topic branch in your fork of the repository:
``git push --set-upstream origin <topic>``
- Submit a pull request providing any additional relevant details necessary.
- Acknowledgment should typically be fast
but please allow 1-2 weeks for a full response / code review.
- The code review process often involves some back-and-forth
to get everything right before merging.
This is typical of quality software projects that accept patches.
- All communication should be supportive and appreciative of good faith efforts to contribute,
creating a welcoming and inclusive community.
Expect nothing less of any project.
Other Ways to Contribute
------------------------
.. image:: https://img.shields.io/badge/Gumroad-Chip%20in-orange.svg
:target: https://gumroad.com/l/bidict
:alt: Chip in via Gumroad
.. image:: https://img.shields.io/badge/Bountysource-Chip%20in-brightgreen.svg
:target: https://www.bountysource.com/teams/bidict
:alt: Chip in via Bountysource
.. image:: https://img.shields.io/badge/PayPal-Chip%20in-blue.svg
:target: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=jab%40math%2ebrown%2eedu&lc=US&item_name=Support%20bidict&button_subtype=services&currency_code=USD&bn=PP%2dBuyNowBF%3aPaypal%2dBuy%2520a%2520Drink%2dblue%2esvg%3aNonHosted
:alt: Chip in via PayPal
.. duplicated in README.rst
(would use `.. include::` but GitHub doesn't understand it)
Bidict is the product of hundreds of hours of unpaid, voluntary work.
If bidict has helped you accomplish your work,
especially work you've been paid for,
please consider chipping in toward the costs
of bidict's maintenance and development
and/or ask your organization to do the same.
Any amount contributed is gratefully received.
Besides chipping in financially,
filing issues,
and submitting pull requests,
there are other ways to contribute.
- If you read the code and learned something new,
please :ref:`let me know <home:Notice of Usage>` [#fn-let-me-know]_.
- If you're using bidict in a project you work on,
please post about your experience and send me a link.
- If you come across other people who could find bidict useful,
please spread the word.
**Please support bidict:**
.. image:: https://raw.githubusercontent.com/jab/bidict/master/assets/support-on-gumroad.png
:target: https://gumroad.com/l/bidict
:alt: Support bidict
Code of Conduct
---------------
All participation in this project should respect the
:doc:`code-of-conduct`. [#fn-coc]_
By participating, you are expected to honor this code.
.. [#fn-let-me-know] `<https://bidict.readthedocs.io/#notice-of-usage>`__
.. [#fn-coc] `<CODE_OF_CONDUCT.rst>`_ | `<https://bidict.readthedocs.io/code-of-conduct.html>`__
This diff is collapsed.
# Tip: pip install check-manifest && check-manifest -uv
include LICENSE
include pyproject.toml
include *.rst
include *.sh
include *.yaml
include *.yml
include .editorconfig
include .pylintrc
include .LICENSE_HEADER
include .coveragerc
include pytest.ini
include tox.ini
include docs/_static/custom.css
include docs/_static/bidict-types-diagram.dot
recursive-include docs *.py
recursive-include docs *.rst
recursive-include docs Makefile
recursive-include docs/_static *.png
recursive-include tests *.py
recursive-include tests *.txt
This diff is collapsed.
Retrieving PyPI Download Stats
------------------------------
As of May 2016,
PyPI download stats are now available from BigQuery at:
https://bigquery.cloud.google.com/table/the-psf:pypi.downloads
Here is an example query for number of downloads in the last 30 days:
.. code:: sql
SELECT
DATE(timestamp) as day,
file.project,
file.version,
COUNT(*) as total_downloads,
FROM
TABLE_DATE_RANGE(
[the-psf:pypi.downloads],
DATE_ADD(CURRENT_TIMESTAMP(), -1, 'month'),
CURRENT_TIMESTAMP()
)
WHERE
file.project = 'bidict'
GROUP BY
day, file.project, file.version
ORDER BY
day asc
LIMIT
99999999
.. Forward declarations for all the custom interpreted text roles that
Sphinx defines and that are used below. This helps Sphinx-unaware tools
(e.g. rst2html, PyPI's and GitHub's renderers, etc.).
.. role:: doc
bidict
======
Efficient, Pythonic bidirectional map implementation and related functionality.
.. image:: https://raw.githubusercontent.com/jab/bidict/master/assets/logo-sm.png
:target: https://bidict.readthedocs.io/
:alt: bidict logo
Status
------
.. image:: https://img.shields.io/pypi/v/bidict.svg
:target: https://pypi.org/project/bidict
:alt: Latest release
.. image:: https://img.shields.io/readthedocs/bidict/master.svg
:target: https://bidict.readthedocs.io/en/master/
:alt: Documentation
.. image:: https://api.travis-ci.org/jab/bidict.svg?branch=master
:target: https://travis-ci.org/jab/bidict
:alt: Travis-CI build status
.. image:: https://codecov.io/gh/jab/bidict/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jab/bidict
:alt: Test coverage
.. image:: https://img.shields.io/lgtm/alerts/g/jab/bidict.svg
:target: https://lgtm.com/projects/g/jab/bidict/
:alt: LGTM alerts
.. image:: https://api.codacy.com/project/badge/Grade/6628756a73254cd895656348236833b8
:target: https://www.codacy.com/app/jab/bidict
:alt: Codacy grade
.. image:: https://bestpractices.coreinfrastructure.org/projects/2354/badge
:target: https://bestpractices.coreinfrastructure.org/en/projects/2354
:alt: CII best practices badge
.. image:: https://tidelift.com/badges/github/jab/bidict
:target: https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=docs
:alt: Tidelift dependency badge
.. Hide to reduce clutter
.. image:: https://ci.appveyor.com/api/projects/status/gk133415udncwto3/branch/master?svg=true
:target: https://ci.appveyor.com/project/jab/bidict
:alt: AppVeyor (Windows) build status
.. image:: https://img.shields.io/pypi/pyversions/bidict.svg
:target: https://pypi.org/project/bidict
:alt: Supported Python versions
.. image:: https://img.shields.io/pypi/implementation/bidict.svg
:target: https://pypi.org/project/bidict
:alt: Supported Python implementations
.. image:: https://img.shields.io/pypi/l/bidict.svg
:target: https://raw.githubusercontent.com/jab/bidict/master/LICENSE
:alt: License
.. image:: https://img.shields.io/badge/dynamic/json.svg?label=downloads&url=https%3A%2F%2Fpypistats.org%2Fapi%2Fpackages%2Fbidict%2Frecent%3Fperiod%3Dmonth&query=%24.data.last_month&colorB=blue&suffix=%2fmonth
:target: https://pypistats.org/packages/bidict
:alt: Downloads past month
Bidict:
^^^^^^^
- is in use by several teams at Google, Venmo, CERN, Bank of America Merrill Lynch,