Extended pickling support for Python object
Project description
Repickle
Repickle makes it possible to serialize Python constructs not supported by the default pickle module from the Python standard library. Repickle just extends cloudpickle and add support for load and dump to files.
Installation
The latest release of repickle is available from
pypi:
pip install repickle
Examples
Pickling a lambda expression:
>>> import repickle
>>> squared = lambda x: x ** 2
>>> repickle.dump_to_file(squared, "pickled_lambda.pkl")
>>> new_squared = repickle.load_from_file("pickled_lambda.pkl")
>>> new_squared(2)
4
Pickling a function interactively defined in a Python shell session
(in the __main__ module):
>>> CONSTANT = 42
>>> def my_function(data: int) -> int:
... return data + CONSTANT
...
>>> import repickle
>>> repickle.dump_to_file(my_function, "pickled_lambda.pkl")
>>> depickled_function = repickle.load_from_file("pickled_lambda.pkl")
>>> depickled_function(43)
85
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file repickle-0.1.0.tar.gz.
File metadata
- Download URL: repickle-0.1.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e53bf8581417a72ef4566a67011d164bbeeed9493aca1c6415650f69d947a59
|
|
| MD5 |
a8b0ca791426e128333e99e0162e7574
|
|
| BLAKE2b-256 |
aafa607a9e49f3587e18b52f15321c84d70fbf5329746c61d51e1ae0208fed3b
|
File details
Details for the file repickle-0.1.0-py3-none-any.whl.
File metadata
- Download URL: repickle-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
544864c2663dd920ddbb935be42222f5fa7cc2724d9f0ff7a1d7d5858a74e8a9
|
|
| MD5 |
6ec3b359cf3271c9b0a25fe80f275849
|
|
| BLAKE2b-256 |
c3c42a657de8e74a35e4d69b44602ff0e32dabe9210277ad6c9e05dc7319805d
|