Skip to main content

Personally common and useful Python features

Project description

kaparoo-python

PyPI version Downloads Python License: MIT uv Ruff ty Copier

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; experimental); 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, TransformedSequence, WindowedSequence, ZippedSequence), file-backed templates (FileFolderSequence, FileListSequence, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaparoo_python-0.6.0.tar.gz (52.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kaparoo_python-0.6.0-py3-none-any.whl (53.5 kB view details)

Uploaded Python 3

File details

Details for the file kaparoo_python-0.6.0.tar.gz.

File metadata

  • Download URL: kaparoo_python-0.6.0.tar.gz
  • Upload date:
  • Size: 52.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaparoo_python-0.6.0.tar.gz
Algorithm Hash digest
SHA256 3889947e6b08bd18bd165300be140e23400e7a2c0a60f31087e9dd5d5e7cdaee
MD5 380a31cca7e72d8a9a7824f54e1c4ef8
BLAKE2b-256 06eb268a9e4760059edfed0c3c56288eec185ffb23e6ad490094db6c6ac7b894

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaparoo_python-0.6.0.tar.gz:

Publisher: publish.yml on kaparoo/kaparoo-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaparoo_python-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: kaparoo_python-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 53.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kaparoo_python-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ea0927cdbee56bb42f100e896c5b5b8f17db601f4ba9f34ffca0a0b43cd1413
MD5 117807e7293f32dd236a95451da65a50
BLAKE2b-256 ed1c1e21cdddbc31ce2cf61d32f315b8b2d0e3e1f7b737f99b899df7f6ea11f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaparoo_python-0.6.0-py3-none-any.whl:

Publisher: publish.yml on kaparoo/kaparoo-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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