Skip to main content

A Python library that captures and replays function results to save time, boost performance.

Project description

resnap logo

resnap

Smart function output snapshots and caching for Python
resnap snapshots and reuses function outputs based on their inputs, saving time with smart caching and metadata tracking.


🚀 Features

  • Snapshot and cache function/method outputs on disk
  • Avoid re-executing code when inputs haven’t changed
  • Supports multiple formats:
    • For pd.DataFrame objects: parquet (default) and csv
    • For other objects: pkl (default), json, and txt.
      (Note that for the "json" format, the object type must be compatible with the json.dump method.)
  • Stores metadata automatically
  • Add custom metadata
  • Minimal setup, flexible usage

📦 Installation

pip install resnap

🧪 Quick Example

from resnap import snap

@snap()
def expensive_computation(x, y):
    print("Running the actual computation...")
    return x * y + 42

result = expensive_computation(10, 2)

Second call with same arguments:

# Output is retrieved from cache — no print, no computation
result = expensive_computation(10, 2)

📁 Output Structure

Each snapshot includes:

  • A result file (in the format of your choice)
  • A metadata file (e.g., timestamp, arguments, execution time, etc.)

📚 Documentation

(Coming soon)

🛡️ License

This project is licensed under the MIT License. See the LICENSE file for details.

🤝 Contributing

Contributions, issues and feature requests are welcome! Feel free to open a PR or start a discussion.

⭐️ Show your support If you find this project useful, give it a ⭐️ on GitHub!

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

resnap-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

resnap-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file resnap-0.0.1.tar.gz.

File metadata

  • Download URL: resnap-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for resnap-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3cbff820575565d5e7265bdbd5aec7e56de53126378a5657b8d80a960b825ee2
MD5 65272b1227ee045d9ecc6e0ffd2059b5
BLAKE2b-256 aed23c586070709b93530b24f141ebae257f8b942da0704571f91b71d03c630a

See more details on using hashes here.

File details

Details for the file resnap-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: resnap-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for resnap-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 800204407c89a98e4431e7bec64fbcfbb7e44832486d096d4d823038f3b7ab5b
MD5 99d9bded1821f9f6c771c3aee0dceab6
BLAKE2b-256 f8069e8dae3530afa744b8606621598dfe53c42eb75c3754dd2f7cefb96d2646

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