| 1 |
.. role:: doc |
| 2 |
.. (Forward declaration for the "doc" role that Sphinx defines for interop with renderers that |
| 3 |
are often used to show this doc and that are unaware of Sphinx (GitHub.com, PyPI.org, etc.). |
| 4 |
Use :doc: rather than :ref: here for better interop as well.) |
| 5 |
|
| 6 |
|
| 7 |
bidict |
| 8 |
====== |
| 9 |
|
| 10 |
*The bidirectional mapping library for Python.* |
| 11 |
|
| 12 |
|
| 13 |
Status |
| 14 |
------ |
| 15 |
|
| 16 |
Features |
| 17 |
-------- |
| 18 |
|
| 19 |
- Mature: Depended on by |
| 20 |
Google, Venmo, CERN, Baidu, Tencent, |
| 21 |
and teams across the world since 2009 |
| 22 |
|
| 23 |
- Familiar, Pythonic APIs |
| 24 |
that are carefully designed for |
| 25 |
safety, simplicity, flexibility, and ergonomics |
| 26 |
|
| 27 |
- Lightweight, with no runtime dependencies |
| 28 |
outside Python's standard library |
| 29 |
|
| 30 |
- Implemented in |
| 31 |
concise, well-factored, fully type-hinted Python code |
| 32 |
that is optimized for running efficiently |
| 33 |
as well as for long-term maintenance and stability |
| 34 |
(as well as `joy <#learning-from-bidict>`__) |
| 35 |
|
| 36 |
- Extensively `documented <https://bidict.readthedocs.io>`__ |
| 37 |
|
| 38 |
- 100% test coverage |
| 39 |
running continuously across all supported Python versions |
| 40 |
(including property-based tests and benchmarks) |
| 41 |
|
| 42 |
|
| 43 |
Installation |
| 44 |
------------ |
| 45 |
|
| 46 |
``pip install bidict`` |
| 47 |
|
| 48 |
|
| 49 |
Quick Start |
| 50 |
----------- |
| 51 |
|
| 52 |
.. code:: python |
| 53 |
|
| 54 |
>>> from bidict import bidict |
| 55 |
>>> element_by_symbol = bidict({'H': 'hydrogen'}) |
| 56 |
>>> element_by_symbol['H'] |
| 57 |
'hydrogen' |
| 58 |
>>> element_by_symbol.inverse['hydrogen'] |
| 59 |
'H' |
| 60 |
|
| 61 |
|
| 62 |
For more usage documentation, |
| 63 |
head to the :doc:`intro` [#fn-intro]_ |
| 64 |
and proceed from there. |
| 65 |
|
| 66 |
|
| 67 |
Enterprise Support |
| 68 |
------------------ |
| 69 |
|
| 70 |
Enterprise-level support for bidict can be obtained via the |
| 71 |
`Tidelift subscription <https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=readme>`__ |
| 72 |
or by `contacting me directly <mailto:[email protected]>`__. |
| 73 |
|
| 74 |
I have a US-based LLC set up for invoicing, |
| 75 |
and I have over 20 years of professional experience |
| 76 |
delivering software and support to companies successfully. |
| 77 |
|
| 78 |
You can also sponsor my work through several platforms, including GitHub Sponsors. |
| 79 |
See the `Sponsoring <#sponsoring>`__ section below for details, |
| 80 |
including rationale and examples of companies |
| 81 |
supporting the open source projects they depend on. |
| 82 |
|
| 83 |
|
| 84 |
Voluntary Community Support |
| 85 |
--------------------------- |
| 86 |
|
| 87 |
Please search through already-asked questions and answers |
| 88 |
in `GitHub Discussions <https://github.com/jab/bidict/discussions>`__ |
| 89 |
and the `issue tracker <https://github.com/jab/bidict/issues?q=is%3Aissue>`__ |
| 90 |
in case your question has already been addressed. |
| 91 |
|
| 92 |
Otherwise, please feel free to |
| 93 |
`start a new discussion <https://github.com/jab/bidict/discussions>`__ |
| 94 |
or `create a new issue <https://github.com/jab/bidict/issues/new>`__ on GitHub |
| 95 |
for voluntary community support. |
| 96 |
|
| 97 |
|
| 98 |
Notice of Usage |
| 99 |
--------------- |
| 100 |
|
| 101 |
If you use bidict, |
| 102 |
and especially if your usage or your organization is significant in some way, |
| 103 |
please let me know in any of the following ways: |
| 104 |
|
| 105 |
- `star bidict on GitHub <https://github.com/jab/bidict>`__ |
| 106 |
- post in `GitHub Discussions <https://github.com/jab/bidict/discussions>`__ |
| 107 |
- `email me <mailto:[email protected]>`__ |
| 108 |
|
| 109 |
|
| 110 |
Changelog |
| 111 |
--------- |
| 112 |
|
| 113 |
For bidict release notes, see the :doc:`changelog`. [#fn-changelog]_ |
| 114 |
|
| 115 |
|
| 116 |
Release Notifications |
| 117 |
--------------------- |
| 118 |
|
| 119 |
.. duplicated in CHANGELOG.rst: |
| 120 |
(Would use `.. include::` but GitHub's renderer doesn't support it.) |
| 121 |
|
| 122 |
Watch `bidict releases on GitHub <https://github.com/jab/bidict/releases>`__ |
| 123 |
to be notified when new versions of bidict are published. |
| 124 |
Click the "Watch" dropdown, choose "Custom", and then choose "Releases". |
| 125 |
|
| 126 |
|
| 127 |
Learning from bidict |
| 128 |
-------------------- |
| 129 |
|
| 130 |
One of the best things about bidict |
| 131 |
is that it touches a surprising number of |
| 132 |
interesting Python corners, |
| 133 |
especially given its small size and scope. |
| 134 |
|
| 135 |
Check out :doc:`learning-from-bidict` [#fn-learning]_ |
| 136 |
if you're interested in learning more. |
| 137 |
|
| 138 |
|
| 139 |
Contributing |
| 140 |
------------ |
| 141 |
|
| 142 |
I have been bidict's sole maintainer |
| 143 |
and `active contributor <https://github.com/jab/bidict/graphs/contributors>`__ |
| 144 |
since I started the project ~15 years ago. |
| 145 |
|
| 146 |
Your help would be most welcome! |
| 147 |
See the :doc:`contributors-guide` [#fn-contributing]_ |
| 148 |
for more information. |
| 149 |
|
| 150 |
|
| 151 |
Sponsoring |
| 152 |
---------- |
| 153 |
|
| 154 |
.. duplicated in CONTRIBUTING.rst |
| 155 |
(Would use `.. include::` but GitHub's renderer doesn't support it.) |
| 156 |
|
| 157 |
|
| 158 |
Bidict is the product of thousands of hours of my unpaid work |
| 159 |
over the 15+ years that I've been the sole maintainer. |
| 160 |
|
| 161 |
If bidict has helped you or your company accomplish your work, |
| 162 |
please sponsor my work through one of the following, |
| 163 |
and/or ask your company to do the same: |
| 164 |
|
| 165 |
- `GitHub <https://github.com/sponsors/jab>`__ |
| 166 |
- `PayPal <https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=jabronson%40gmail%2ecom&lc=US&item_name=Sponsor%20bidict>`__ |
| 167 |
- `Tidelift <https://tidelift.com>`__ |
| 168 |
- `thanks.dev <https://thanks.dev>`__ |
| 169 |
- `Gumroad <https://gumroad.com/l/bidict>`__ |
| 170 |
- `a support engagement with my LLC <#enterprise-support>`__ |
| 171 |
|
| 172 |
If you're not sure which to use, GitHub is an easy option, |
| 173 |
especially if you already have a GitHub account. |
| 174 |
Just choose a monthly or one-time amount, and GitHub handles everything else. |
| 175 |
Your bidict sponsorship on GitHub will automatically go |
| 176 |
on the same regular bill as any other GitHub charges you pay for. |
| 177 |
PayPal is another easy option for one-time contributions. |
| 178 |
|
| 179 |
See the following for rationale and examples of companies |
| 180 |
supporting the open source projects they depend on |
| 181 |
in this manner: |
| 182 |
|
| 183 |
- `<https://engineering.atspotify.com/2022/04/announcing-the-spotify-foss-fund/>`__ |
| 184 |
- `<https://blog.sentry.io/2021/10/21/we-just-gave-154-999-dollars-and-89-cents-to-open-source-maintainers>`__ |
| 185 |
- `<https://engineering.indeedblog.com/blog/2019/07/foss-fund-six-months-in/>`__ |
| 186 |
|
| 187 |
.. - `<https://sethmlarson.dev/blog/people-in-your-software-supply-chain>`__ |
| 188 |
.. - `<https://www.cognitect.com/blog/supporting-open-source-developers>`__ |
| 189 |
.. - `<https://vorpus.org/blog/the-unreasonable-effectiveness-of-investment-in-open-source-infrastructure/>`__ |
| 190 |
|
| 191 |
|
| 192 |
Finding Documentation |
| 193 |
--------------------- |
| 194 |
|
| 195 |
If you're viewing this on `<https://bidict.readthedocs.io>`__, |
| 196 |
note that multiple versions of the documentation are available, |
| 197 |
and you can choose a different version using the popup menu at the bottom-right. |
| 198 |
Please make sure you're viewing the version of the documentation |
| 199 |
that corresponds to the version of bidict you'd like to use. |
| 200 |
|
| 201 |
If you're viewing this on GitHub, PyPI, or some other place |
| 202 |
that can't render and link this documentation properly |
| 203 |
and are seeing broken links, |
| 204 |
try these alternate links instead: |
| 205 |
|
| 206 |
.. [#fn-intro] `<https://bidict.readthedocs.io/intro.html>`__ | `<docs/intro.rst>`__ |
| 207 |
|
| 208 |
.. [#fn-changelog] `<https://bidict.readthedocs.io/changelog.html>`__ | `<CHANGELOG.rst>`__ |
| 209 |
|
| 210 |
.. [#fn-learning] `<https://bidict.readthedocs.io/learning-from-bidict.html>`__ | `<docs/learning-from-bidict.rst>`__ |
| 211 |
|
| 212 |
.. [#fn-contributing] `<https://bidict.readthedocs.io/contributors-guide.html>`__ | `<CONTRIBUTING.rst>`__ |