libipld 3.0.0__cp313-none-win_amd64.whl
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.
libipld/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: libipld
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Intended Audience :: Information Technology
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Natural Language :: English
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Rust
|
|
11
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
12
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Software Development :: Pre-processors
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Summary: Python binding to the Rust IPLD library
|
|
25
|
+
Keywords: library,lib,ipld,cid,multibase,multihash,dag,cbor,json,pb,dag-cbor,dag-json
|
|
26
|
+
Author: Ilya (Marshal) <ilya@marshal.dev>
|
|
27
|
+
Author-email: "Ilya (Marshal)" <ilya@marshal.dev>
|
|
28
|
+
License: MIT
|
|
29
|
+
Requires-Python: >=3.8
|
|
30
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
31
|
+
Project-URL: Homepage, https://github.com/MarshalX/python-libipld
|
|
32
|
+
Project-URL: Tracker, https://github.com/MarshalX/python-libipld/issues
|
|
33
|
+
Project-URL: Author, https://github.com/MarshalX
|
|
34
|
+
|
|
35
|
+
## Python IPLD
|
|
36
|
+
|
|
37
|
+
> This project aims to speed up [The AT Protocol SDK](https://github.com/MarshalX/atproto) by using Rust for the heavy lifting. Only atproto related parts are implemented first.
|
|
38
|
+
|
|
39
|
+
Code snippet:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import libipld
|
|
43
|
+
|
|
44
|
+
# CID
|
|
45
|
+
print(libipld.decode_cid('bafyreig7jbijxpn4lfhvnvyuwf5u5jyhd7begxwyiqe7ingwxycjdqjjoa'))
|
|
46
|
+
# Output: {'hash': {'size': 32, 'code': 18, 'digest': b'\xdfHP\x9b\xbd\xbcYOV\xd7\x14\xb1{N\xa7\x07\x1f\xc2C^\xd8D\t\xf44\xd6\xbe\x04\x91\xc1)p'}, 'version': 1, 'codec': 113}
|
|
47
|
+
print(libipld.encode_cid(b'\x01q\x12 \xb6\x81\x1a\x1d\x7f\x8c\x17\x91\xdam\x1bO\x13m\xc0\xe2&y\xea\xfe\xaaX\xd6M~/\xaa\xd5\x89\x0e\x9d\x9c'))
|
|
48
|
+
# Output: bafyreifwqenb274mc6i5u3i3j4jw3qhcez46v7vkldle27rpvlkysdu5tq
|
|
49
|
+
|
|
50
|
+
# DAG-CBOR
|
|
51
|
+
print(libipld.decode_dag_cbor(b'\xa2aa\x0cabfhello!'))
|
|
52
|
+
# Output: {'a': 12, 'b': 'hello!'}
|
|
53
|
+
print(libipld.encode_dag_cbor({'a': 12, 'b': 'hello!'}))
|
|
54
|
+
# Output: b'\xa2aa\x0cabfhello!'
|
|
55
|
+
|
|
56
|
+
# multibase
|
|
57
|
+
print(libipld.decode_multibase('ueWVzIG1hbmkgIQ'))
|
|
58
|
+
# Output: ('u', b'yes mani !')
|
|
59
|
+
print(libipld.encode_multibase('u', b'yes mani !'))
|
|
60
|
+
# Output: ueWVzIG1hbmkgIQ
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
- Decode DAG-CBOR (`decode_dag_cbor(bytes) -> dict`, `decode_dag_cbor_multi(bytes) -> list[dict]`)
|
|
66
|
+
- Encode DAG-CBOR (`encode_dag_cbor(obj) -> bytes`)
|
|
67
|
+
- Decode CID (`decode_cid(str | bytes) -> dict`). Accepts CID stringified form or CID raw byte form.
|
|
68
|
+
- Encode CID (`encode_cid(bytes) -> str`). Encodes CID raw byte form to stringified form.
|
|
69
|
+
- Decode Multibase (`decode_multibase(str) -> tuple[str, bytes]`). Returns base and data.
|
|
70
|
+
- Encode Multibase (`encode_multibase(str, bytes) -> str`). Accepts base and data.
|
|
71
|
+
- Decode CAR (`decode_car(bytes) -> tuple[dict, dict[bytes, dict]]`). Returns a header and blocks mapped by CID. CIDs in raw byte form.
|
|
72
|
+
|
|
73
|
+
Note: a stub file will be provided in the future.
|
|
74
|
+
|
|
75
|
+
## Requirements
|
|
76
|
+
|
|
77
|
+
- Python 3.8 or higher.
|
|
78
|
+
|
|
79
|
+
## Installing
|
|
80
|
+
|
|
81
|
+
You can install or upgrade `libipld` via
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install libipld
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Contributing
|
|
88
|
+
|
|
89
|
+
Contributions of all sizes are welcome.
|
|
90
|
+
|
|
91
|
+
### License
|
|
92
|
+
|
|
93
|
+
MIT
|
|
94
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
libipld-3.0.0.dist-info/METADATA,sha256=hK0fWpsqXB-NxVC-tJ5zv639ptBE87Z4WpGlstFLvo4,3617
|
|
2
|
+
libipld-3.0.0.dist-info/WHEEL,sha256=1ZpRl7NI5FUTGBGfAoLBw2DqQx_-H3hwfjZ2VbdjU5g,95
|
|
3
|
+
libipld-3.0.0.dist-info/licenses/LICENSE,sha256=52kXbQ5QVTH11OTgzRYBJ7-kxjzv2MxzAFQ43A7iMeM,1071
|
|
4
|
+
libipld/__init__.py,sha256=t3UE8zXQWa8QjORqf1niPLPRUiVZl83yjfPsAN07bYE,111
|
|
5
|
+
libipld/libipld.cp313-win_amd64.pyd,sha256=JE2lLZr0hQKzEg-Ti6Md_6ABpZH--rEEH7GTtGCRxQc,472064
|
|
6
|
+
libipld-3.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ilya Siamionau
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|