Skip to main content
https://travis-ci.org/localvoid/py-filespy.png?branch=master

FileSpy is a simple library that helps you detect filesystem changes.

API

CHANGE_TYPE

CREATED = 0

DELETED = 1

MODIFIED = 2

make_snapshot

make_snapshot(path, followlinks=False) -> dict()

path - directory path

followlinks=False - follow links when traversing through directory

Creates a directory snapshot. Snapshot doesn’t hold any information about directory in which this snapshot was done, so you can easily compare directories in a different locations.

It returns a simple dictionary, where keys is a file path and value is os.stat() of this file. It is done in a such way to make serialization of this data as simple as possible.

snapshot_diff

snapshot_diff(s1, s2) -> tuple(CHANGE_TYPE, path)

Generator that yields changes between two snapshots.

Example

s1 = filespy.make_snapshot('/dir')
time.sleep(3)
s2 = filespy.make_snapshot('/dir')
for t, path in filespy.snapshot_diff(s1, s2):
    if t == filespy.CREATED:
        on_create(path)
    elif t == filespy.DELETED:
        on_delete(path)

Here we are taking snapshot of the directory /dir, then sleep for 3 seconds, take another snapshot, and finally looking at the changes.

Metadata

Release files for filespy 1.1

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

Source distribution (sdist)

Source distribution for filespy 1.1
File Size Uploaded Provenance Actions
filespy-1.1.tar.gz 2.3 kB Without provenance Details for filespy-1.1.tar.gz

Release files / filespy-1.1.tar.gz

Download URL filespy-1.1.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7521bebb47d721dc2b5d146f639855d83c47fa270f1b30ebf1e1ae15d5365bca
BLAKE2b-256 checksum
How to use checksums
9e00de010eacfaa3336a4645c5345085783f00e2c828af50b86dcdf8a2d74fda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for filespy 1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file No provenance

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