2018-04-19 08:22:07 +00:00
|
|
|
.. role:: doc
|
2022-12-04 02:32:49 +00:00
|
|
|
.. (Forward declaration for the "doc" role that Sphinx defines for interop with renderers that
|
|
|
|
are often used to show this doc and that are unaware of Sphinx (GitHub.com, PyPI.org, etc.).
|
|
|
|
Use :doc: rather than :ref: here for better interop as well.)
|
2018-04-19 08:22:07 +00:00
|
|
|
|
2020-01-11 03:31:17 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
bidict
|
|
|
|
======
|
2017-10-11 14:26:20 +00:00
|
|
|
|
2022-03-23 15:15:32 +00:00
|
|
|
*The bidirectional mapping library for Python.*
|
2015-03-22 18:21:15 +00:00
|
|
|
|
2015-11-28 13:15:39 +00:00
|
|
|
|
2015-03-22 18:21:15 +00:00
|
|
|
Status
|
|
|
|
------
|
|
|
|
|
2017-11-18 03:35:40 +00:00
|
|
|
.. image:: https://img.shields.io/pypi/v/bidict.svg
|
2018-04-19 08:22:07 +00:00
|
|
|
:target: https://pypi.org/project/bidict
|
2018-04-06 04:28:44 +00:00
|
|
|
:alt: Latest release
|
2015-03-22 18:21:15 +00:00
|
|
|
|
2021-03-29 18:01:14 +00:00
|
|
|
.. image:: https://img.shields.io/readthedocs/bidict/main.svg
|
|
|
|
:target: https://bidict.readthedocs.io/en/main/
|
2018-04-06 04:28:44 +00:00
|
|
|
:alt: Documentation
|
2015-03-22 18:21:15 +00:00
|
|
|
|
2024-02-14 22:26:41 +00:00
|
|
|
.. image:: https://github.com/jab/bidict/actions/workflows/test.yml/badge.svg
|
2023-10-14 17:08:20 +00:00
|
|
|
:target: https://github.com/jab/bidict/actions/workflows/test.yml?query=branch%3Amain
|
2020-12-20 15:40:40 +00:00
|
|
|
:alt: GitHub Actions CI status
|
2017-11-16 20:44:51 +00:00
|
|
|
|
2015-04-27 22:20:03 +00:00
|
|
|
.. image:: https://img.shields.io/pypi/l/bidict.svg
|
2021-03-29 18:01:14 +00:00
|
|
|
:target: https://raw.githubusercontent.com/jab/bidict/main/LICENSE
|
2018-04-06 04:28:44 +00:00
|
|
|
:alt: License
|
2015-03-22 18:21:15 +00:00
|
|
|
|
2020-08-01 18:26:08 +00:00
|
|
|
.. image:: https://static.pepy.tech/badge/bidict
|
|
|
|
:target: https://pepy.tech/project/bidict
|
|
|
|
:alt: PyPI Downloads
|
2018-08-15 01:44:39 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
.. image:: https://img.shields.io/badge/GitHub-sponsor-ff69b4
|
2022-02-10 16:44:56 +00:00
|
|
|
:target: https://github.com/sponsors/jab
|
2023-10-14 17:08:20 +00:00
|
|
|
:alt: Sponsor
|
2017-10-11 14:26:20 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
|
2022-03-23 15:15:32 +00:00
|
|
|
Features
|
|
|
|
--------
|
2017-10-11 14:26:20 +00:00
|
|
|
|
2024-01-14 03:06:15 +00:00
|
|
|
- Mature: Depended on by
|
2022-03-23 15:15:32 +00:00
|
|
|
Google, Venmo, CERN, Baidu, Tencent,
|
|
|
|
and teams across the world since 2009
|
2022-02-16 17:24:19 +00:00
|
|
|
|
2022-03-23 15:15:32 +00:00
|
|
|
- Familiar, Pythonic APIs
|
|
|
|
that are carefully designed for
|
|
|
|
safety, simplicity, flexibility, and ergonomics
|
2022-02-16 17:24:19 +00:00
|
|
|
|
2022-03-23 15:15:32 +00:00
|
|
|
- Lightweight, with no runtime dependencies
|
|
|
|
outside Python's standard library
|
2022-02-16 17:24:19 +00:00
|
|
|
|
2022-03-23 15:15:32 +00:00
|
|
|
- Implemented in
|
|
|
|
concise, well-factored, fully type-hinted Python code
|
|
|
|
that is optimized for running efficiently
|
|
|
|
as well as for long-term maintenance and stability
|
2023-10-14 17:08:20 +00:00
|
|
|
(as well as `joy <#learning-from-bidict>`__)
|
2022-03-23 15:15:32 +00:00
|
|
|
|
2022-03-23 15:51:48 +00:00
|
|
|
- Extensively `documented <https://bidict.readthedocs.io>`__
|
2022-03-23 15:15:32 +00:00
|
|
|
|
|
|
|
- 100% test coverage
|
|
|
|
running continuously across all supported Python versions
|
2024-01-14 03:06:15 +00:00
|
|
|
(including property-based tests and benchmarks)
|
2018-01-02 20:32:06 +00:00
|
|
|
|
2020-01-01 19:11:46 +00:00
|
|
|
|
2018-02-12 23:51:08 +00:00
|
|
|
Installation
|
|
|
|
------------
|
|
|
|
|
|
|
|
``pip install bidict``
|
|
|
|
|
|
|
|
|
2018-02-13 12:13:24 +00:00
|
|
|
Quick Start
|
2018-02-12 23:51:08 +00:00
|
|
|
-----------
|
|
|
|
|
2018-04-06 04:28:44 +00:00
|
|
|
.. code:: python
|
|
|
|
|
|
|
|
>>> from bidict import bidict
|
|
|
|
>>> element_by_symbol = bidict({'H': 'hydrogen'})
|
|
|
|
>>> element_by_symbol['H']
|
|
|
|
'hydrogen'
|
2019-02-12 03:46:19 +00:00
|
|
|
>>> element_by_symbol.inverse['hydrogen']
|
2018-04-06 04:28:44 +00:00
|
|
|
'H'
|
2018-02-12 23:51:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
For more usage documentation,
|
|
|
|
head to the :doc:`intro` [#fn-intro]_
|
|
|
|
and proceed from there.
|
|
|
|
|
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
Enterprise Support
|
|
|
|
------------------
|
2017-11-18 04:54:53 +00:00
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
Enterprise-level support for bidict can be obtained via the
|
|
|
|
`Tidelift subscription <https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=readme>`__
|
|
|
|
or by `contacting me directly <mailto:jabronson@gmail.com>`__.
|
2017-11-18 04:54:53 +00:00
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
I have a US-based LLC set up for invoicing,
|
|
|
|
and I have 15+ years of professional experience
|
|
|
|
delivering software and support to companies successfully.
|
2017-03-17 16:16:45 +00:00
|
|
|
|
2024-01-25 20:46:44 +00:00
|
|
|
You can also sponsor my work through several platforms, including GitHub Sponsors.
|
2022-02-07 16:42:09 +00:00
|
|
|
See the `Sponsoring <#sponsoring>`__ section below for details,
|
|
|
|
including rationale and examples of companies
|
|
|
|
supporting the open source projects they depend on.
|
2016-06-28 04:05:22 +00:00
|
|
|
|
2018-10-17 15:16:43 +00:00
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
Voluntary Community Support
|
|
|
|
---------------------------
|
2018-10-17 15:16:43 +00:00
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
Please search through already-asked questions and answers
|
|
|
|
in `GitHub Discussions <https://github.com/jab/bidict/discussions>`__
|
|
|
|
and the `issue tracker <https://github.com/jab/bidict/issues?q=is%3Aissue>`__
|
|
|
|
in case your question has already been addressed.
|
|
|
|
|
|
|
|
Otherwise, please feel free to
|
2022-02-10 16:44:56 +00:00
|
|
|
`start a new discussion <https://github.com/jab/bidict/discussions>`__
|
2024-02-17 00:48:57 +00:00
|
|
|
or `create a new issue <https://github.com/jab/bidict/issues/new>`__ on GitHub
|
2022-01-03 22:18:24 +00:00
|
|
|
for voluntary community support.
|
2018-10-17 15:16:43 +00:00
|
|
|
|
|
|
|
|
2017-11-18 04:54:53 +00:00
|
|
|
Notice of Usage
|
|
|
|
---------------
|
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
If you use bidict,
|
2018-02-24 09:14:42 +00:00
|
|
|
and especially if your usage or your organization is significant in some way,
|
2021-01-10 17:13:26 +00:00
|
|
|
please let me know in any of the following ways:
|
2018-02-24 09:14:42 +00:00
|
|
|
|
2020-01-01 19:11:46 +00:00
|
|
|
- `star bidict on GitHub <https://github.com/jab/bidict>`__
|
2022-02-10 16:44:56 +00:00
|
|
|
- post in `GitHub Discussions <https://github.com/jab/bidict/discussions>`__
|
2022-01-03 22:18:24 +00:00
|
|
|
- `email me <mailto:jabronson@gmail.com>`__
|
2017-11-18 04:54:53 +00:00
|
|
|
|
|
|
|
|
2017-11-16 20:44:51 +00:00
|
|
|
Changelog
|
|
|
|
---------
|
|
|
|
|
2022-07-16 15:16:00 +00:00
|
|
|
For bidict release notes, see the :doc:`changelog`. [#fn-changelog]_
|
2017-11-16 20:44:51 +00:00
|
|
|
|
|
|
|
|
2017-03-31 18:58:44 +00:00
|
|
|
Release Notifications
|
2017-11-16 20:44:51 +00:00
|
|
|
---------------------
|
2017-03-31 18:58:44 +00:00
|
|
|
|
2018-04-06 04:28:44 +00:00
|
|
|
.. duplicated in CHANGELOG.rst:
|
2023-10-14 17:08:20 +00:00
|
|
|
(Would use `.. include::` but GitHub's renderer doesn't support it.)
|
2017-03-31 18:58:44 +00:00
|
|
|
|
2022-07-16 15:16:00 +00:00
|
|
|
Watch `bidict releases on GitHub <https://github.com/jab/bidict/releases>`__
|
|
|
|
to be notified when new versions of bidict are published.
|
|
|
|
Click the "Watch" dropdown, choose "Custom", and then choose "Releases".
|
2017-03-31 18:58:44 +00:00
|
|
|
|
2016-06-28 04:05:22 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
Learning from bidict
|
|
|
|
--------------------
|
2018-01-02 20:32:06 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
One of the best things about bidict
|
2020-01-11 03:31:17 +00:00
|
|
|
is that it touches a surprising number of
|
|
|
|
interesting Python corners,
|
|
|
|
especially given its small size and scope.
|
2018-01-03 00:24:44 +00:00
|
|
|
|
2018-02-24 09:14:42 +00:00
|
|
|
Check out :doc:`learning-from-bidict` [#fn-learning]_
|
|
|
|
if you're interested in learning more.
|
2018-01-02 20:32:06 +00:00
|
|
|
|
|
|
|
|
2016-06-28 04:05:22 +00:00
|
|
|
Contributing
|
|
|
|
------------
|
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
I have been bidict's sole maintainer
|
|
|
|
and `active contributor <https://github.com/jab/bidict/graphs/contributors>`__
|
2022-07-16 15:16:00 +00:00
|
|
|
since I started the project ~15 years ago.
|
2020-01-11 03:31:17 +00:00
|
|
|
|
2018-02-24 09:14:42 +00:00
|
|
|
Your help would be most welcome!
|
2021-01-10 17:13:26 +00:00
|
|
|
See the :doc:`contributors-guide` [#fn-contributing]_
|
|
|
|
for more information.
|
2018-02-24 09:14:42 +00:00
|
|
|
|
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
Sponsoring
|
2022-02-16 17:24:19 +00:00
|
|
|
----------
|
2018-04-06 04:28:44 +00:00
|
|
|
|
|
|
|
.. duplicated in CONTRIBUTING.rst
|
2023-10-14 17:08:20 +00:00
|
|
|
(Would use `.. include::` but GitHub's renderer doesn't support it.)
|
2017-03-17 16:16:45 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
.. image:: https://img.shields.io/badge/GitHub-sponsor-ff69b4
|
|
|
|
:target: https://github.com/sponsors/jab
|
|
|
|
:alt: Sponsor through GitHub
|
2018-10-17 15:16:43 +00:00
|
|
|
|
2021-01-10 17:13:26 +00:00
|
|
|
Bidict is the product of thousands of hours of my unpaid work
|
2024-01-25 20:46:44 +00:00
|
|
|
over the 15+ years that I've been the sole maintainer.
|
2021-01-10 17:13:26 +00:00
|
|
|
|
2022-01-03 22:18:24 +00:00
|
|
|
If bidict has helped you or your company accomplish your work,
|
2024-01-25 20:46:44 +00:00
|
|
|
please sponsor my work through one of the following,
|
|
|
|
and/or ask your company to do the same:
|
|
|
|
|
|
|
|
- `GitHub <https://github.com/sponsors/jab>`__
|
|
|
|
- `PayPal <https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=jabronson%40gmail%2ecom&lc=US&item_name=Sponsor%20bidict>`__
|
|
|
|
- `Tidelift <https://tidelift.com>`__
|
|
|
|
- `thanks.dev <https://thanks.dev>`__
|
|
|
|
- `Gumroad <https://gumroad.com/l/bidict>`__
|
|
|
|
- `a support engagement with my LLC <#enterprise-support>`__
|
|
|
|
|
|
|
|
If you're not sure which to use, GitHub is an easy option,
|
|
|
|
especially if you already have a GitHub account.
|
|
|
|
Just choose a monthly or one-time amount, and GitHub handles everything else.
|
|
|
|
Your bidict sponsorship on GitHub will automatically go
|
|
|
|
on the same regular bill as any other GitHub charges you pay for.
|
|
|
|
PayPal is another easy option for one-time contributions.
|
2016-12-06 23:09:45 +00:00
|
|
|
|
2022-02-07 16:42:09 +00:00
|
|
|
See the following for rationale and examples of companies
|
|
|
|
supporting the open source projects they depend on
|
|
|
|
in this manner:
|
|
|
|
|
2022-06-03 19:29:19 +00:00
|
|
|
- `<https://engineering.atspotify.com/2022/04/announcing-the-spotify-foss-fund/>`__
|
|
|
|
- `<https://blog.sentry.io/2021/10/21/we-just-gave-154-999-dollars-and-89-cents-to-open-source-maintainers>`__
|
2024-01-25 20:46:44 +00:00
|
|
|
- `<https://engineering.indeedblog.com/blog/2019/07/foss-fund-six-months-in/>`__
|
2022-07-16 15:16:00 +00:00
|
|
|
|
2022-08-23 13:34:50 +00:00
|
|
|
.. - `<https://sethmlarson.dev/blog/people-in-your-software-supply-chain>`__
|
2022-07-16 15:16:00 +00:00
|
|
|
.. - `<https://www.cognitect.com/blog/supporting-open-source-developers>`__
|
|
|
|
.. - `<https://vorpus.org/blog/the-unreasonable-effectiveness-of-investment-in-open-source-infrastructure/>`__
|
2022-02-07 16:42:09 +00:00
|
|
|
|
2016-06-28 04:05:22 +00:00
|
|
|
|
2017-11-20 03:24:08 +00:00
|
|
|
Finding Documentation
|
|
|
|
---------------------
|
2017-10-11 14:26:20 +00:00
|
|
|
|
2018-04-06 04:28:44 +00:00
|
|
|
If you're viewing this on `<https://bidict.readthedocs.io>`__,
|
2017-11-20 03:24:08 +00:00
|
|
|
note that multiple versions of the documentation are available,
|
|
|
|
and you can choose a different version using the popup menu at the bottom-right.
|
|
|
|
Please make sure you're viewing the version of the documentation
|
2021-01-10 17:13:26 +00:00
|
|
|
that corresponds to the version of bidict you'd like to use.
|
2017-11-20 03:24:08 +00:00
|
|
|
|
|
|
|
If you're viewing this on GitHub, PyPI, or some other place
|
|
|
|
that can't render and link this documentation properly
|
|
|
|
and are seeing broken links,
|
|
|
|
try these alternate links instead:
|
2017-10-11 14:26:20 +00:00
|
|
|
|
2022-08-23 13:34:50 +00:00
|
|
|
.. [#fn-intro] `<https://bidict.readthedocs.io/intro.html>`__ | `<docs/intro.rst>`__
|
2018-04-06 04:28:44 +00:00
|
|
|
|
2022-02-10 16:44:56 +00:00
|
|
|
.. [#fn-changelog] `<https://bidict.readthedocs.io/changelog.html>`__ | `<CHANGELOG.rst>`__
|
2018-04-06 04:28:44 +00:00
|
|
|
|
2022-08-23 13:34:50 +00:00
|
|
|
.. [#fn-learning] `<https://bidict.readthedocs.io/learning-from-bidict.html>`__ | `<docs/learning-from-bidict.rst>`__
|
2018-04-06 04:28:44 +00:00
|
|
|
|
2022-02-10 16:44:56 +00:00
|
|
|
.. [#fn-contributing] `<https://bidict.readthedocs.io/contributors-guide.html>`__ | `<CONTRIBUTING.rst>`__
|