Enhanced pathlib with age and size utilities using lambdas
Project description
TPath - Enhanced pathlib with Age and Size Utilities
TPath is a pathlib extension that provides first-class age and size functions for file operations using a lambda-based approach (instead of operator overloading like pathql). It allows you to get file ages and sizes in natural, expressive syntax.
Installation
Using uv (Recommended)
# Install directly from source
uv add git+https://github.com/yourusername/tpath.git
# Or for development
git clone https://github.com/yourusername/tpath.git
cd tpath
uv sync --dev
Using pip
# Install from PyPI (when published)
pip install tpath
# Or install from source
pip install git+https://github.com/yourusername/tpath.git
Quick Start
from tpath import TPath
# Basic usage - works like pathlib.Path
path = TPath("my_file.txt")
# Age functionality
print(f"File is {path.age.days} days old")
print(f"File is {path.age.hours} hours old")
print(f"Modified {path.mtime.age.minutes} minutes ago")
# Size functionality
print(f"File size: {path.size.mb} MB")
print(f"File size: {path.size.gib} GiB")
# Size parsing from strings
large_size = TPath.size.fromstr("1.5GB")
if path.size.bytes > large_size:
print("This is a large file!")
Key Features
- Lambda-based design: No operator overloading confusion
- Full pathlib compatibility: Drop-in replacement for pathlib.Path
- Natural syntax: path.age.days instead of path.age > days(7)
- Comprehensive time units: seconds, minutes, hours, days, weeks, months, years
- Multiple size units: bytes, KB/KiB, MB/MiB, GB/GiB, TB/TiB
- String parsing: Parse size strings like "1.5GB", "500MB"
- Different time types: Handle ctime, mtime, atime separately
Development
This project uses uv for dependency management and packaging. See UV_GUIDE.md for detailed instructions.
# Install development dependencies
uv sync --dev
# Run tests
uv run python -m pytest
# Build package
uv build
# Format code
uv run ruff format
# Lint code
uv run ruff check
License
MIT License - see LICENSE file for details.
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 tpath-0.1.0.tar.gz.
File metadata
- Download URL: tpath-0.1.0.tar.gz
- Upload date:
- Size: 42.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07171b19bae18be00a002ad6cf6fc33d4d62733d95d6da97cad71b76dbde8596
|
|
| MD5 |
1118dd432ca36796a59f270135123ce6
|
|
| BLAKE2b-256 |
0ab4a1605d7fddd3a20553eabef6caed4b1c701d4f2c99ccc3b2961575bcd6bb
|
File details
Details for the file tpath-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tpath-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d985c7aed912f7de062d1504aa3134d9cd293b4de0f600fae6c13c599add9b3
|
|
| MD5 |
75adfe356a2ca83ab4ebe88d966f6e2f
|
|
| BLAKE2b-256 |
3209b0a0a257f806b77e621ab11054249e54fec5769e085f51f79a6ae1ef7844
|