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 ./autosave/value_of_pi/yyyymmdd_HHMMSS_MS_00000.pkl

If used inside a Jupyter notebook named x.ipynb, it will instead save to ./x.ipynb.autosave/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 ./autosave/value_of_pi/yyyymmdd_HHMMSS_MS_00001.pkl

Load

The load function is just a wrapper around pickle:

pi = save_return.load('./autosave/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.1.0.tar.gz (2.0 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.1.0-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: save_return-0.1.0.tar.gz
  • Upload date:
  • Size: 2.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 725e1cb388c26f119b4b6c710041c61232f98a8ab9f59f45c310737fe3cb7f2c
MD5 a0bc9a86b4a8072dc1155d43962672be
BLAKE2b-256 5f528726b930e58b4a2d378491db1f643d2c2a0b4450cae209a9a650e933072c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: save_return-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3decf84843c031b29c4701b86e96dda2f0db0a769bf1b03bac66e07c366d14b
MD5 a09900e7f528d5e76d418c805d339ced
BLAKE2b-256 2f32e4804da68d38f1e8e81ff3e9edba82ae84923e7e16ac7fd0c76c0e1e7459

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