Pytool is a collection of utilities and language enhancements for Python
Project description
Pytool Package
pytool is a collection of often used helper methods and classes that make life
easier or fill in gaps in the Python Standard Library.
Pytool is compatible with and tested against Python 3.8 and higher. End of life Python versions are not supported.
[!NOTE] Pytool 4.x is a major release that is not backwards compatible with earlier versions. It now requires Python 3.8 or higher, and adds Python 3 type annotations among other improvements. New features will only be added to the 4.x release line.
Pytool's source is hosted on Github: https://github.com/shakefu/pytool
Any comments, issues or requests should be submitted via Github: https://github.com/shakefu/pytool/issues
Features
Pytool provides a rich set of utilities across several key areas:
Command Line Tools (pytool.cmd)
- Create robust command-line applications with minimal boilerplate, featuring built-in subcommand support and automatic help generation
- Seamless integration with argparse for argument parsing, with automatic support for configargparse when available
- Built-in signal handling for graceful process management and reloading
- Console script entry point support for easy distribution and installation
- Automatic environment variable integration through configargparse
Language Utilities (pytool.lang)
Namespaceclass for creating flexible, nested data structures with dot-notation access and automatic nestingsingletonandhashed_singletondecorators for efficient instance management and cachingclasspropertydecorator for creating class-level properties, filling a gap in Python's standard libraryget_nameutility for detailed frame inspection and debuggingUNSETsentinel value for clear handling of optional parameters
Time Management (pytool.time)
- Comprehensive UTC-aware datetime handling with proper timezone support
Timerclass for precise performance measurements and benchmarkingago()helper for intuitive relative time calculations with flexible time unit support- Week-based time calculations for scheduling and reporting
- Robust timezone conversion utilities with daylight savings handling
JSON Handling (pytool.json)
- Enhanced JSON serialization with built-in support for:
- Datetime objects with proper timezone handling
- BSON ObjectId types for MongoDB integration
- Custom object serialization via the
for_json()protocol
- Intelligent fallback between simplejson and stdlib json for optimal performance
- Consistent datetime formatting across different JSON implementations
Text Processing (pytool.text)
- Terminal-aware text wrapping that adapts to your console width
- Smart column width detection with fallback options
- Intelligent indentation preservation for code and documentation
- Paragraph-aware text formatting that maintains document structure
- Automatic handling of mixed indentation styles
Proxy Objects (pytool.proxy)
ListProxyfor transparent list manipulation with custom behavior modificationDictProxyfor dictionary behavior modification without copying data- Support for custom JSON serialization of proxy objects
- Efficient memory usage through reference-based operations
- Seamless integration with existing list and dict operations
Documentation
Read the complete documentation on Read the Docs!
Installation
Pytool is available on PyPI for your installation ease.
pip install pytool
Usage
Pytool is a collection of common and useful functions designed to help your code be easier to read, write and maintain. The API is well documented with examples of how they might be used.
See the complete documentation on Read The Docs for more information.
Contributors
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 pytool-6.0.3.tar.gz.
File metadata
- Download URL: pytool-6.0.3.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cd8ae2aab998c672726194bc09115f2c7b25ad276b2fd6cc37df959f1abcbb2
|
|
| MD5 |
df2e83b99cc42027678f1f9d02a73870
|
|
| BLAKE2b-256 |
be139884ee0c6aa49774eeccd0558e26c9325bd15384b0ecff2038a29d457458
|
Provenance
The following attestation bundles were made for pytool-6.0.3.tar.gz:
Publisher:
release.yaml on shakefu/pytool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytool-6.0.3.tar.gz -
Subject digest:
4cd8ae2aab998c672726194bc09115f2c7b25ad276b2fd6cc37df959f1abcbb2 - Sigstore transparency entry: 234518352
- Sigstore integration time:
-
Permalink:
shakefu/pytool@115538f1784caf8aab4e86a580b9915e42c3a834 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shakefu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@115538f1784caf8aab4e86a580b9915e42c3a834 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pytool-6.0.3-py3-none-any.whl.
File metadata
- Download URL: pytool-6.0.3-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50c5284fbe8abe4170bd2c4c05301b424d9c469cd4254f7a4e91b8aefb61011a
|
|
| MD5 |
4f50d76e8871a4ceceb4ea4cbc2dc35c
|
|
| BLAKE2b-256 |
f72790a1da41e5c493f7f6173e8ddb29341d4e004b1d69626076a2cb5781d537
|
Provenance
The following attestation bundles were made for pytool-6.0.3-py3-none-any.whl:
Publisher:
release.yaml on shakefu/pytool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytool-6.0.3-py3-none-any.whl -
Subject digest:
50c5284fbe8abe4170bd2c4c05301b424d9c469cd4254f7a4e91b8aefb61011a - Sigstore transparency entry: 234518357
- Sigstore integration time:
-
Permalink:
shakefu/pytool@115538f1784caf8aab4e86a580b9915e42c3a834 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shakefu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@115538f1784caf8aab4e86a580b9915e42c3a834 -
Trigger Event:
push
-
Statement type: