Create timestamp records for recursive operations on directory trees.
Reason this release was yanked:
storing wrong timestamp paths.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file treestamps-1.2.3.tar.gz.
File metadata
- Download URL: treestamps-1.2.3.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33c9c4dee03baaabe7e321850fc2ad41235dfecab510c52eaac269246a9620b2
|
|
| MD5 |
46bacdda1a96384a7aef1607ebdd6624
|
|
| BLAKE2b-256 |
b420bfe77d41595983e4689429ce6ba1eb69ac560cc2d97d973e4bf16d5c8315
|
File details
Details for the file treestamps-1.2.3-py3-none-any.whl.
File metadata
- Download URL: treestamps-1.2.3-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f80198cfeb0099b2baada6ac41a01498bb3390c9b22c9a59951d25a3cde6a89
|
|
| MD5 |
70052264261eeccb89fdf59c1ee6e2dd
|
|
| BLAKE2b-256 |
04e852fc64db72e6141f82afd8a07ac3ce5e62aed56bbbe29b7b4d34d86401a7
|