Skip to main content

extpickle - extended pickle

Extends the original Pickler class to be able to pickle some otherwise non-supported types. The emphasis is to be fast and for communication via pipes/sockets with the same Python version on the other end - thus we don’t care that much for compatibility with other versions.

A similar project is dill, which is much bigger though.

This project is registered on PyPI and can be installed via

pip install extpickle

For some usage examples, see the test code.

Over the base Pickler class, it adds pickling support for:

  • types.FunctionType, types.CodeType and cell-types. I.e. you can pickle lamdas and functions. Note this will use the marshal module for the byte-code, so this is not portable across different Python versions.

  • Modules. This is done by referencing it via its name. Note that is has some extra handling for __main__, which is allowed to be a different module.

  • mod.__dict__ where mod is a module is also stored just as a reference to the module, not a copy of the dict.

  • (Python 2) buffer.

  • numpy.ndarray. This is also supported by the base class but our implementation is much faster. Actually this is a bit weird because the default implementation should also be just as fast but it isn’t. Our implementation basically just uses fromstring/tostring.

  • New-style classes. The base class would try to look them up in a module. This will fail whenever it cannot be find in such namespace. Our implementation, if that fails, will actually store the information to construct a new class, i.e. the name, the bases and its dict.

  • (Python 2) Old-style classes. This is the same behavior as for the new-style classes.

This was used in the TaskSystem project.

Metadata

Release files for extpickle 1.20160617.170648

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for extpickle 1.20160617.170648
File Size Uploaded
extpickle-1.20160617.170648.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for extpickle 1.20160617.170648
File Interpreter ABI Platform
extpickle-1.20160617.170648-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.4 kB

Release files / extpickle-1.20160617.170648.tar.gz

Download URL extpickle-1.20160617.170648.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6cd47b146e907285b678e03d3ec2040fbfcad21a2a4936617a9216f3f8d7bd13
BLAKE2b-256 checksum
How to use checksums
f17427ca8ec15a1c6fff167120f61972ab649ee56d68bdc516d11a8549cd9058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / extpickle-1.20160617.170648-py2.py3-none-any.whl

Download URL extpickle-1.20160617.170648-py2.py3-none-any.whl
Size 7.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e1fb36ca0e0a8b19b7873ae44a75276f87aae5784d211e7fd5414aded8d8516a
BLAKE2b-256 checksum
How to use checksums
4a5ef6bf1a57c19b3318cd9065dcafd952fd97ed850dad082af9dae12cbb3f89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page