Skip to main content

A library to help facilitate memory recall

Project description

psg_recall

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/problemsolversguild/psg_recall.git

or from pypi

$ pip install psg_recall

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on pypi.

How to use

psg_recall provides persistent memory storage at three levels:

  • Global - Memories shared across all projects (stored in ~/.solveit_memory/)
  • Project - Memories for the current project directory (stored in .memory/)
  • File - Memories tied to a specific file (stored in .memory/{filename}_memory.txt)
from psg_recall.storage import remember, recall, recall_all, recall_history, forget

Storing memories

Use remember() to store a key-value pair. By default it stores at the project level:

# Store a project-level memory
remember("user_name", "Alice")
# Store a global memory (available across all projects)
remember("api_preference", "openai", level="global")
# Store a file-specific memory (context specifies the filename)
remember("last_edit", "fixed bug on line 42", level="file", context="main.py")

Recalling memories

Use recall() to retrieve memories from a specific level. Returns None if the key doesn’t exist:

# Recall a specific key from project level
recall(key="user_name")
# Recall all project-level memories
recall()
# Recall from global level
recall(level="global")

Recalling from all levels

Use recall_all() to get memories from global, project, and file levels combined:

# Get all memories across all levels
print(recall_all(context="main.py"))  # include file context to also get file-level memories

Forgetting memories

Use forget() to remove a key from memory. This also records the removal in history:

# Forget a project-level memory
forget("user_name")

Viewing history

Use recall_history() to see past changes to memories, including timestamps and whether values were remembered or forgotten:

# View all history for project level
print(recall_history())
# View history for a specific key
print(recall_history(key="user_name"))

Export

from nbdev import nbdev_export
from nbdev.quarto import nbdev_docs

nbdev_export()
nbdev_docs()

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

psg_recall-0.0.4.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

psg_recall-0.0.4-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file psg_recall-0.0.4.tar.gz.

File metadata

  • Download URL: psg_recall-0.0.4.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for psg_recall-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6bf69eb2625f70fb56423533b5c770552c816f4d91b56a5108b3957a2cc091e6
MD5 bf696e4540d7e6a712df1b67650a2f88
BLAKE2b-256 ec7c9c15031ba781ae0a98a775da3746ee9e4991099833dcade61e9f8d7949a0

See more details on using hashes here.

File details

Details for the file psg_recall-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: psg_recall-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for psg_recall-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e4104bd90fac5a8d14ea1a54ef1438145775153a5e96a27f3112996aa1d63d65
MD5 e6841d4aa522b40480176e2bd0bb9a1d
BLAKE2b-256 f669038f4a05583cd6a2748e4e554d46a5ccc3c528cb39e4650ab519f0cc41af

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