Skip to main content

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

CI Coveralls

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)

  • Namespace class for creating flexible, nested data structures with dot-notation access and automatic nesting
  • singleton and hashed_singleton decorators for efficient instance management and caching
  • classproperty decorator for creating class-level properties, filling a gap in Python's standard library
  • get_name utility for detailed frame inspection and debugging
  • UNSET sentinel value for clear handling of optional parameters

Time Management (pytool.time)

  • Comprehensive UTC-aware datetime handling with proper timezone support
  • Timer class for precise performance measurements and benchmarking
  • ago() 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)

  • ListProxy for transparent list manipulation with custom behavior modification
  • DictProxy for 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

Metadata

Release files for pytool 6.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytool 6.0.3
File Size Uploaded
pytool-6.0.3.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytool 6.0.3
File Interpreter ABI Platform
pytool-6.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 54.7 kB

Release files / pytool-6.0.3.tar.gz

Download URL pytool-6.0.3.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4cd8ae2aab998c672726194bc09115f2c7b25ad276b2fd6cc37df959f1abcbb2
BLAKE2b-256 checksum
How to use checksums
be139884ee0c6aa49774eeccd0558e26c9325bd15384b0ecff2038a29d457458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release files / pytool-6.0.3-py3-none-any.whl

Download URL pytool-6.0.3-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50c5284fbe8abe4170bd2c4c05301b424d9c469cd4254f7a4e91b8aefb61011a
BLAKE2b-256 checksum
How to use checksums
f72790a1da41e5c493f7f6173e8ddb29341d4e004b1d69626076a2cb5781d537
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 10, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

6.0.3 This release

2 release files

6.0.2

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.0.0

2 release files

3.16.2

2 release files

3.16.1

2 release files

3.16.0

2 release files

3.15.0

2 release files

3.14.2

2 release files

3.14.1

2 release files

3.14.0

2 release files

3.13.0

2 release files

3.11.0

2 release files

3.10.1

2 release files

3.10.0

1 release file

3.9.0

1 release file

3.8.1

2 release files

3.8.0

2 release files

3.7.1

2 release files

3.7.0

2 release files

3.6.0

2 release files

3.5.0

1 release file

3.4.2

1 release file

3.4.1

1 release file

3.4.0

1 release file

3.3.0

1 release file

3.2.0

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.1

1 release file

2.4.1

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3.0

1 release file

2.2.0

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0

1 release file

2.0.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page