Skip to main content

Create timestamp records for recursive operations on directory trees.

Project description

Treestamps

A library to set and retrieve timestamps to speed up operations run recursively on directory trees.

Documentation is pretty poor. Read the code for now.

Usage

Used in picopt and nudebomb. You can see how it's used in those projects.

    from pathlib import Path
    from treestamps import Grovestamps, GrovestampsConfig

    config = GrovestampsConfig(
        "MyProgramName",
        paths=("/foo", "/bar"),
        program_config={ "option_a": True, "option_b": False}
    )
    gs = Grovestamps(config)

    timestamp = gs[Path("/foo")].get()
    assert None == timestamp.get("file_relative_to_foo.txt")
    mtime = timestamp.set("file_relative_to_foo.txt")
    # mtime ~= now()
    # Also writes to `/foo/.MyProgramName_treestamps.wal.yaml`

    gs.dump()

Dumping removes /foo/.MyProgramName_treestamps.wal.yaml and writes to /foo/.MyProgramName_treestamps.yaml and /bar/.MyProgramName_treestamps.yaml

    # With similar config to above
    gs = Grovestamps(config)
    # Auto loads timestamps relevant to paths in config.

    timestamp_foo = gs[Path("/foo")].get()
    mtime_b = timestamp_foo.get("file_relative_to_foo.txt")
    mtime_a = timestamp_foo.get("another_file_relative_to_foo.txt")
    # mtime will be the time gs.dump() you called above.
    assert mtime_a == mtime_b

    timestamp_bar = gs[Path("/bar")].get()
    mtime_c = timestamp_foo.get("file_relative_to_bar.txt")
    assert mtime_c == mtime_a

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

treestamps-2.2.6.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

treestamps-2.2.6-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file treestamps-2.2.6.tar.gz.

File metadata

  • Download URL: treestamps-2.2.6.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.2

File hashes

Hashes for treestamps-2.2.6.tar.gz
Algorithm Hash digest
SHA256 3ba400f8c52f9eb9a705af2d7fb834c0b226facad4839f4ac16d7a979254e874
MD5 c1e13b73621399fc70c79405ec944333
BLAKE2b-256 be70dcc490620e0a21cb883980c155e0fd815c607d495e02801b1fc5ffa8442d

See more details on using hashes here.

File details

Details for the file treestamps-2.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for treestamps-2.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 54a53fc2dc22640b81d28db1d467a3f687d8f06deaadf457305fc94547e867aa
MD5 510e1849016c0d978f0fddab87d78b61
BLAKE2b-256 9c82b74ff44be0a45d437ff9556d9b28a7b1ef31b24d770f5e20c18f54e10ca4

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