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:
numpy2 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
MissingClassMetato 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 classesTaxonomyandCategoryto represent hierarchical taxonomies-
new function
expression_from_init_params()to create an object’sExpressionrepresentation from the attributes in its__init__methodnew submodule
pytools.expression.reprwith enhanced versions of standard Python container classes implementing theHasExpressionReprinterface:ListWithExpressionReprfor listsTupleWithExpressionReprfor tuplesSetWithExpressionReprfor setsDictWithExpressionReprfor 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
apenddocto append docstrings to the docstring of another object, usually the constructor of the superclassAPI: new Sphinx callback class
ResolveTypeVariablesto resolve type variables in attribute signatures
pytools.text: new classTextTemplateto 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
HTMLStylefor 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.hexandRgbaColor.hexto return the color as a hexadecimal string
Various adjustments to maintain compatibility with recent Python versions
pytools 2.1#
2.1.3#
FIX:
DendrogramMatplotStylenow 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:
AllTrackernow resolves forward references in type aliases exported via__all__
2.1.0#
API: new decorator
fitted_onlyto mark methods that may only be called after their associated object has been fitted usingFittableMixin.fit()API: remove method
ensure_fittedfromFittableMixin, which is no longer needed due to the new decoratorfitted_only.API: new Sphinx callback
TrackCurrentClassto keep track of the current class being processed by autodoc.API: new Sphinx callback
RenamePrivateArgumentsto 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:
Expressionobjects 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
pandas2.0 and above
2.0.5#
API: de-dent docstrings before processing them with the
subsdocdecoratorFIX: in method
AllTracker.resolve_forward_references(), unwrap functions before accessing their__globals__attribute
2.0.4#
FIX: make
MatplotStyle.get_renderer()compatible withmatplotlib3.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
ResolveTypeVariablescompatible with Python 3.9FIX: recognise private (positional-only) arguments in
DocValidatorDOC: 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
Unionand 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 argumentoptionalAPI: 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
MatrixallowsMatrixDrawerto render flexible row and column widths, based on theMatrix.weightsproperty, and supports axis labels for the row, column, and weight axesAPI: moved class
LinkageTreeto modulepytools.data
pytools.expression#
API: improved conversion of
numpyarrays toExpressionobjects in functionmake_expression()API: removed method
get_class_idfrom classHasExpressionRepr
pytools.fit#
API: method
FittableMixin.ensure_fitted()is now public, replacing the formerly private method_ensure_fitted()
pytools.meta#
API: removed function
compose_metadue to conflicts with mypy static type checksAPI: new metaclass
SingletonABCMetacombiningSingletonMetaandABCMeta
pytools.parallelization#
API: method
JobRunner.run_jobs()now expects a single iterable ofJobobjects instead of individual jobs as positional argumentsAPI: method
JobRunner.run_queues()now expects a single iterable ofJobQueueobjects instead of individual queues as positional arguments, and returns alistof results instead of an iteratorAPI: methods
JobRunner.run_queue()andJobRunner.run_queues()are now thread-safeAPI: renamed method
collateof classJobQueuetoJobQueue.aggregate()API:
SimpleQueueis now an abstract class, expecting subclasses to implement methodSimpleQueue.aggregate()API: renamed class
NestedQueuetoCompositeQueue
pytools.sphinx#
API: new Sphinx callback class
ObjectDescriptionTransformAPI: renamed callback class
ResolveGenericClassParameterstoResolveTypeVariablesand 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
DendrogramMatplotStyleoffering a tighter layout and using the thickness of the dendrogram’s branches to indicate the cumulative weight of the leaf nodesAPI:
DendrogramMatplotStyle.paddingdetermines the adjustable padding between neighbouring branches; setting padding to zero produces a chart similar to the previous heatmap styleAPI:
DendrogramDrawerno longer sorts leaf nodes as part of the drawing process; the sorting mechanism is now available via methodLinkageTree.sort_by_weight()VIZ:
DendrogramMatplotStyleandDendrogramReportStylenow render leaves in left-to-right order, instead of the previous right-to-left orderAPI: the
DendrogramReportStylenow reduces the label section of the dendrogram to the length of the longest label; renamed thelabel_widthproperty tomax_label_widthAPI: moved class
LinkageTreeto modulepytools.dataAPI: new method
LinkageTree.iter_nodes()for depth-first traversal of the linkage tree
Matrices: major design overhaul
API: class
MatrixDrawernow expects instances of new classMatrixas its inputAPI:
MatrixDrawerno longer acceptsDataFrameobjects, butMatrix.from_frame()can be used to convert data frames to matrix objectsAPI: new attribute
MatrixMatplotStyle.nan_substitutespecifies the value to look up in the colormap to determine the color of undefined matrix cellsVIZ:
MatrixMatplotStyleenforces 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
RgbColorandRgbaColoras classes instead of type aliasesAPI: removed method
dark()from classColoredStyleand 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
ResolveGenericClassParametersto substitute generic type parameters introduced by base classes or via theselfandclsspecial method argumentsAPI: add sphinx processor
AutodocProcessBasesto 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 intotupleinstancesAPI: 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.pybuild script no longer imports the actual module to obtain the current package version, similarly as introduced formake.pyin pytools 1.1.7
1.1.7#
BUILD: update the
make.pybuild script to remove its reliance on importing the actual module just to obtain the build version; instead,make.pynow scans the top-level__init__.pyfile 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
DendrogramReportStyleFIX: calling method
get_class_idof classIdcould cause aTypeErrorFIX:
Replace3rdPartyDocsphinx callback now substitutes 3rd-party docstrings also forpropertydefinitions
1.1.5#
FIX: fixed a rare case where
Expression.eq_()returnedFalsefor two equivalent expressions if one of them included anExpressionAliasFIX: accept any type of numerical values as leaf weights of
LinkageTree
1.1.4#
BUILD: add support for
joblib1.0.*
1.1.3#
FIX: comparing two
InfixExpressionobjects using methodExpression.eq_()would erroneously yieldTrueif 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:
MatplotStylenow uses PyPlot’s current axes by default, instead of creating a new figure and axis
1.1.0#
API:
JobRunnerprovides a new object-oriented interface tojoblib, running instances ofJobandJobQueuein parallelAPI:
AllTrackerdetects and prohibits exporting objects imported from other modulesAPI:
AllTrackerdetects 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_gammaconda 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
MatplotStyleto apply color scheme toAxesobjectFIX: preserve correct instance for subclasses of singleton classes
FIX: add a few missing type hints
BUILD: add support for
numpy1.20BUILD: updates and changes to the CI/CD pipeline
1.0.1#
Initial release.