Release Notes#
pytools 3.0#
pytools 3.0 adds support for language features introduced up to and including Python 3.10, and drops support for Python versions.
pytools 3.0.2#
BUILD:
numpy
2 is now supportedFIX:
issubclass_generic()
now supports unions, tuples of types, andNone
, and uses clearer error messages if called with invalid arguments
pytools 3.0.1#
BUILD: add support for Python 3.10
pytools 3.0.0#
pytools.api
: new utility functions to get object’s init parameters, validate__all__
declarations, and define stand-in objects for missing classes and functionsAPI: new function
get_init_params()
to retrieve the object attributes associated with the object’s__init__
methodAPI: new metaclass
MissingClassMeta
to define a stand-in class for a missing class that could not be imported from an optional dependencyAPI: new function
missing_function()
to define a stand-in function for a missing function that could not be imported from an optional dependencyAPI: new function
validate__all__declarations()
to validate the__all__
declarations of a module and its submodules
pytools.asyncio
: new module with utility functions for asynchronous programmingarun()
to run an asynchronous function in a new event loopaenumerate()
to enumerate an asynchronous iterableasync_flatten()
to flatten nested asynchronous iterables for optimized asynchronous processingiter_async_to_sync()
to convert an asynchronous iterable to a synchronous oneiter_sync_to_async()
to convert a synchronous iterable to an asynchronous oneunpack_exception_group()
to unpack an exception group into one or more individual exceptions
pytools.data.taxonomy
: new submodule with classesTaxonomy
andCategory
to represent hierarchical taxonomies-
new function
expression_from_init_params()
to create an object’sExpression
representation from the attributes in its__init__
methodnew submodule
pytools.expression.repr
with enhanced versions of standard Python container classes implementing theHasExpressionRepr
interface:ListWithExpressionRepr
for listsTupleWithExpressionRepr
for tuplesSetWithExpressionRepr
for setsDictWithExpressionRepr
for dictionaries
pytools.http
: new module with functionfetch_url()
to download a file from a URLpytools.repr
: new module with mixin classHasDictRepr
, providing a method to return a dictionary representation of an objectpytools.sphinx
: new utilities for generating Sphinx documentationAPI: new decorator
apenddoc
to append docstrings to the docstring of another object, usually the constructor of the superclassAPI: new Sphinx callback class
ResolveTypeVariables
to resolve type variables in attribute signatures
pytools.text
: new classTextTemplate
to generate text from a template string with stricter management of template variablespytools.typing
: new module for generic type inspection at runtimenew function
get_common_generic_base()
to retrieve the common generic base class of two typesnew function
get_common_generic_subclass()
to retrieve the common generic subclass of two typesnew function
get_generic_bases()
to retrieve the generic base classes of a typenew function
get_generic_instance()
to retrieve the generic instance of a typenew function
get_type_arguments()
to retrieve the type arguments of a generic typenew function
isinstance_generic()
to check if an object is an instance of a generic typenew function
issubclass_generic()
to check if a type is a subclass of a generic type
-
API: new class
HTMLStyle
for rendering HTML content with drawersAPI: new function
is_running_in_notebook()
to check if the code is running in a Jupyter or Colab notebookAPI: new property
RgbColor.hex
andRgbaColor.hex
to return the color as a hexadecimal string
Various adjustments to maintain compatibility with recent Python versions
pytools 2.1#
2.1.3#
FIX:
DendrogramMatplotStyle
now callsAxis.set_ticklabels()
using a positional argument for the labels, to address a change in matplotlib 3.7
2.1.2#
This is a maintenance release to catch up with pytools 2.0.7.
2.1.1#
API:
AllTracker
now resolves forward references in type aliases exported via__all__
2.1.0#
API: new decorator
fitted_only
to mark methods that may only be called after their associated object has been fitted usingFittableMixin.fit()
API: remove method
ensure_fitted
fromFittableMixin
, which is no longer needed due to the new decoratorfitted_only
.API: new Sphinx callback
TrackCurrentClass
to keep track of the current class being processed by autodoc.API: new Sphinx callback
RenamePrivateArguments
to rename private “positional-only” arguments in a function’s signature (with two leading underscores) back to their original names in the source code, so that autodoc can pick them up correctly.API:
Expression
objects support plain text and HTML output in Jupyter notebooks
pytools 2.0#
pytools 2 introduces enhanced visualisations along with additional API improvements, and is now subject to static type checking with mypy.
2.0.7#
FIX: prevent matplot warnings about missing fonts when rendering drawers using the
MatplotStyle
2.0.6#
BUILD: add support for
pandas
2.0 and above
2.0.5#
API: de-dent docstrings before processing them with the
subsdoc
decoratorFIX: in method
AllTracker.resolve_forward_references()
, unwrap functions before accessing their__globals__
attribute
2.0.4#
FIX: make
MatplotStyle.get_renderer()
compatible withmatplotlib
3.6
2.0.3#
REFACTOR: rename arg of
FittableMixin.fit()
to__x
, so that mypy recognizes it as a positional-only argument, and that subclasses can change its name without breaking the APIFIX: make
ResolveTypeVariables
compatible with Python 3.9FIX: recognise private (positional-only) arguments in
DocValidator
DOC: show original names of private (positional-only) arguments in Sphinx documentation, not their substituted private names generated by Python
2.0.2#
REFACTOR: run mypy type checks in strict mode
FIX: more reliably determine the class when resolving type variables for Sphinx API documentation
FIX: no longer raise an exception when attempting to get the class name for
Union
and other “special” types
2.0.1#
FIX: in class
AllTracker
, do not attempt to update forward references in imported objectsBUILD: update build scripts to support the stricter dependency resolver introduced by pip 20.3, and to fix a compatibility issue with recent updates to nbsphinx
BUILD: enable local sphinx builds in other FACET packages
DOC: simplify how the docs build manages existing documentation of previous versions in the Azure pipeline and the associated commands in make.py: under the new approach, documentation is only preserved for the latest patch of each minor version, reducing the amount of near-similar documentation
DOC: use pydata sphinx theme v0.9 (but disable dark mode)
2.0.0#
pytools.api
#
API: collection validation/conversion functions
to_set()
,to_tuple()
,to_list()
, andto_collection()
have a new argumentoptional
API: decorator
subsdoc()
has a new optional argumentusing
, indicating an object whose docstring will be used as the basis for creating the substituted docstring of the decorated object
pytools.data
#
API: new class
Matrix
allowsMatrixDrawer
to render flexible row and column widths, based on theMatrix.weights
property, and supports axis labels for the row, column, and weight axesAPI: moved class
LinkageTree
to modulepytools.data
pytools.expression
#
API: improved conversion of
numpy
arrays toExpression
objects in functionmake_expression()
API: removed method
get_class_id
from classHasExpressionRepr
pytools.fit
#
API: method
FittableMixin.ensure_fitted()
is now public, replacing the formerly private method_ensure_fitted()
pytools.meta
#
API: removed function
compose_meta
due to conflicts with mypy static type checksAPI: new metaclass
SingletonABCMeta
combiningSingletonMeta
andABCMeta
pytools.parallelization
#
API: method
JobRunner.run_jobs()
now expects a single iterable ofJob
objects instead of individual jobs as positional argumentsAPI: method
JobRunner.run_queues()
now expects a single iterable ofJobQueue
objects instead of individual queues as positional arguments, and returns alist
of results instead of an iteratorAPI: methods
JobRunner.run_queue()
andJobRunner.run_queues()
are now thread-safeAPI: renamed method
collate
of classJobQueue
toJobQueue.aggregate()
API:
SimpleQueue
is now an abstract class, expecting subclasses to implement methodSimpleQueue.aggregate()
API: renamed class
NestedQueue
toCompositeQueue
pytools.sphinx
#
API: new Sphinx callback class
ObjectDescriptionTransform
API: renamed callback class
ResolveGenericClassParameters
toResolveTypeVariables
and updated to resolve type variables also in attribute signatures
pytools.text
#
API: new function
camel_case_to_snake_case()
pytools.viz
#
Additions and enhancements to dendrogram and matrix visualizations.
Dendrograms: major design overhaul
API: replaced the heatmap and line dendrogram styles with a single, freshly designed
DendrogramMatplotStyle
offering a tighter layout and using the thickness of the dendrogram’s branches to indicate the cumulative weight of the leaf nodesAPI:
DendrogramMatplotStyle.padding
determines the adjustable padding between neighbouring branches; setting padding to zero produces a chart similar to the previous heatmap styleAPI:
DendrogramDrawer
no longer sorts leaf nodes as part of the drawing process; the sorting mechanism is now available via methodLinkageTree.sort_by_weight()
VIZ:
DendrogramMatplotStyle
andDendrogramReportStyle
now render leaves in left-to-right order, instead of the previous right-to-left orderAPI: the
DendrogramReportStyle
now reduces the label section of the dendrogram to the length of the longest label; renamed thelabel_width
property tomax_label_width
API: moved class
LinkageTree
to modulepytools.data
API: new method
LinkageTree.iter_nodes()
for depth-first traversal of the linkage tree
Matrices: major design overhaul
API: class
MatrixDrawer
now expects instances of new classMatrix
as its inputAPI:
MatrixDrawer
no longer acceptsDataFrame
objects, butMatrix.from_frame()
can be used to convert data frames to matrix objectsAPI: new attribute
MatrixMatplotStyle.nan_substitute
specifies the value to look up in the colormap to determine the color of undefined matrix cellsVIZ:
MatrixMatplotStyle
enforces a 1:1 aspect ratio for the row and column axes, so that equal row and column widths represent equal weights
API: new public method
Drawer.get_style_kwargs()
, replacing the previously private method_get_style_kwargs()
API: implement
RgbColor
andRgbaColor
as classes instead of type aliasesAPI: removed method
dark()
from classColoredStyle
and instead introduce constantsColorScheme.DEFAULT
,ColorScheme.DEFAULT_LIGHT
, andColorScheme.DEFAULT_DARK
pytools 1.2#
1.2.5#
This is a maintenance release to catch up with pytools 1.1.10.
1.2.4#
This is a maintenance release to catch up with pytools 1.1.8.
1.2.3#
This release enhances support for generating Sphinx documentation, and catches up with pytools 1.1.7.
API: add sphinx processor
ResolveGenericClassParameters
to substitute generic type parameters introduced by base classes or via theself
andcls
special method argumentsAPI: add sphinx processor
AutodocProcessBases
to handle autodoc-process-bases events (introduced in Sphinx 4.1)API: function
validate_type()
now accepts multiple alternative types to validate values against, in line with howisinstance()
tests for multiple types
1.2.2#
This is a maintenance release to catch up with pytools 1.1.5.
1.2.1#
This is a maintenance release to catch up with pytools 1.1.4.
1.2.0#
API: new function
to_collection()
preserves any type of collection, and converts iterators intotuple
instancesAPI: functions
to_set()
,to_list()
,to_tuple()
,to_collection()
, andvalidate_element_types()
now accept multiple alternative types to validate elements against, in line with howisinstance()
tests for multiple typesBUILD: add support for
matplotlib
~= 3.0,scipy
~= 1.6, and typing-inspect ~= 0.7
pytools 1.1#
1.1.10#
This release addresses additional issues in the release process, focusing on the make_base.py script for Sphinx builds used across gamma-pytools, sklearndf, and gamma-facet.
1.1.9#
This is a bugfix release to restore the GitHub release process.
1.1.8#
BUILD: the
make_base.py
build script no longer imports the actual module to obtain the current package version, similarly as introduced formake.py
in pytools 1.1.7
1.1.7#
BUILD: update the
make.py
build script to remove its reliance on importing the actual module just to obtain the build version; instead,make.py
now scans the top-level__init__.py
file for a__version__
declaration
1.1.6#
VIZ: set colors of axis labels to the foreground color of the current color scheme
FIX: ensure correct weight labels when rendering dendrograms as plain text using the
DendrogramReportStyle
FIX: calling method
get_class_id
of classId
could cause aTypeError
FIX:
Replace3rdPartyDoc
sphinx callback now substitutes 3rd-party docstrings also forproperty
definitions
1.1.5#
FIX: fixed a rare case where
Expression.eq_()
returnedFalse
for two equivalent expressions if one of them included anExpressionAlias
FIX: accept any type of numerical values as leaf weights of
LinkageTree
1.1.4#
BUILD: add support for
joblib
1.0.*
1.1.3#
FIX: comparing two
InfixExpression
objects using methodExpression.eq_()
would erroneously yieldTrue
if both expressions had the same operator but a different number of operands, and the operands of the shorter expression were equal to the operands at the start of the longer expression
1.1.2#
Catch up with fixes and pipeline updates introduced by pytools 1.0.3 and 1.0.4
API: support inheriting class docstrings from superclasses using the
inheritdoc()
decoratorAPI: new
subsdoc()
decorator to replace text in docstringsAPI: use background color for matrix grid in
MatrixMatplotStyle
1.1.1#
API:
MatplotStyle
now uses PyPlot’s current axes by default, instead of creating a new figure and axis
1.1.0#
API:
JobRunner
provides a new object-oriented interface tojoblib
, running instances ofJob
andJobQueue
in parallelAPI:
AllTracker
detects and prohibits exporting objects imported from other modulesAPI:
AllTracker
detects and prohibits exporting global constants (the preferred approach is to define constants inside classes as this provides better context, and will be properly documented via Sphinx)
pytools 1.0#
1.0.6#
FIX: back-port pytools 1.1 bugfix for
Expression.eq_()
1.0.5#
FIX: back-port pytools 1.1 bugfix for building multi-version documentation
1.0.4#
FIX: do not substitute
~=
by~==
when adapting version syntax for tox
1.0.3#
This is a maintenance release focusing on enhancements to the CI/CD pipeline, along with minor fixes.
BUILD: add the
bcg_gamma
conda channel when buildingBUILD: Enforce pre-release for minor and major releases
DOC: add pre-commit hook instructions to contribution guide
BUILD: update flake8 to 3.9.0
BUILD: apply make_base.py changes from 1.1.x also on develop (adds more robust parsing of package versions)
FIX: version syntax adaptation with mixed
=
and>=
1.0.2#
This is a maintenance release focusing on enhancements to the CI/CD pipeline, along with minor fixes.
API: sort list of items returned by
AllTracker.get_tracked()
API: add protected method to class
MatplotStyle
to apply color scheme toAxes
objectFIX: preserve correct instance for subclasses of singleton classes
FIX: add a few missing type hints
BUILD: add support for
numpy
1.20BUILD: updates and changes to the CI/CD pipeline
1.0.1#
Initial release.