py-multibase 1.0.3__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. py_multibase-2.0.0/CONTRIBUTING.rst +223 -0
  2. py_multibase-2.0.0/HISTORY.rst +66 -0
  3. {py-multibase-1.0.3 → py_multibase-2.0.0}/LICENSE +0 -1
  4. py_multibase-2.0.0/PKG-INFO +149 -0
  5. {py-multibase-1.0.3 → py_multibase-2.0.0}/README.rst +35 -8
  6. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/conf.py +8 -4
  7. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/index.rst +2 -1
  8. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/installation.rst +1 -1
  9. py_multibase-2.0.0/docs/modules.rst +7 -0
  10. py_multibase-2.0.0/docs/multibase.rst +37 -0
  11. py_multibase-2.0.0/multibase/__init__.py +26 -0
  12. py_multibase-2.0.0/multibase/converters.py +264 -0
  13. py_multibase-2.0.0/multibase/exceptions.py +25 -0
  14. py_multibase-2.0.0/multibase/multibase.py +291 -0
  15. py_multibase-2.0.0/py_multibase.egg-info/PKG-INFO +149 -0
  16. {py-multibase-1.0.3 → py_multibase-2.0.0}/py_multibase.egg-info/SOURCES.txt +4 -10
  17. py_multibase-2.0.0/py_multibase.egg-info/requires.txt +18 -0
  18. py_multibase-2.0.0/pyproject.toml +173 -0
  19. py_multibase-2.0.0/setup.cfg +4 -0
  20. {py-multibase-1.0.3 → py_multibase-2.0.0}/tests/__init__.py +0 -2
  21. py_multibase-2.0.0/tests/test_multibase.py +233 -0
  22. py-multibase-1.0.3/CONTRIBUTING.rst +0 -114
  23. py-multibase-1.0.3/HISTORY.rst +0 -18
  24. py-multibase-1.0.3/PKG-INFO +0 -117
  25. py-multibase-1.0.3/docs/_build/html/_static/ajax-loader.gif +0 -0
  26. py-multibase-1.0.3/docs/_build/html/_static/comment-bright.png +0 -0
  27. py-multibase-1.0.3/docs/_build/html/_static/comment-close.png +0 -0
  28. py-multibase-1.0.3/docs/_build/html/_static/comment.png +0 -0
  29. py-multibase-1.0.3/docs/_build/html/_static/down-pressed.png +0 -0
  30. py-multibase-1.0.3/docs/_build/html/_static/down.png +0 -0
  31. py-multibase-1.0.3/docs/_build/html/_static/up-pressed.png +0 -0
  32. py-multibase-1.0.3/docs/_build/html/_static/up.png +0 -0
  33. py-multibase-1.0.3/multibase/__init__.py +0 -9
  34. py-multibase-1.0.3/multibase/converters.py +0 -126
  35. py-multibase-1.0.3/multibase/multibase.py +0 -98
  36. py-multibase-1.0.3/py_multibase.egg-info/PKG-INFO +0 -117
  37. py-multibase-1.0.3/py_multibase.egg-info/requires.txt +0 -3
  38. py-multibase-1.0.3/setup.cfg +0 -41
  39. py-multibase-1.0.3/setup.py +0 -55
  40. py-multibase-1.0.3/tests/test_multibase.py +0 -129
  41. {py-multibase-1.0.3 → py_multibase-2.0.0}/AUTHORS.rst +0 -0
  42. {py-multibase-1.0.3 → py_multibase-2.0.0}/MANIFEST.in +0 -0
  43. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/Makefile +0 -0
  44. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/_build/html/_static/file.png +0 -0
  45. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/_build/html/_static/minus.png +0 -0
  46. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/_build/html/_static/plus.png +0 -0
  47. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/api_reference.rst +0 -0
  48. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/authors.rst +0 -0
  49. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/contributing.rst +0 -0
  50. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/history.rst +0 -0
  51. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/make.bat +0 -0
  52. {py-multibase-1.0.3 → py_multibase-2.0.0}/docs/usage.rst +0 -0
  53. {py-multibase-1.0.3 → py_multibase-2.0.0}/py_multibase.egg-info/dependency_links.txt +0 -0
  54. {py-multibase-1.0.3 → py_multibase-2.0.0}/py_multibase.egg-info/not-zip-safe +0 -0
  55. {py-multibase-1.0.3 → py_multibase-2.0.0}/py_multibase.egg-info/top_level.txt +0 -0
@@ -0,0 +1,223 @@
1
+ .. highlight:: shell
2
+
3
+ ============
4
+ Contributing
5
+ ============
6
+
7
+ Contributions are welcome, and they are greatly appreciated! Every
8
+ little bit helps, and credit will always be given.
9
+
10
+ You can contribute in many ways:
11
+
12
+ Types of Contributions
13
+ ----------------------
14
+
15
+ Report Bugs
16
+ ~~~~~~~~~~~
17
+
18
+ Report bugs at https://github.com/multiformats/py-multibase/issues.
19
+
20
+ If you are reporting a bug, please include:
21
+
22
+ * Your operating system name and version.
23
+ * Any details about your local setup that might be helpful in troubleshooting.
24
+ * Detailed steps to reproduce the bug.
25
+
26
+ Fix Bugs
27
+ ~~~~~~~~
28
+
29
+ Look through the GitHub issues for bugs. Anything tagged with "bug"
30
+ and "help wanted" is open to whoever wants to implement it.
31
+
32
+ Implement Features
33
+ ~~~~~~~~~~~~~~~~~~
34
+
35
+ Look through the GitHub issues for features. Anything tagged with "enhancement"
36
+ and "help wanted" is open to whoever wants to implement it.
37
+
38
+ Write Documentation
39
+ ~~~~~~~~~~~~~~~~~~~
40
+
41
+ py-multibase could always use more documentation, whether as part of the
42
+ official py-multibase docs, in docstrings, or even on the web in blog posts,
43
+ articles, and such.
44
+
45
+ Submit Feedback
46
+ ~~~~~~~~~~~~~~~
47
+
48
+ The best way to send feedback is to file an issue at https://github.com/multiformats/py-multibase/issues.
49
+
50
+ If you are proposing a feature:
51
+
52
+ * Explain in detail how it would work.
53
+ * Keep the scope as narrow as possible, to make it easier to implement.
54
+ * Remember that this is a volunteer-driven project, and that contributions
55
+ are welcome :)
56
+
57
+ Get Started!
58
+ ------------
59
+
60
+ Ready to contribute? Here's how to set up `multibase` for local development.
61
+
62
+ 1. Fork the `py-multibase` repo on GitHub.
63
+ 2. Clone your fork locally::
64
+
65
+ $ git clone git@github.com:your_name_here/py-multibase.git
66
+
67
+ 3. Install your local copy into a virtualenv. Create and activate a virtual environment::
68
+
69
+ $ python -m venv venv
70
+ $ source venv/bin/activate # On Windows: venv\Scripts\activate
71
+ $ pip install -e ".[dev]"
72
+
73
+ 4. Install pre-commit hooks (optional but recommended)::
74
+
75
+ $ pre-commit install
76
+
77
+ This will set up git hooks to automatically run linting and formatting checks
78
+ before each commit.
79
+
80
+ 5. Create a branch for local development::
81
+
82
+ $ git checkout -b name-of-your-bugfix-or-feature
83
+
84
+ Now you can make your changes locally.
85
+
86
+ 6. When you're done making changes, check that your changes pass linting and the
87
+ tests, including testing other Python versions with tox::
88
+
89
+ $ make lint
90
+ $ make test
91
+ $ tox
92
+
93
+ Or run pre-commit manually on all files::
94
+
95
+ $ pre-commit run --all-files
96
+
97
+ If you installed pre-commit hooks (step 4), they will run automatically on commit.
98
+
99
+ Development Workflow Commands
100
+ -------------------------------
101
+
102
+ The project provides several ``make`` targets to help with development:
103
+
104
+ * ``make fix`` - Automatically fix formatting and linting issues using ruff.
105
+ Use this when you want to auto-fix code style issues.
106
+
107
+ * ``make lint`` - Run all pre-commit hooks on all files to check for code quality
108
+ issues. This includes YAML/TOML validation, trailing whitespace checks, pyupgrade,
109
+ ruff linting and formatting, and mypy type checking.
110
+
111
+ * ``make typecheck`` - Run mypy type checking only. Use this when you want to
112
+ quickly check for type errors without running all other checks.
113
+
114
+ * ``make test`` - Run the test suite with pytest using the default Python version.
115
+ For testing across multiple Python versions, use ``tox`` instead.
116
+
117
+ * ``make pr`` - Run a complete pre-PR check: clean build artifacts, fix formatting,
118
+ run linting, type checking, and tests. This is the recommended command to run
119
+ before submitting a pull request.
120
+
121
+ For a full list of available commands, run ``make help``.
122
+
123
+ 7. Commit your changes and push your branch to GitHub::
124
+
125
+ $ git add .
126
+ $ git commit -m "Your detailed description of your changes."
127
+ $ git push -u origin name-of-your-bugfix-or-feature
128
+
129
+ 8. Submit a pull request through the GitHub website.
130
+
131
+ Pull Request Guidelines
132
+ -----------------------
133
+
134
+ Before you submit a pull request, check that it meets these guidelines:
135
+
136
+ 1. The pull request should include tests.
137
+ 2. If the pull request adds functionality, the docs should be updated. Put
138
+ your new functionality into a function with a docstring, and add the
139
+ feature to the list in README.rst.
140
+ 3. The pull request should work for Python 3.10, 3.11, 3.12, 3.13, and 3.14. Check
141
+ https://github.com/multiformats/py-multibase/actions
142
+ and make sure that the tests pass for all supported Python versions.
143
+
144
+ Tips
145
+ ----
146
+
147
+ To run a subset of tests::
148
+
149
+ $ pytest tests/test_multibase.py
150
+
151
+ Releasing
152
+ ---------
153
+
154
+ Releases are typically done from the ``master`` branch, except when releasing a beta (in
155
+ which case the beta is released from ``master``, and the previous stable branch is
156
+ released from said branch).
157
+
158
+ Final test before each release
159
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160
+
161
+ Before releasing a new version, build and test the package that will be released:
162
+
163
+ .. code:: sh
164
+
165
+ git checkout master && git pull
166
+ make package-test
167
+
168
+ This will build the package and install it in a temporary virtual environment. Follow
169
+ the instructions to activate the venv and test whatever you think is important.
170
+
171
+ You can also preview the release notes:
172
+
173
+ .. code:: sh
174
+
175
+ towncrier --draft
176
+
177
+ Build the release notes
178
+ ~~~~~~~~~~~~~~~~~~~~~~~
179
+
180
+ Before bumping the version number, build the release notes. You must include the part of
181
+ the version to bump (see below), which changes how the version number will show in the
182
+ release notes.
183
+
184
+ .. code:: sh
185
+
186
+ make notes bump=$$VERSION_PART_TO_BUMP$$
187
+
188
+ If there are any errors, be sure to re-run make notes until it works.
189
+
190
+ Push the release to github & pypi
191
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
192
+
193
+ After confirming that the release package looks okay, release a new version:
194
+
195
+ .. code:: sh
196
+
197
+ make release bump=$$VERSION_PART_TO_BUMP$$
198
+
199
+ This command will:
200
+
201
+ - Bump the version number as specified wherever it appears in the repo.
202
+ - Create a git commit and tag for the new version.
203
+ - Build the package.
204
+ - Push the commit and tag to github.
205
+ - Push the new package files to pypi.
206
+
207
+ Which version part to bump
208
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
209
+
210
+ ``$$VERSION_PART_TO_BUMP$$`` must be one of: ``major``, ``minor``, ``patch``, ``stage``,
211
+ or ``devnum``.
212
+
213
+ The version format for this repo is ``{major}.{minor}.{patch}`` for stable, and
214
+ ``{major}.{minor}.{patch}-{stage}.{devnum}`` for unstable (``stage`` can be alpha or
215
+ beta).
216
+
217
+ If you are in a beta version, ``make release bump=stage`` will switch to a stable.
218
+
219
+ To issue an unstable version when the current version is stable, specify the new version
220
+ explicitly, like ``make release bump="--new-version 4.0.0-alpha.1"``
221
+
222
+ You can see what the result of bumping any particular version part would be with
223
+ ``bump-my-version show-bump``
@@ -0,0 +1,66 @@
1
+ History
2
+ =======
3
+
4
+ .. towncrier release notes start
5
+
6
+ py-multibase v2.0.0 (2025-12-17)
7
+ --------------------------------
8
+
9
+ Improved Documentation
10
+ ~~~~~~~~~~~~~~~~~~~~~~
11
+
12
+ - Added release documentation to contributing docs. (`#23 <https://github.com/multiformats/py-multibase/issues/23>`__)
13
+ - Fixed Read the Docs build failures by updating deprecated Sphinx settings and adding API documentation generation. (`#31 <https://github.com/multiformats/py-multibase/issues/31>`__)
14
+
15
+
16
+ Features
17
+ ~~~~~~~~
18
+
19
+ - Added complete multibase encoding support and enhanced API features.
20
+
21
+ **New Encodings (10 total):**
22
+ - base16upper (prefix F) - Uppercase hexadecimal encoding
23
+ - base32upper (prefix B) - Uppercase base32 encoding
24
+ - base32pad (prefix c) - Base32 with RFC 4648 padding
25
+ - base32padupper (prefix C) - Base32 uppercase with padding
26
+ - base32hexupper (prefix V) - Base32hex uppercase variant
27
+ - base32hexpad (prefix t) - Base32hex with RFC 4648 padding
28
+ - base32hexpadupper (prefix T) - Base32hex uppercase with padding
29
+ - base64pad (prefix M) - Base64 with RFC 4648 padding
30
+ - base64urlpad (prefix U) - Base64url with padding
31
+ - base256emoji (prefix 🚀) - Emoji-based encoding
32
+
33
+ **API Enhancements:**
34
+ - Added ``Encoder`` and ``Decoder`` classes for reusable encoding/decoding
35
+ - Added ``decode(return_encoding=True)`` parameter to return encoding type along with decoded data
36
+ - Added structured exception classes: ``UnsupportedEncodingError``, ``InvalidMultibaseStringError``, ``DecodingError``
37
+ - Added encoding metadata functions: ``get_encoding_info()``, ``list_encodings()``, ``is_encoding_supported()``
38
+ - Added decoder composition support via ``Decoder.or_()`` method
39
+
40
+ This brings py-multibase to 100% encoding coverage (24/24 encodings) matching reference implementations (go-multibase, rust-multibase, js-multiformats). (`#20 <https://github.com/multiformats/py-multibase/issues/20>`__)
41
+
42
+
43
+ Internal Changes - for py-multibase Contributors
44
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+
46
+ - Modernized project infrastructure: migrated to pyproject.toml, replaced Travis CI with GitHub Actions, updated Python support to 3.10-3.14, replaced flake8 with ruff, and added pre-commit hooks. This is an internal change that does not affect the public API. (`#18 <https://github.com/multiformats/py-multibase/issues/18>`__)
47
+ - Dropped ``coverage`` and ``codecov`` references, no longer using it. (`#23 <https://github.com/multiformats/py-multibase/issues/23>`__)
48
+ - Updated pyupgrade to v3.21.2 to fix Python 3.14 compatibility in linting checks. (`#24 <https://github.com/multiformats/py-multibase/issues/24>`__)
49
+ - Fixed release process by adding automated release targets to Makefile, adding doctest support to documentation builds, fixing version string configuration, and creating comprehensive package test script. This aligns the release process with py-multihash PR 31 improvements. (`#26 <https://github.com/multiformats/py-multibase/issues/26>`__)
50
+
51
+
52
+ 1.0.3 (2020-10-26)
53
+ ------------------
54
+ * Add base36 and base36 upper encodings
55
+ * Fix issue with base16 encoding
56
+
57
+ 1.0.0 (2018-10-19)
58
+ ------------------
59
+
60
+ * Re-implement encoding for base32 and base64, as the implementation was buggy
61
+ * Add extensive tests for all encodings
62
+
63
+ 0.1.0 (2017-09-02)
64
+ ------------------
65
+
66
+ * First release on PyPI.
@@ -8,4 +8,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
8
8
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
9
 
10
10
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11
-
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-multibase
3
+ Version: 2.0.0
4
+ Summary: Multibase implementation for Python
5
+ Author-email: Dhruv Baldawa <dhruv@dhruvb.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/multiformats/py-multibase
8
+ Project-URL: Download, https://github.com/multiformats/py-multibase/tarball/2.0.0
9
+ Keywords: multibase
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: <4.0,>=3.10
21
+ Description-Content-Type: text/x-rst
22
+ License-File: LICENSE
23
+ License-File: AUTHORS.rst
24
+ Requires-Dist: python-baseconv<2.0,>=1.2.0
25
+ Requires-Dist: six<2.0,>=1.10.0
26
+ Requires-Dist: morphys<2.0,>=1.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: Sphinx>=5.0.0; extra == "dev"
29
+ Requires-Dist: build>=0.9.0; extra == "dev"
30
+ Requires-Dist: bump-my-version>=1.2.0; extra == "dev"
31
+ Requires-Dist: mypy; extra == "dev"
32
+ Requires-Dist: pre-commit; extra == "dev"
33
+ Requires-Dist: pytest; extra == "dev"
34
+ Requires-Dist: pytest-runner; extra == "dev"
35
+ Requires-Dist: ruff; extra == "dev"
36
+ Requires-Dist: towncrier<25,>=24; extra == "dev"
37
+ Requires-Dist: tox>=4.10.0; extra == "dev"
38
+ Requires-Dist: twine; extra == "dev"
39
+ Requires-Dist: watchdog>=3.0.0; extra == "dev"
40
+ Requires-Dist: wheel>=0.31.0; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ py-multibase
44
+ ------------
45
+
46
+ .. image:: https://img.shields.io/pypi/v/py-multibase.svg
47
+ :target: https://pypi.python.org/pypi/py-multibase
48
+
49
+ .. image:: https://github.com/multiformats/py-multibase/actions/workflows/tox.yml/badge.svg
50
+ :target: https://github.com/multiformats/py-multibase/actions
51
+
52
+ .. image:: https://readthedocs.org/projects/py-multibase/badge/?version=stable
53
+ :target: https://py-multibase.readthedocs.io/en/stable/?badge=stable
54
+ :alt: Documentation Status
55
+
56
+ `Multibase <https://github.com/multiformats/multibase>`_ implementation for Python
57
+
58
+ Multibase is a protocol for distinguishing base encodings and other simple string encodings, and for ensuring full compatibility with program interfaces.
59
+
60
+ It answers the question: Given data d encoded into string s, how can I tell what base d is encoded with?
61
+
62
+ Base encodings exist because transports have restrictions, use special in-band sequences, or must be human-friendly.
63
+ When systems chose a base to use, it is not always clear which base to use, as there are many tradeoffs in the decision.
64
+ Multibase is here to save programs and programmers from worrying about which encoding is best.
65
+
66
+ It solves the biggest problem: a program can use multibase to take input or produce output in whichever base is desired.
67
+
68
+ The important part is that the value is self-describing, letting other programs elsewhere know what encoding it is using.
69
+
70
+ * Free software: MIT license
71
+ * Documentation: https://py-multibase.readthedocs.io.
72
+ * Python versions: Python 3.10, 3.11, 3.12, 3.13, 3.14
73
+
74
+ Installation
75
+ ============
76
+
77
+ .. code-block:: shell
78
+
79
+ $ pip install py-multibase
80
+
81
+
82
+ Sample Usage
83
+ ============
84
+
85
+ .. code-block:: python
86
+
87
+ >>> # encoding a buffer
88
+ >>> from multibase import encode, decode
89
+ >>> encode('base58btc', 'hello world')
90
+ b'zStV1DL6CwTryKyV'
91
+ >>> encode('base64', 'hello world')
92
+ b'mGhlbGxvIHdvcmxk'
93
+ >>> # decoding a multibase
94
+ >>> decode('mGhlbGxvIHdvcmxk')
95
+ b'hello world'
96
+ >>> decode(b'zStV1DL6CwTryKyV')
97
+ b'hello world'
98
+ >>> decode(encode('base2', b'hello world'))
99
+ b'hello world'
100
+
101
+ >>> # Using reusable Encoder/Decoder classes
102
+ >>> from multibase import Encoder, Decoder
103
+ >>> encoder = Encoder('base64')
104
+ >>> encoded1 = encoder.encode('data1')
105
+ >>> encoded2 = encoder.encode('data2')
106
+
107
+ >>> decoder = Decoder()
108
+ >>> decoded = decoder.decode(encoded1)
109
+
110
+ >>> # Getting encoding information
111
+ >>> from multibase import get_encoding_info, list_encodings, is_encoding_supported
112
+ >>> info = get_encoding_info('base64')
113
+ >>> print(info.encoding, info.code)
114
+ base64 b'm'
115
+ >>> all_encodings = list_encodings()
116
+ >>> is_encoding_supported('base64')
117
+ True
118
+
119
+ >>> # Decode with encoding return
120
+ >>> encoding, data = decode(encoded1, return_encoding=True)
121
+ >>> print(f'Encoded with {encoding}: {data}')
122
+
123
+
124
+ Supported codecs
125
+ ================
126
+
127
+ * base2
128
+ * base8
129
+ * base10
130
+ * base16
131
+ * base16upper
132
+ * base32hex
133
+ * base32hexupper
134
+ * base32hexpad
135
+ * base32hexpadupper
136
+ * base32
137
+ * base32upper
138
+ * base32pad
139
+ * base32padupper
140
+ * base32z
141
+ * base36
142
+ * base36upper
143
+ * base58flickr
144
+ * base58btc
145
+ * base64
146
+ * base64pad
147
+ * base64url
148
+ * base64urlpad
149
+ * base256emoji
@@ -4,11 +4,8 @@ py-multibase
4
4
  .. image:: https://img.shields.io/pypi/v/py-multibase.svg
5
5
  :target: https://pypi.python.org/pypi/py-multibase
6
6
 
7
- .. image:: https://img.shields.io/travis/multiformats/py-multibase.svg?branch=master
8
- :target: https://travis-ci.org/multiformats/py-multibase?branch=master
9
-
10
- .. image:: https://codecov.io/gh/multiformats/py-multibase/branch/master/graph/badge.svg
11
- :target: https://codecov.io/gh/multiformats/py-multibase
7
+ .. image:: https://github.com/multiformats/py-multibase/actions/workflows/tox.yml/badge.svg
8
+ :target: https://github.com/multiformats/py-multibase/actions
12
9
 
13
10
  .. image:: https://readthedocs.org/projects/py-multibase/badge/?version=stable
14
11
  :target: https://py-multibase.readthedocs.io/en/stable/?badge=stable
@@ -30,7 +27,7 @@ The important part is that the value is self-describing, letting other programs
30
27
 
31
28
  * Free software: MIT license
32
29
  * Documentation: https://py-multibase.readthedocs.io.
33
- * Python versions: 3.5, 3.6
30
+ * Python versions: Python 3.10, 3.11, 3.12, 3.13, 3.14
34
31
 
35
32
  Installation
36
33
  ============
@@ -59,6 +56,28 @@ Sample Usage
59
56
  >>> decode(encode('base2', b'hello world'))
