Skip to main content

pickle / unpickle variables

Tested against Windows 10 / Python 3.10 / Anaconda

pip install varpickler

decode_var(obj: Any, pickle_or_dill: str = 'dill', base: str = 'base64', str_decode: str | None = None) -> Any
    Decode a Python object that was encoded using either the 'pickle' or 'dill' library,
    and then decode the baseXX encoded result.
    
    Parameters:
        obj (str or bytes): The encoded object to be decoded.
        pickle_or_dill (str, optional): The library to be used for decoding.
            Valid options are 'pickle' or 'dill'. Defaults to 'dill'.
        base (str, optional): The base encoding used in the encoded object.
            Defaults to 'base64'.
        str_decode (str, optional): The string encoding used after baseXX encoding.
            If None, no additional string decoding is performed. Defaults to None.
    
    Returns:
        object: The decoded object.
    
    Example:
        import numpy as np
        obj = np.array([23, 34, 4])
        a1 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode=None)
        a2 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode="utf-8")
        a3 = decode_var(a1, pickle_or_dill="dill", base="base64", str_decode=None)
        print(a3)
        a4 = decode_var(a2, pickle_or_dill="dill", base="base64", str_decode="utf-8")
        print(a4)
    
        [23 34  4]
        [23 34  4]
encode_var(obj: Any, pickle_or_dill: str = 'dill', base: str = 'base64', str_encode: str | None = None) -> str | bytes
        Encode a Python object using either the 'pickle' or 'dill' library, and then encode the result using baseXX encoding.
    
        Parameters:
            obj (object): The object to be encoded.
            pickle_or_dill (str, optional): The library to be used for encoding.
                Valid options are 'pickle' or 'dill'. Defaults to 'dill'.
            base (str, optional): The base encoding to be used.
                Defaults to 'base64'.
            str_encode (str, optional): The string encoding to be used after baseXX encoding.
                If None, no additional string encoding is performed. Defaults to None.
    
        Returns:
            str or bytes: The encoded object. If 'str_encode' is None, a bytes object is returned.
                Otherwise, a string object is returned.
    
        Example:
            obj = np.array([23, 34, 4])
            >>> a1 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode=None)
            >>> print(a1)
            b'gAWVtgAAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKIwVbnVtcHkuY29yZS5t
    dWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeU
    KEsBSwOFlGgGjAVkdHlwZZSTlIwCaTSUiYiHlFKUKEsDjAE8lE5OTkr/////Sv////9LAHSUYolD
    DBcAAAAiAAAABAAAAJR0lE50lFKULg==
    '
    
            >>> a2 = encode_var(obj, pickle_or_dill="dill", base="base64", str_encode="utf-8")
            >>> print(a2)
            'gAWVtgAAAAAAAACMCmRpbGwuX2RpbGyUjA1fY3JlYXRlX2FycmF5lJOUKIwVbnVtcHkuY29yZS5t
            dWx0aWFycmF5lIwMX3JlY29uc3RydWN0lJOUjAVudW1weZSMB25kYXJyYXmUk5RLAIWUQwFilIeU
            KEsBSwOFlGgGjAVkdHlwZZSTlIwCaTSUiYiHlFKUKEsDjAE8lE5OTkr/////Sv////9LAHSUYolD
            DBcAAAAiAAAABAAAAJR0lE50lFKULg=='

	

Metadata

Release files for varpickler 0.10

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

Source distribution (sdist)

Source distribution for varpickler 0.10
File Size Uploaded Provenance Actions
varpickler-0.10.tar.gz 5.0 kB Without provenance Details for varpickler-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for varpickler 0.10
File Interpreter ABI Platform Actions
varpickler-0.10-py3-none-any.whl Python 3 none any Details for varpickler-0.10-py3-none-any.whl

Total release size: 11.8 kB

Release files / varpickler-0.10.tar.gz

Download URL varpickler-0.10.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a47d0aa1cdeecbee5f4241e46117e20317bd9852536acdc6c4f2c8546ffaa51c
BLAKE2b-256 checksum
How to use checksums
7c03f7acc4cdd406f27275a37700eae2d5bccd6630e2cde7de158f045482cf66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / varpickler-0.10-py3-none-any.whl

Download URL varpickler-0.10-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a886bc308179cc1247f9c66e86bcc135fde539b57d302ea56f63e1326e736506
BLAKE2b-256 checksum
How to use checksums
6058f4211776b1bf47c90ea8c10f838fee5dbd2eb85130bf2adcf526a790d777
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for varpickler 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

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