Skip to content

Added save_snapshot, updated code snippets#21

Merged
petruki merged 1 commit into
masterfrom
staging
Oct 2, 2025
Merged

Added save_snapshot, updated code snippets#21
petruki merged 1 commit into
masterfrom
staging

Conversation

@petruki
Copy link
Copy Markdown
Member

@petruki petruki commented Oct 2, 2025

This pull request introduces enhancements to the snapshot management functionality in the Switcher client, focusing on enabling local snapshot persistence and improving usability for local development and automated updates. The main changes include adding the ability to save snapshots to disk, updating the callback mechanism for snapshot updates, and expanding the playground tests to demonstrate these new use cases.

Snapshot Persistence and Management:

  • Added a new save_snapshot function in snapshot_loader.py to persist snapshots to disk at a specified location, supporting local mode and enabling snapshot reuse between runs.
  • Updated the check_snapshot method in client.py to save the snapshot to disk if a snapshot_location is provided in the context options.
  • Enhanced the Snapshot class in types.py with a to_dict method for serializing the snapshot back to its original dictionary format, supporting JSON export.
  • Modified imports in client.py to include the new save_snapshot function.

Callback and Usability Improvements:

  • Improved the schedule_snapshot_auto_update callback signature for clarity, and updated the example in README.md to print the snapshot version when updated. [1] [2]

Testing and Playground Enhancements:

  • Extended tests/playground/index.py with new use cases to demonstrate loading snapshots from remote sources and auto-updating snapshots with local persistence, including configurable environment and snapshot location. [1] [2]

Internal Data Handling:

  • Updated the Snapshot class to store the original data for accurate serialization and export.

@petruki petruki self-assigned this Oct 2, 2025
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Oct 2, 2025

@petruki petruki merged commit 15aaa40 into master Oct 2, 2025
13 checks passed
@petruki petruki deleted the staging branch October 2, 2025 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant