pyTooling is a powerful collection of arbitrary useful classes, decorators,
meta-classes and exceptions. It's useful for any Python-base project independent
if it's a library, framework or CLI tool.
Overloading
→ Overloading allows method overloading in Python classes. It dispatches method calls based on method signatures
(type annotations).
Singleton
→ A class created from meta-class Singleton allows only a single instance to exist. If a further instance is tried to
be created, a cached instance will be returned.
SlottedType
→ All type-annotated fields in a class get stored in a slot rather than in __dict__. This improves the memory
footprint as well as the field access performance of all class instances. The behavior is automatically inherited to
all derived classes.
frompyTooling.CallByRefimportCallByRefIntParam# define a call-by-reference parameter for integer valuesmyInt=CallByRefIntParam(3)
# a function using a call-by-reference parameterdeffunc(param: CallByRefIntParam):
param <<= param*4# call the function and pass the wrapper objectfunc(myInt)
print(myInt.Value)
pyTooling/pyTooling
pyTooling
pyTooling is a powerful collection of arbitrary useful classes, decorators, meta-classes and exceptions. It's useful for any Python-base project independent if it's a library, framework or CLI tool.
Introduction
TODO
Package Details
Common Classes
Emulation of call-by-reference parameters.
Class representations of semantic version (SemVer) and calendar version (CalVer) numbers.
Data Structures
→ A fast and simple implementation using a single
Node
class.Decorators
@InheritDocString
→ Copy the doc-string from given base-class.
@export
→ Register the given function or class as publicly accessible in a module.
Exceptions
... is raised when an expected environment variable is missing.
... is raise if the platform is not supported.
... is raise if the requested setting is not configured.
Meta-Classes
→
Overloading
allows method overloading in Python classes. It dispatches method calls based on method signatures (type annotations).→ A class created from meta-class
Singleton
allows only a single instance to exist. If a further instance is tried to be created, a cached instance will be returned.→ All type-annotated fields in a class get stored in a slot rather than in
__dict__
. This improves the memory footprint as well as the field access performance of all class instances. The behavior is automatically inherited to all derived classes.Packaging
tbd
Examples
@export
DecoratorCallByRefIntParam
Contributors
License
This Python package (source code) licensed under Apache License 2.0.
The accompanying documentation is licensed under Creative Commons - Attribution 4.0 (CC-BY 4.0).
SPDX-License-Identifier: Apache-2.0