Skip to main content

Save the return value of the decorated function to a versioned pickle file

Project description

save-return

Save the return value of the decorated function to a versioned pickle file.

Save

import save_return

@save_return.save('value_of_pi')
def calc_pi():
    return 4

pi = calc_pi()

This will pickle.save pi to ./data/save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl

If used inside a Jupyter notebook named x.ipynb, it will instead save to ./x.ipynb.save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl

Use @save_return.save(..., save_dir="some-dir") to customize the save location.

pi = calc_pi()

Call it again will save pi to ./data/save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00001.pkl

Load

The load function is just a wrapper around pickle:

pi = save_return.load('./data/save_return/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl')

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

save_return-0.2.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

save_return-0.2.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file save_return-0.2.0.tar.gz.

File metadata

  • Download URL: save_return-0.2.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for save_return-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e72b6cab48fe06f8e4746e7ed149feb68a0d37a2649dd004c77e5745080510a7
MD5 4490abbfb7b75a147599f4079a9daf0b
BLAKE2b-256 7e9fd2f1e9dcdee90f69d6fa8039b634c4d828e354377cd9f4700eaecef30672

See more details on using hashes here.

File details

Details for the file save_return-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: save_return-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for save_return-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf7f7c3574103e6d70e071c4bc95f7deacd1fb88ad16bed20b20b788bf1ec59b
MD5 78901d3f2244b18a78a785c6899e20d4
BLAKE2b-256 163cf94250b69cce0914dd25860911d31de8e439080ed4b5d0ecd2f704ef8b97

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