All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning since version 1.1.0.
This release introduces a new decorator,
output_names,
designed for use with user-defined connector and selector functions. If you've
ever encountered an OSError: could not get source code using either
create_edges
or
create_edges_ft,
this release addresses that issue. The output_names decorator allows you to
explicitly define the names of the output variables returned by these
functions, avoiding the need to read source code.
-
deepgraph.output_namesdecorator: A new decorator to explicitly define the output variable names of connector or selector functions. This is necessary when the source code of the function is not available at runtime. The decorator attaches the specified output names to the decorated function via the _output_names attribute.Example:
import deepgraph as dg @dg.output_names("dx", "dt", "v") def velocity(x_s, x_t, time_s, time_t): dx = x_t - x_s dt = time_t - time_s v = dx/dt return dx, dt, v
- Fixed
OSError: could not get source codeby introducing theoutput_namesdecorator for explicitly defining output variable names in user-defined functions.
This release adds support for new, valid return formats of user-defined connector/selector functions (see create_edges). Specifically, explicit tuples and multi-line return statements are now possible. This enhancement increases flexibility and improves input validation.
The public API remains unchanged.
- Introduced a robust AST-based implementation for extracting output variables from user-defined functions.
-
This improves reliability and parsing accuracy across supported Python versions (3.9+).
-
The extraction now strictly enforces that return statements contain only variable names.
-
It is now also possible to return output variables as:
Example: explicit tuple
def velocity(dt, x_s, x_t): dx = x_t - x_s v = dx / dt return (v, dx)
Example: multi-line tuple
def velocity(dt, x_s, x_t): dx = x_t - x_s v = dx / dt return ( v, dx )
-
- Added CHANGELOG.md file.
- Replaced previous string-based return parsing using
inspect.getsourcelines()with a more accurate approach usinginspect.getsource()and theastmodule. - Output validation errors will now be raised if the return statement contains expressions, function calls, or anything other than variable names.
- Updated input argument parsing logic to use
inspect.signature()instead ofinspect.getfullargspec(), improving forward compatibility.
- The conda recipe to build a conda package locally. Conda packages are build by conda-forge using this recipe.
- Resolved "UnclosedFileWarning: Closing remaining open file" warnings in tests involving hdf tables.
- Homogenized license information across project files
pyproject.tomlhad wrong license information (BSD-2-Clause), changed it to the correct one (BSD-3-Clause).