Skip to main content

A decorator to cache function outputs to files using pickle.

Project description

picklecachefunc

picklecachefunc is a Python decorator to cache function outputs to files using pickle.

Installation

pip install picklecachefunc

Example usage

from picklecachefunc import picklecachefunc

@picklecachefunc(arg_name='file_name')
def compute_expensive_function(file_name, x, y):
    return x + y

result1 = compute_expensive_function(file_name='result1.pkl', x=3, y=4)
print(result1)

result2 = compute_expensive_function(file_name='result2.pkl', x=5, y=6)
print(result2)

License

MIT License

Copyright (c) 2024 Seong Joon Oh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

picklecachefunc-0.3.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

picklecachefunc-0.3.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file picklecachefunc-0.3.0.tar.gz.

File metadata

  • Download URL: picklecachefunc-0.3.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.17

File hashes

Hashes for picklecachefunc-0.3.0.tar.gz
Algorithm Hash digest
SHA256 21b8cd7f8da64c4c746b73e6f513e0c6c9c175da1942e0015d89465bcf0066ac
MD5 3cb387b1a8f6adb7ee8ef2ceb2f82676
BLAKE2b-256 2740e9967fce3ff53c2101a5685f881ac168db14a27b9bc516bc3ae633243a1f

See more details on using hashes here.

File details

Details for the file picklecachefunc-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for picklecachefunc-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b08689668a7efa52c7bd4540e2170d28f1f56fa8a3fcbebbb35b6f987346ddb3
MD5 ddf2e156365f2943b2a0fcfd4e05047a
BLAKE2b-256 f9ad9b5cd24fd59f58d7a57bb44f837313c1e0a1a56b977293e2b8007bfe9a9d

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