Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repickle-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repickle-0.1.0-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

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

Hashes for repickle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e53bf8581417a72ef4566a67011d164bbeeed9493aca1c6415650f69d947a59
MD5 a8b0ca791426e128333e99e0162e7574
BLAKE2b-256 aafa607a9e49f3587e18b52f15321c84d70fbf5329746c61d51e1ae0208fed3b

See more details on using hashes here.

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

Hashes for repickle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 544864c2663dd920ddbb935be42222f5fa7cc2724d9f0ff7a1d7d5858a74e8a9
MD5 6ec3b359cf3271c9b0a25fe80f275849
BLAKE2b-256 c3c42a657de8e74a35e4d69b44602ff0e32dabe9210277ad6c9e05dc7319805d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page