60
57
  b'hello world'
61
58
 
59
+ >>> # Using reusable Encoder/Decoder classes
60
+ >>> from multibase import Encoder, Decoder
61
+ >>> encoder = Encoder('base64')
62
+ >>> encoded1 = encoder.encode('data1')
63
+ >>> encoded2 = encoder.encode('data2')
64
+
65
+ >>> decoder = Decoder()
66
+ >>> decoded = decoder.decode(encoded1)
67
+
68
+ >>> # Getting encoding information
69
+ >>> from multibase import get_encoding_info, list_encodings, is_encoding_supported
70
+ >>> info = get_encoding_info('base64')
71
+ >>> print(info.encoding, info.code)
72
+ base64 b'm'
73
+ >>> all_encodings = list_encodings()
74
+ >>> is_encoding_supported('base64')
75
+ True
76
+
77
+ >>> # Decode with encoding return
78
+ >>> encoding, data = decode(encoded1, return_encoding=True)
79
+ >>> print(f'Encoded with {encoding}: {data}')
80
+
62
81
 
63
82
  Supported codecs
64
83
  ================
@@ -67,14 +86,22 @@ Supported codecs
67
86
  * base8
68
87
  * base10
69
88
  * base16
70
- * base16
71
- * base16
89
+ * base16upper
72
90
  * base32hex
