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.3.tar.gz (24.9 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.3-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for treestamps-2.2.3.tar.gz
Algorithm Hash digest
SHA256 6598face7d7c76069c412450b8a0f5ed956d7b7c1095f8beeca0e48d8184fcba
MD5 971dbc1035446180e4c99ada5077d3f0
BLAKE2b-256 270fd9011a36fcabda2701043a6f3ac84c1cbc9da17689af80d54604c09859f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treestamps-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.0

File hashes

Hashes for treestamps-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 24e1605b4e0e00dee3fc5d0ea251c7ccb2c5238aee9e50abd5cee670b5156333
MD5 6fadba83c49d0b939e9efd4f4deee5f9
BLAKE2b-256 04f00f2d8408a97e761a53c7a5f85592a9140b33de1bffb2c5568b469f0a3809

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