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.

📜 News

Treestamps has a NEWS file to summarize changes that affect users.

🕸️ HTML Docs

HTML formatted docs are available here

🛠️ Use

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

🛠️ API

There are some autogenerated API docs that might be better than nothing available in the header of this documentations, but it might just be better to read the code and look at the example of use in nudebomb.

🛠️ Development

Treestamps is hosted at Github

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.3.0.tar.gz (176.4 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.3.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: treestamps-2.3.0.tar.gz
  • Upload date:
  • Size: 176.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for treestamps-2.3.0.tar.gz
Algorithm Hash digest
SHA256 012ff940e1a5bdd91b2079d914c82d5354e605af8fa161b3fb381914088d6c5e
MD5 300c41f548d3e9a00b086c1683c39d72
BLAKE2b-256 d8eede09e737786d73d7a22b576eb1680836c5d085a823ccdddcde6bb1f9ea9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: treestamps-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for treestamps-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de316179a862bd5a232cd1f11e34c738b82f3375d6096181059ecd887075f864
MD5 75c1fa97b4974edcbe032f0e85b1a1c4
BLAKE2b-256 9aa110f0f3b094cff9589dded698115b9153b9015bd1592c7fcae6b6223ac80f

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