91
+ * base32hexupper
92
+ * base32hexpad
93
+ * base32hexpadupper
73
94
  * base32
95
+ * base32upper
96
+ * base32pad
97
+ * base32padupper
74
98
  * base32z
75
99
  * base36
76
100
  * base36upper
77
101
  * base58flickr
78
102
  * base58btc
79
103
  * base64
104
+ * base64pad
80
105
  * base64url
106
+ * base64urlpad
107
+ * base256emoji
@@ -40,19 +40,23 @@ import multibase
40
40
 
41
41
  # Add any Sphinx extension module names here, as strings. They can be
42
42
  # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
43
- extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
43
+ extensions = [
44
+ 'sphinx.ext.autodoc',
45
+ 'sphinx.ext.viewcode',
46
+ 'sphinx.ext.doctest',
47
+ ]
44
48
 
45
49
  # Add any paths that contain templates here, relative to this directory.
46
50
  templates_path = ['_templates']
47
51
 
48
52
  # The suffix of source filenames.
49
- source_suffix = '.rst'
53
+ source_suffix = {'.rst': 'restructuredtext'}
50
54
 
51
55
  # The encoding of source files.
52
56
  #source_encoding = 'utf-8-sig'
53
57
 
54
- # The master toctree document.
55
- master_doc = 'index'
58
+ # The root toctree document.
59
+ root_doc = 'index'
56
60
 
