| Name | bumble_bencoding JSON |
| Version |
0.0.3
JSON |
| download |
| home_page | None |
| Summary | .. include:: ../README.md |
| upload_time | 2024-06-27 20:48:28 |
| maintainer | None |
| docs_url | None |
| author | Alyce Osbourne |
| requires_python | None |
| license | None |
| keywords |
|
| VCS |
|
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
<p align="center" width="100%">
<img width="33%" src="logo.png">
</p>
Not as bug-filled as the title might suggest, Bumble is a superset of bencoding (pronounced Bee Encoding) that aims to be a safer, simpler alternative to Pickle. Often when pickling objects, we only care about the types and data contained, not about recreating the same objects with the same IDs. This is where many of the unsafe aspects of Pickle come from. Bumble solves this by allowing the encoding of your data without needing to encode everything about the environment or objects like code objects.
## Why Bumble Rocks:
- **Smaller Encoded Data**: Bumble's encoded data is more compact than Pickle's.
- **Safer Decoding**: Bumble does not allow the evaluation of code objects as part of its decoding process.
- **Versatile**: Fulfills most uses for Pickle, with none of the caveats.
- **Interoperable with Pickle**: You can still work with Pickle where necessary.
- **Codec Pipelines**: Full support for codec pipelines, allowing inline compression, hashing, and encryption.
**WARNING**: Bumble is still a work in progress (WIP). Many things will change over the coming days, so please, pretty please, don't write anything that will rely on this until V1 is released.
## Supported Types
Bumble can handle a wide range of types, making it extremely versatile for various data structures and objects in Python. Here's a brief overview of the types it supports:
- **Simple Types**:
- Boolean (`True`, `False`)
- Integers (`42`)
- Floats (`3.14`)
- Bytes (`b"hello"`)
- Strings (`"hello"`)
- **Collections**:
- Lists (`[1, 2, 3]`)
- Dictionaries (`{"key": "value"}`)
- Sets (`{1, 2, 3}`)
- Tuples (`(1, 2, 3)`)
- **Complex Types**:
- Nested structures (`[1, [2, [3, [4]]]]`, `{'a': {'b': {'c': 'd'}}}`)
- Mixed-type collections (`[1, "string", 3.14, True, None, b"bytes", [1, 2], {"key": "value"}]`)
- Empty structures (`[]`, `{}`, `set()`, `tuple()`)
- **Special Values**:
- Very large numbers (`10 ** 100`, `-10 ** 100`)
- Special float values (`float('nan')`, `float('inf')`, `float('-inf')`)
- `NoneType` (`None`)
- **Arbitrary Objects**:
- Many standard library objects can be encoded and decoded.
- As can your own created objects.
## How to Use Bumble
### Encoding and Decoding Data
Here's how you can easily convert Python objects to Bumble encoding and back again:
```python
from types import SimpleNamespace
import bumble_bencoding
data = {
'key1': 'value1',
'key2': 42,
'key3': [1, 2, 3],
'key4': SimpleNamespace(a=1, b={'a': 1, 'b': 2}),
'key5': None,
'key6': True,
'key7': False,
'key8': 3.14,
'key9': b'bytes',
'key10': {1, 2, 3},
'key11': (1, 2, 3),
'key13': float('inf'),
'key14': float('-inf'),
'key15': 10 ** 100,
'key16': -10 ** 100,
'key17': {'a': {'b': {'c': 'd'}}},
'key18': [],
'key19': {},
'key20': set(),
'key21': tuple(),
'key22': [1, "string", 3.14, True, None, b"bytes", [1, 2], {"key": "value"}],
}
encoded_data = bumble_bencoding.encode(data)
print("Encoded Data:", encoded_data)
decoded_data = bumble_bencoding.decode(encoded_data)
print("Decoded Data:", decoded_data)
assert data == decoded_data, "Data does not match"
```
Bumble makes it straightforward to encode and decode data while ensuring safety and efficiency. This quick example shows how seamless the process can be, providing a safer alternative to Pickle with similar versatility.
### Note
Bumble is intentionally designed to not support all types in order to provide a safer and simpler alternative to Pickle. It focuses on the most common types and structures.
Bumble operates under the assumption that most users are pickling objects for their state, rather than requiring a true duplication of the object.
---
Feel free to experiment with various data types and structures to see how Bumble handles them with ease!
If you find any issues, please let me know by raising an issue on the GitHub repository. Your feedback is invaluable in improving Bumble for everyone.
Raw data
{
"_id": null,
"home_page": null,
"name": "bumble_bencoding",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Alyce Osbourne",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/cc/52/72305f74d01b4fa71c528a87cddf0361319bf17f78f7d4f6bbae25754060/bumble_bencoding-0.0.3.tar.gz",
"platform": null,
"description": "<p align=\"center\" width=\"100%\">\n <img width=\"33%\" src=\"logo.png\">\n</p>\n\nNot as bug-filled as the title might suggest, Bumble is a superset of bencoding (pronounced Bee Encoding) that aims to be a safer, simpler alternative to Pickle. Often when pickling objects, we only care about the types and data contained, not about recreating the same objects with the same IDs. This is where many of the unsafe aspects of Pickle come from. Bumble solves this by allowing the encoding of your data without needing to encode everything about the environment or objects like code objects.\n\n## Why Bumble Rocks:\n- **Smaller Encoded Data**: Bumble's encoded data is more compact than Pickle's.\n- **Safer Decoding**: Bumble does not allow the evaluation of code objects as part of its decoding process.\n- **Versatile**: Fulfills most uses for Pickle, with none of the caveats.\n- **Interoperable with Pickle**: You can still work with Pickle where necessary.\n- **Codec Pipelines**: Full support for codec pipelines, allowing inline compression, hashing, and encryption.\n\n**WARNING**: Bumble is still a work in progress (WIP). Many things will change over the coming days, so please, pretty please, don't write anything that will rely on this until V1 is released.\n\n## Supported Types\n\nBumble can handle a wide range of types, making it extremely versatile for various data structures and objects in Python. Here's a brief overview of the types it supports:\n\n- **Simple Types**: \n - Boolean (`True`, `False`)\n - Integers (`42`)\n - Floats (`3.14`)\n - Bytes (`b\"hello\"`)\n - Strings (`\"hello\"`)\n\n- **Collections**:\n - Lists (`[1, 2, 3]`)\n - Dictionaries (`{\"key\": \"value\"}`)\n - Sets (`{1, 2, 3}`)\n - Tuples (`(1, 2, 3)`)\n\n- **Complex Types**:\n - Nested structures (`[1, [2, [3, [4]]]]`, `{'a': {'b': {'c': 'd'}}}`)\n - Mixed-type collections (`[1, \"string\", 3.14, True, None, b\"bytes\", [1, 2], {\"key\": \"value\"}]`)\n - Empty structures (`[]`, `{}`, `set()`, `tuple()`)\n\n- **Special Values**:\n - Very large numbers (`10 ** 100`, `-10 ** 100`)\n - Special float values (`float('nan')`, `float('inf')`, `float('-inf')`)\n - `NoneType` (`None`)\n\n- **Arbitrary Objects**:\n - Many standard library objects can be encoded and decoded.\n - As can your own created objects.\n\n## How to Use Bumble\n\n### Encoding and Decoding Data\n\nHere's how you can easily convert Python objects to Bumble encoding and back again:\n\n```python\nfrom types import SimpleNamespace\nimport bumble_bencoding\n\ndata = {\n 'key1': 'value1',\n 'key2': 42,\n 'key3': [1, 2, 3],\n 'key4': SimpleNamespace(a=1, b={'a': 1, 'b': 2}),\n 'key5': None,\n 'key6': True,\n 'key7': False,\n 'key8': 3.14,\n 'key9': b'bytes',\n 'key10': {1, 2, 3},\n 'key11': (1, 2, 3),\n 'key13': float('inf'),\n 'key14': float('-inf'),\n 'key15': 10 ** 100,\n 'key16': -10 ** 100,\n 'key17': {'a': {'b': {'c': 'd'}}},\n 'key18': [],\n 'key19': {},\n 'key20': set(),\n 'key21': tuple(),\n 'key22': [1, \"string\", 3.14, True, None, b\"bytes\", [1, 2], {\"key\": \"value\"}],\n}\n\nencoded_data = bumble_bencoding.encode(data)\nprint(\"Encoded Data:\", encoded_data)\n\ndecoded_data = bumble_bencoding.decode(encoded_data)\nprint(\"Decoded Data:\", decoded_data)\n\nassert data == decoded_data, \"Data does not match\"\n```\n\nBumble makes it straightforward to encode and decode data while ensuring safety and efficiency. This quick example shows how seamless the process can be, providing a safer alternative to Pickle with similar versatility. \n\n### Note \nBumble is intentionally designed to not support all types in order to provide a safer and simpler alternative to Pickle. It focuses on the most common types and structures. \nBumble operates under the assumption that most users are pickling objects for their state, rather than requiring a true duplication of the object.\n\n---\nFeel free to experiment with various data types and structures to see how Bumble handles them with ease! \nIf you find any issues, please let me know by raising an issue on the GitHub repository. Your feedback is invaluable in improving Bumble for everyone.",
"bugtrack_url": null,
"license": null,
"summary": ".. include:: ../README.md",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "462cfd4dfe9ff34eea109853b31d4816ba2451695c79361a7f6414aacffff155",
"md5": "d53973d90fd3fc07414e18e3e279a749",
"sha256": "b777288308928dcbbb9d8ac2ff7d21c25f512ffd1a8cb11e3765b14afcbec73d"
},
"downloads": -1,
"filename": "bumble_bencoding-0.0.3-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d53973d90fd3fc07414e18e3e279a749",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 23654,
"upload_time": "2024-06-27T20:48:26",
"upload_time_iso_8601": "2024-06-27T20:48:26.951611Z",
"url": "https://files.pythonhosted.org/packages/46/2c/fd4dfe9ff34eea109853b31d4816ba2451695c79361a7f6414aacffff155/bumble_bencoding-0.0.3-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cc5272305f74d01b4fa71c528a87cddf0361319bf17f78f7d4f6bbae25754060",
"md5": "0e25190ab0232a40e1b12bdc0471d662",
"sha256": "36459e9270de9ce10ba3e08fcbaedb48cc84dd74db1db4e531b3a73c5158322e"
},
"downloads": -1,
"filename": "bumble_bencoding-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "0e25190ab0232a40e1b12bdc0471d662",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 47027,
"upload_time": "2024-06-27T20:48:28",
"upload_time_iso_8601": "2024-06-27T20:48:28.683894Z",
"url": "https://files.pythonhosted.org/packages/cc/52/72305f74d01b4fa71c528a87cddf0361319bf17f78f7d4f6bbae25754060/bumble_bencoding-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-27 20:48:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "bumble_bencoding"
}