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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
treestamps-1.0.2.tar.gz
(23.2 kB
view details)
Built Distribution
File details
Details for the file treestamps-1.0.2.tar.gz
.
File metadata
- Download URL: treestamps-1.0.2.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/5.15.0-1056-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2c015bec12dde11c4faada5244c5fb5f7b35f8f38076c3a9804d5929bebb42f |
|
MD5 | 886d66f9aae53dd83dd63a9e113a6960 |
|
BLAKE2b-256 | b5fb26daea5e85fed262df2d7af92a60f93cc8fdd9d28e9ef366608dbe39da92 |
File details
Details for the file treestamps-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: treestamps-1.0.2-py3-none-any.whl
- Upload date:
- Size: 23.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/5.15.0-1056-aws
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 253a039e35bdc7e9f94d1fe1ab21cf361988a3d7ea6cea480d496fe20a4859be |
|
MD5 | f24af34f1f64e2a3868db2d0ffa6321d |
|
BLAKE2b-256 | 5e4e5f0ca12aca6bbfa6d7410b01366cc1ac01b143c583363e4a3a9532086687 |