57
61
  # General information about the project.
58
62
  project = u'py-multibase'
@@ -7,9 +7,10 @@ Table of contents
7
7
  .. toctree::
8
8
  :maxdepth: 2
9
9
 
10
- index
11
10
  installation
11
+ usage
12
12
  api_reference
13
+ modules
13
14
  contributing
14
15
  authors
15
16
  history
@@ -44,7 +44,7 @@ Once you have a copy of the source, you can install it with:
44
44
 
45
45
  .. code-block:: console
46
46
 
47
- $ python setup.py install
47
+ $ pip install -e .
48
48
 
49
49
 
50
50
  .. _Github repo: https://github.com/multiformats/py-multibase
@@ -0,0 +1,7 @@
1
+ multibase
2
+ =========
3
+
4
+ .. toctree::
5
+ :maxdepth: 4
6
+
7
+ multibase
@@ -0,0 +1,37 @@
1
+ multibase package
2
+ =================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ multibase.converters module
8
+ ---------------------------
9
+
10
+ .. automodule:: multibase.converters
11
+ :members:
12
+ :show-inheritance:
13
+ :undoc-members:
14
+
15
+ multibase.exceptions module
16
+ ---------------------------
17
+
18
+ .. automodule:: multibase.exceptions
19
+ :members:
20
+ :show-inheritance:
21
+ :undoc-members:
22
+
23
+ multibase.multibase module
24
+ --------------------------
25
+
26
+ .. automodule:: multibase.multibase
27
+ :members:
28
+ :show-inheritance:
29
+ :undoc-members:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: multibase
35
+ :members:
36
+ :show-inheritance:
37
+ :undoc-members:
@@ -0,0 +1,26 @@
1
+ """Top-level package for py-multibase."""
2
+
3
+ __author__ = """Dhruv Baldawa"""
4
+ __email__ = "dhruv@dhruvb.com"
5
+ __version__ = "2.0.0"
6
+
7
+ from .exceptions import ( # noqa: F401
8
+ DecodingError,
9
+ InvalidMultibaseStringError,
10
+ MultibaseError,
11
+ UnsupportedEncodingError,
12
+ )
13
+ from .multibase import ( # noqa: F401
14
+ ENCODINGS,
15
+ ComposedDecoder,
16
+ Decoder,
17
+ Encoder,
18
+ Encoding,
19
+ decode,
20
+ encode,
21
+ get_codec,
22
+ get_encoding_info,
23
+ is_encoded,
24
+ is_encoding_supported,
25
+ list_encodings,
26
+ )