Personally common and useful Python features
Project description
kaparoo-python
Personally common and useful Python features.
📦 Installation
Requires Python 3.14+.
# With uv (recommended)
uv add kaparoo-python
# With pip
pip install kaparoo-python
🧩 Modules
Each submodule ships its own README with focused examples.
kaparoo.filesystem
pathlib-based filesystem helpers: existence checks (*_exists),
ensure_* validators, make_dir(s) (with a destructive clean reset
option), dir_empty(s), reserve_path(s) guards for not-yet-existing
destinations, StagedFile / StagedDirectory for safe (atomic) writes,
path stringification, and a small exception hierarchy.
kaparoo.filesystem.search
Filesystem traversal with composable filters. Includes search_paths /
search_files / search_dirs, a Filter family (pattern, multi-pattern,
logical) that round-trips through JSON-friendly dicts, and an extension
hook for custom filter kinds.
kaparoo.utils
Timer / SegmentTimer context-manager-and-decorator timers (with
lap-split and measure-block timings); Aggregator for nested,
pluggable metric aggregation (the batch → epoch → run pattern); plus a
small family of helpers for working with Optional[T] values
(replace_if_none, unwrap_or_default, ...).
kaparoo.data
Building blocks for dataset code: DataSequence[T, M] ABC (item +
metadata), composers (SlicedSequence, ConcatSequence,
WindowedSequence), file-backed templates (FileFolderSequence,
SingleFileSequence), and generate_batches.
🎯 Quick example
from kaparoo.filesystem import search_files
from kaparoo.filesystem.search.filters import And, EndsWith, Equals, Not
# All .py files except __init__.py
py_files = search_files(
"src",
name_filter=And((EndsWith(".py"), Not(Equals("__init__.py")))),
)
See each submodule's README for more.
📋 TODO
See TODO.md for tracked open items.
📜 Changelog
See CHANGELOG.md for the version history.
⚖️ License
This project is distributed under the terms of the MIT license.
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 kaparoo_python-0.4.0.tar.gz.
File metadata
- Download URL: kaparoo_python-0.4.0.tar.gz
- Upload date:
- Size: 47.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3218baca533408fa4e2d0b63a7cd4d2238532cd6280be4fca5d5197055fb74
|
|
| MD5 |
2ce140fb9e631faa4e2d37c68d60e16c
|
|
| BLAKE2b-256 |
4431dc808f3a19d64a9d3c7cfde55f7bb28caac97f65228f9ca7b600cbbf2ba0
|
Provenance
The following attestation bundles were made for kaparoo_python-0.4.0.tar.gz:
Publisher:
publish.yml on kaparoo/kaparoo-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kaparoo_python-0.4.0.tar.gz -
Subject digest:
5c3218baca533408fa4e2d0b63a7cd4d2238532cd6280be4fca5d5197055fb74 - Sigstore transparency entry: 1694832726
- Sigstore integration time:
-
Permalink:
kaparoo/kaparoo-python@3dd4437d1ec4771a305d71645c7fa9dc10628233 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/kaparoo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3dd4437d1ec4771a305d71645c7fa9dc10628233 -
Trigger Event:
push
-
Statement type:
File details
Details for the file kaparoo_python-0.4.0-py3-none-any.whl.
File metadata
- Download URL: kaparoo_python-0.4.0-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b27c9354548bd27aaf1aec498616df6f4b7d60a6eeae5cd123b1a4a9e5129f7d
|
|
| MD5 |
72d23c040ce9a065da0f4355a60f042a
|
|
| BLAKE2b-256 |
1e44e79e7f98b77fe5be6cda8caf9b463aedcf0d4feedb5dd596aa6134e829e8
|
Provenance
The following attestation bundles were made for kaparoo_python-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on kaparoo/kaparoo-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kaparoo_python-0.4.0-py3-none-any.whl -
Subject digest:
b27c9354548bd27aaf1aec498616df6f4b7d60a6eeae5cd123b1a4a9e5129f7d - Sigstore transparency entry: 1694832786
- Sigstore integration time:
-
Permalink:
kaparoo/kaparoo-python@3dd4437d1ec4771a305d71645c7fa9dc10628233 -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/kaparoo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3dd4437d1ec4771a305d71645c7fa9dc10628233 -
Trigger Event:
push
-
Statement type: