# 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](https://github.com/ajsater/picopt) and
[nudebomb](https://github.com/ajsater/nudebomb). You can see how it's used in
those projects.
<!-- eslint-skip -->
```python
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`
<!-- eslint-skip -->
```python
# 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ajslater/treestamps",
"name": "treestamps",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "timestamps,library,recursive,directory",
"author": "AJ Slater",
"author_email": "aj@slater.net",
"download_url": "https://files.pythonhosted.org/packages/71/b8/196b004fd62f2b4d93f60774123476b29669db79084e8caaee8dbb6ea96f/treestamps-1.0.1.tar.gz",
"platform": null,
"description": "# Treestamps\n\nA library to set and retrieve timestamps to speed up operations run recursively\non directory trees.\n\nDocumentation is pretty poor. Read the code for now.\n\n## Usage\n\nUsed in [picopt](https://github.com/ajsater/picopt) and\n[nudebomb](https://github.com/ajsater/nudebomb). You can see how it's used in\nthose projects.\n\n<!-- eslint-skip -->\n\n```python\n from pathlib import Path\n from treestamps import Grovestamps, GrovestampsConfig\n\n config = GrovestampsConfig(\n \"MyProgramName\",\n paths=(\"/foo\", \"/bar\"),\n program_config={ \"option_a\": True, \"option_b\": False}\n )\n gs = Grovestamps(config)\n\n timestamp = gs[Path(\"/foo\")].get()\n assert None == timestamp.get(\"file_relative_to_foo.txt\")\n mtime = timestamp.set(\"file_relative_to_foo.txt\")\n # mtime ~= now()\n # Also writes to `/foo/.MyProgramName_treestamps.wal.yaml`\n\n gs.dump()\n```\n\nDumping removes `/foo/.MyProgramName_treestamps.wal.yaml` and writes to\n`/foo/.MyProgramName_treestamps.yaml` and `/bar/.MyProgramName_treestamps.yaml`\n\n<!-- eslint-skip -->\n\n```python\n # With similar config to above\n gs = Grovestamps(config)\n # Auto loads timestamps relevant to paths in config.\n\n timestamp_foo = gs[Path(\"/foo\")].get()\n mtime_b = timestamp_foo.get(\"file_relative_to_foo.txt\")\n mtime_a = timestamp_foo.get(\"another_file_relative_to_foo.txt\")\n # mtime will be the time gs.dump() you called above.\n assert mtime_a == mtime_b\n\n timestamp_bar = gs[Path(\"/bar\")].get()\n mtime_c = timestamp_foo.get(\"file_relative_to_bar.txt\")\n assert mtime_c == mtime_a\n```\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "Create timestamp records for recursive operations on directory trees.",
"version": "1.0.1",
"project_urls": {
"Documentation": "https://github.com/ajslater/treestamps",
"Homepage": "https://github.com/ajslater/treestamps",
"Issues": "https://github.com/ajslater/treestamps/issues",
"Source": "https://github.com/ajslater/treestamps"
},
"split_keywords": [
"timestamps",
"library",
"recursive",
"directory"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9ff3f5940d80b5f0438d0fe31b6ffe576f6039de1e737b43a00697548950806c",
"md5": "2041481a4c2230f36eee56e8c5169804",
"sha256": "d837fdb039470430c424a9e734acdebc0f93723968b96f3f6de4f54b2928897f"
},
"downloads": -1,
"filename": "treestamps-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2041481a4c2230f36eee56e8c5169804",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 23036,
"upload_time": "2024-02-19T00:55:48",
"upload_time_iso_8601": "2024-02-19T00:55:48.777914Z",
"url": "https://files.pythonhosted.org/packages/9f/f3/f5940d80b5f0438d0fe31b6ffe576f6039de1e737b43a00697548950806c/treestamps-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "71b8196b004fd62f2b4d93f60774123476b29669db79084e8caaee8dbb6ea96f",
"md5": "743e48890058da9bafe4ab44e332a406",
"sha256": "6541202b3b750bd24c0266b4dd6d149528b7bb0a82678b15ed8635dc626d0054"
},
"downloads": -1,
"filename": "treestamps-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "743e48890058da9bafe4ab44e332a406",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 23191,
"upload_time": "2024-02-19T00:55:50",
"upload_time_iso_8601": "2024-02-19T00:55:50.394420Z",
"url": "https://files.pythonhosted.org/packages/71/b8/196b004fd62f2b4d93f60774123476b29669db79084e8caaee8dbb6ea96f/treestamps-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-19 00:55:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ajslater",
"github_project": "treestamps",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"circle": true,
"lcname": "treestamps"
}