Registry / data / pytools

pytools

JSON →
library2026.1pypypi✓ verified 35d ago

Pytools is a comprehensive collection of utilities designed to augment the Python standard library, offering a diverse set of tools for various programming needs. It includes functionalities for mathematical operations, persistent key-value stores, graph algorithms, and object array handling. Maintained by Andreas Kloeckner, it serves primarily as a dependency for his other software packages but provides valuable utilities for direct use. The library is actively developed, with frequent releases, currently at version 2026.1.

datadatabase
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

For various memoization strategies like memoize_method.

from pytools import memoize

To use the persistent key-value store.

from pytools.persistent_dict import PersistentDict

For in-memory relational database table functionality.

from pytools.datatable import DataTable

For the lexer functionality.

from pytools import lex

This example demonstrates how to use `pytools.memoize.memoize_method` to cache the results of an expensive method, preventing redundant computations for the same inputs. Subsequent calls with identical arguments will return the cached value instantly.

import time from pytools import memoize class MyService: def __init__(self): self.compute_calls = 0 @memoize.memoize_method def expensive_computation(self, data_id): self.compute_calls += 1 time.sleep(0.1) # Simulate a time-consuming operation return f"Result for {data_id} (computed on call {self.compute_calls})" service = MyService() print(service.expensive_computation("user_profile_123")) print(service.expensive_computation("user_profile_123")) # This call will use the cached result print(service.expensive_computation("product_data_abc"))
Debug
Known footguns
breakingThe `Tag` constructor was removed around `v2024.1.8`, breaking compatibility for code relying on it. Some releases were yanked due to this change.
deprecatedThe logging functionality previously under `pytools.log` has been spun out into a separate, dedicated project called `logpyle`.
gotchaPytools primarily serves as an internal dependency for the author's other scientific computing projects. While it offers useful general-purpose utilities, its design and sometimes opaque naming conventions might require users to delve into its documentation to find specific tools.
gotchaPytools requires Python 3.10 or higher. Older Python versions are not supported.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources