A collection of helper utilities for Python projects.
Project description
pytoolkit
pytoolkit is a small collection of helper modules that can be used across different Python projects.
The focus is on simple building blocks: configuration handling, logging, timing, HTTP helpers, caching, string helpers, and more.
Current version: 0.3.1
🌐 Website: www.actobotics.net
🐦 X/Twitter: @actoboticsnet
Project goals
- Provide small, composable utilities instead of a heavy framework
- Keep dependencies minimal and well known
- Make it easy to reuse the same helpers across many projects
- Stay readable and beginner friendly while still being robust
Installation
Basic Installation
pip install acto-pytoolkit
From Source
git clone https://github.com/actobotics/pyToolkit.git
cd pyToolkit
pip install -e .
Optional Dependencies
# For async HTTP client support
pip install acto-pytoolkit[async]
# For development (testing, linting, type checking)
pip install acto-pytoolkit[dev]
# For building documentation
pip install acto-pytoolkit[docs]
# Install everything
pip install acto-pytoolkit[all]
Usage overview
The package is split into focused modules:
config_loader- Load configuration from JSON, YAML, TOML, and .env fileslogger- Colored logging with environment-based configurationtimer- Function timing and profiling utilitieshttp_client- Sync HTTP client with retry logicasync_http_client- Async HTTP client using aiohttp (optional)crypto_utils- Hashing and secure token generationfile_utils- Safe file operations with atomic writescache- In-memory caching with TTL supportretry- Retry decorator with exponential backoffvalidators- Validation for email, URL, UUID, IP addressesmath_tools- Moving average, normalization, scalingstring_tools- Slugify, case conversion, text processingtask_scheduler- Simple in-process task schedulingenv- Environment detection utilitiescli- Command-line interface frameworkcontext_utils- Nested dictionary operationsserialization- JSON, YAML, TOML helpers
See the examples directory for small, complete scripts, or check the full documentation.
Quick Example
from pytoolkit import ConfigLoader, get_logger, HttpClient
# Configure logging
logger = get_logger()
# Load configuration
config = ConfigLoader(env_file=".env", json_file="config.json")
api_url = config.get("API_URL", "https://api.example.com")
# Make HTTP request with automatic retries
with HttpClient(base_url=api_url, max_retries=3) as client:
response = client.get("/users")
users = client.json(response)
logger.info("Fetched %d users", len(users))
CLI
After installation a small CLI entry point is available:
pytoolkit info
pytoolkit env
Use pytoolkit --help to see available commands.
Contributing
- Fork the repository
- Create a new branch for your change
- Add or adjust tests where it makes sense
- Run the test suite:
python -m unittest discover -s tests
- Open a pull request with a short description of your change
Versioning
The project follows a simple semantic versioning scheme:
- Breaking changes bump the major version
- New features bump the minor version
- Small fixes bump the patch version
Key Features
🚀 Enhanced HTTP Client
- Support for PATCH method
- Custom headers and authentication
- Async HTTP client with aiohttp
🎯 Improved Validators
- Better email validation (RFC 5322 compliant)
- URL validation with TLD requirements
- Strict mode options
🧪 Comprehensive Testing
- 80%+ code coverage
- Tests for all modules
- CI/CD with GitHub Actions
📚 Complete Documentation
- Sphinx documentation
- API reference for all modules
- Quick start guide and examples
🛠️ Developer Tools
- Pre-commit hooks (Black, Ruff)
- MyPy strict type checking
- Automated testing on Python 3.9-3.12
Changelog
See CHANGELOG.md for a detailed history of changes.
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 acto_pytoolkit-0.3.1.tar.gz.
File metadata
- Download URL: acto_pytoolkit-0.3.1.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07a496fa4a0ca084d7d3c4fe25960d12cbf16e67b1a315ad5e87fa8660ff8841
|
|
| MD5 |
1fc753114ba1b41126e829cc79501ce2
|
|
| BLAKE2b-256 |
a0ded1a87dfeca00bd169e9eed420b16a06e21e917bb99257a4ed0735dac35f0
|
Provenance
The following attestation bundles were made for acto_pytoolkit-0.3.1.tar.gz:
Publisher:
release.yml on actobotics/pyToolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
acto_pytoolkit-0.3.1.tar.gz -
Subject digest:
07a496fa4a0ca084d7d3c4fe25960d12cbf16e67b1a315ad5e87fa8660ff8841 - Sigstore transparency entry: 776336327
- Sigstore integration time:
-
Permalink:
actobotics/pyToolkit@1c4a3eb24c454ab545e7c97db5e2bf63b54d5251 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/actobotics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1c4a3eb24c454ab545e7c97db5e2bf63b54d5251 -
Trigger Event:
release
-
Statement type:
File details
Details for the file acto_pytoolkit-0.3.1-py3-none-any.whl.
File metadata
- Download URL: acto_pytoolkit-0.3.1-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ddcdec47bd868c9f35a22e205d54a8ff1e9d07d40ab8f6ec3724ae88b64eecb
|
|
| MD5 |
78de6ebced895119f0d34fbe74ef6690
|
|
| BLAKE2b-256 |
013152f73e174ec67d1d9867f261bc3b4bba7672d578e5956d098f355ac3f4e6
|
Provenance
The following attestation bundles were made for acto_pytoolkit-0.3.1-py3-none-any.whl:
Publisher:
release.yml on actobotics/pyToolkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
acto_pytoolkit-0.3.1-py3-none-any.whl -
Subject digest:
4ddcdec47bd868c9f35a22e205d54a8ff1e9d07d40ab8f6ec3724ae88b64eecb - Sigstore transparency entry: 776336360
- Sigstore integration time:
-
Permalink:
actobotics/pyToolkit@1c4a3eb24c454ab545e7c97db5e2bf63b54d5251 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/actobotics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1c4a3eb24c454ab545e7c97db5e2bf63b54d5251 -
Trigger Event:
release
-
Statement type: