Skip to main content

CI/CD Pipeline Coverage

Snapshooter (fsspec folder backup and restore tooling)

Snapshooter is a tool to back up and restore a folder in a fsspec file system. It is designed to be used with the fsspec file system library, which provides a unified interface to various file systems (e.g. local, azure, s3, ...).

Key features:

  • Backup side is decomposed into two parts: The snapshots and the heap
    • Snapshots: The snapshots store the files information as provided by the fsspec file system, with the following transformations:
      • The metadata object is jsonified
      • The file name of each file is changed to be relative to the src_root folder
      • An additional md5 field is added, containing the md5 hash of the file contents. This allows for efficient diffing of files.
    • Heap: The heap folder stores the file contents into file with the md5 hash of the file as the file name. This allows for efficient deduplication of files.
  • Efficient incremental backups: Only files that are unknown are copied to the heap file system.

Installation

pip install snapshooter

Usage with CLI

make a snapshot

snapshooter \
  --file-root tests/unit_test_data/sample_src \
  --heap-root tests/temp/sample_heap \
  --snap-root tests/temp/sample_snap \
  make-snapshot

restore the latest snapshot

snapshooter \
  --file-root tests/unit_test_data/restored_src \
  --heap-root tests/temp/sample_heap \
  --snap-root tests/temp/sample_snap \
  restore-snapshot

restore the latest snapshot before or at a given timestamp

snapshooter \
  --file-root tests/unit_test_data/restored_src \
  --heap-root tests/temp/sample_heap \
  --snap-root tests/temp/sample_snap \
  restore-snapshot \
  --latest 2021-09-01T00:00:00  

restore a specific snapshot

snapshooter \
  --file-root tests/unit_test_data/restored_src \
  --heap-root tests/temp/sample_heap \
  --snap-root tests/temp/sample_snap \
  restore-snapshot \
  --path tests/temp/sample_snap/2024/04/2024-04-10_14-30-40_086601Z.jsonl.gz  

list snapshots

snapshooter \
  --file-root tests/unit_test_data/restored_src \
  --heap-root tests/temp/sample_heap \
  --snap-root tests/temp/sample_snap \
  list-snapshots

compare snapshots

snapshooter \
  --file-root tests/unit_test_data/sample_src \
  --heap-root tests/temp/sample_heap \
  --snap-root tests/temp/sample_snap \
  compare-snapshots \
  --path1 tests/temp/sample_snap/2024/04/2024-04-10_14-30-40_086601Z.jsonl.gz \

Snapshot can be identified by the options path1, latest1, path2, latest2, in the same way as in the command restore-snapshot.

support for storage options (e.g. to pass credentials)

Example: Azure file system, See accepted syntax directly in the adlfs documentation: https://pypi.org/project/adlfs/.

az login
snapshooter \
  --file-root az://file-container/file-root \
  --heap-root az://heap-container/heap-root \
  --snap-root az://snap-container/snap-root \
  --file-storage-options '{"account_name": "fileaccountname"}' \
  --heap-storage-options '{"account_name": "heapaccountname"}' \
  --snap-storage-options '{"account_name": "snapaccountname"}' \
  make-snapshot

Usage with Python

See the CLI implementation here for an example of how to use the Snapshooter class.

Supported file systems

The current version has been developed and tested with local and azure file systems.

For other file systems: a single function needs to be implemented and added to the md5_getter_by_fs_protocol dictionary in fsspec_utils.py. This function takes as input the current metadata of a file and the latest snapshot and should return the md5 hash of the file contents if it can be retrieved without downloading the file. If the md5 hash cannot be retrieved, the function should return None and the file will be downloaded.

Pull requests are welcome.

Metadata

Release files for snapshooter 1.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snapshooter 1.0.19
File Size Uploaded
snapshooter-1.0.19.tar.gz 20.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for snapshooter 1.0.19
File Interpreter ABI Platform
snapshooter-1.0.19-py3-none-any.whl Python 3 none any Details

Total release size: 42.0 kB

Release files / snapshooter-1.0.19.tar.gz

Download URL snapshooter-1.0.19.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ace2dad40fcdb9a3636ecdd430568ea9a7297e31b90c8d3196fc4e7691f36ad2
BLAKE2b-256 checksum
How to use checksums
951f0359964737f541b978464773fb8d4aaeb54aacfe9c0ec151b7dfc052d82d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2025.

Transparency log

Release files / snapshooter-1.0.19-py3-none-any.whl

Download URL snapshooter-1.0.19-py3-none-any.whl
Size 21.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e50e0184e01f51cd2aba0bf9893bd6f80711fabdbf96080f2c2abeafeeb8df7
BLAKE2b-256 checksum
How to use checksums
43507beeacb436b587d3786efcf1dcd964412f375f07056fc1ef083c454ce70e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.19 This release

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

0.9.17

2 release files

0.9.16

2 release files

0.9.3

2 release files

0.1.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page