Changelog#
This project uses semantic versioning
UNRELEASED#
7.1.0 (2024-05-03)#
New Feaatures#
-
Adds
bindings.UnstableCombinedRulset
to commandsAdds
UnstableFn
sort
Adds support for first class functions as values using Python’s built in
Callable
syntax andpartial
.Adds way to combine ruleset with
r1 | r2
syntax or the experimentalunstable_combine_rulesets(*rs, name=None)
function.
Minor improvements#
Fixes a bug where you could not write binary dunder methods (like
__add__
) that didn’t have symetric argumentsUse function name as ruleset name by default when creating ruleset from function
Adds ability to refer to methods and property off of classes instead of only off of instances (i.e.
Math.__add__(x, y)
)
7.0.0 (2024-04-27)#
Defers adding rules in functions until they are used, so that you can use types that are not present yet.
Removes ability to set custom default ruleset for egraph. Either just use the empty default ruleset or explicitly set it for every run
Automatically mark Python builtin operators as preserved if they must return a real Python value
Properly pretty print all items (rewrites, actions, exprs, etc) so that expressions are de-duplicated and state is handled correctly.
Add automatic releases from github manual action
6.1.0 (2024-03-06)#
6.0.1 (2024-02-28)#
Upgrade dependencies, including egglog
Fix bug where saturate wasn’t properly getting translated.
6.0.0 (2024-02-06)#
Remove modules / Auto register functions/classes#
You can now create classes and functions without an EGraph! They will be automatically registered on any EGraph if they are used in any of the rules or commands. This means the methods to add functions/classes on an EGraph are deprecated and moved to the top level module:
egraph.class_
-> Removed, simply subclass fromegglog.Expr
egraph.method
->egglog.method
egraph.function
->egglog.function
egraph.relation
->egglog.relation
egraph.ruleset
->egglog.Ruleset
egraph.Module
-> Removed
The goal of this change is to remove the complexity of Module
s and remove the need to think about what functions/classes
need to be registered for each EGraph
.
In turn, if you want to collect a set of rules, you can do that with a ruleset. Whenever you now run a ruleset or schedule, the ruleset will be automatically registered on the EGraph.
For backwards compatability, the existing methods and functions are preserved, to make this easier to adopt. They will all now raise deprication warnings.
Allow future type references in classes#
Classes can now reference types that have not been defined yet, as long as they are defined before the class is used in a rule or expression. For example:
class A(Expr):
def __init__(self, b: B) -> None: ...
class B(Expr):
...
Top level commands#
We can now simplify and check expressions without explicity making an EGraph:
check(<fact>, [<schedule>], *[<actions>])
# is equivalent to
e = EGraph()
e.register(*<actions>)
e.run(<schedule>)
e.check(<fact>)
simplify(<expr>, [<schedule>])
# is equivalent to
EGraph().simplify(<expr>, [<schedule>])
5.0.0 (2024-01-16)#
Move egglog
!=
function to be called withne(x).to(y)
instead ofx != y
so that user defined expressions can
4.0.1 (2023-11-27)#
Fix keyword args for
__init__
methods (#96)[https://github.com/metadsl/egglog-python/pull/96].
4.0.0 (2023-11-24)#
Fix
as_egglog_string
proprety.Move
EGraph.eval_fn
topy_eval_fn
since it doesn’t need theEGraph
anymore.
3.1.0 (2023-11-21)#
Update graphs to include more compact Python names of functions (#79)[https://github.com/metadsl/egglog-python/pull/79].
Add
as_egglog_string
property to get egglog source from e-graph (#82)[https://github.com/metadsl/egglog-python/pull/82].Add
include_cost
flag toegraph.extract
to return the integer cost as well as an expression (#86)[https://github.com/metadsl/egglog-python/pull/86].Automatically try converting arguments to
eq
,rewrite
,set_
, andunion
to the correct type (#84)[https://github.com/metadsl/egglog-python/pull/84].Update RTD name to new project name of
egglog-python
fromegg-smol-python
(#18)[https://github.com/egraphs-good/egglog-python/pull/18].Move project to egraphs-good org!
3.0.0 (2023-11-19)#
Add support for outputing the serialization e-graph from the low level bindings. Note that this is not yet exposed a the high level yet.
This removes the existing to graphviz function on the EGraph low level binding and moves it to a method on the serialized EGraph.
See (#78)[https://github.com/egraphs-good/egglog-python/pull/78] for more details.
2.0.0 (2023-11-17)#
Simplify accessing primitives#
Previously, there was no public way of turning an egglog primitive, i.e. i64(10)
, into a Python primitive, i.e. int(10)
. Now there is a egraph.eval(...)
method which will evaluate a primitive expression and return a Python object.
We also change the PyObject
primitive to behave similarly. Instead of calling egraph.load_object(pyobj)
you can now call egraph.eval(pyobj)
to get the underlying Python object. Also, to unify it with the other objects, you can create a PyObject
by using the constructor instead of egraph.save_object(pyobj)
.
Bug fixes#
Properly expose
birewrite
at top level (#72)[https://github.com/egraphs-good/egglog-python/pull/72].Fix generation of graphviz interactive SVGs in docs.
Enhancements#
Added PyData lighting talk and Portland state talk to explanations.
Add experimental
jit
decorator to wrap all ndarray/numba functionality together.Switch to Ruff for linting
1.0.1 (2023-10-26)#
Adds youtube video to presentation slides.
1.0.0 (2023-10-26)#
Breaking Changes#
Test on Python 3.9 - 3.11, stop testing on 3.8 to follow Scientific Python versioning policy
Bump egglog dep
Adds
Bool
builtinRename
PrintTable
command toPrintFunction
Change extract command back to taking an expression instead of a fact
Adds
numer
anddenom
functions toRational
sort.Adds
terms_encoding
boolean flag for creating an EGraphAllow print size command to be called with no args to print all sizes
Add
rebuild
method for sets, maps, and vecs.
New Features#
Add ability to print egglog string of module with
.as_egglog_string
Add ability to visualize changes in egraph as it runs with
.saturate()
Add ability to make functions and module unextractable as well as increase the cost of a whole module.
Convert reflected methods based on both types
Allow specifying custom costs for conversions
In
py_exec
make a temporary file with source for tracebacksAdd an experimental Array API implementation with a scikit-learn test
0.7.0 (2023-10-04)#
Bump egglog dep
New Features#
Adds ability for custom user defined types in a union for proper static typing with conversions #49
Adds
py_eval
function toEGraph
as a helper to eval Python code. #49Adds on hover behavior for edges in graphviz SVG output to make them easier to trace #49
Adds
egglog.exp.program_gen
module that will compile expressions into Python statements/functions #49Adds
py_exec
primitive function for executing Python code #49
Bug fixes#
Clean up example in tutorial with demand based expression generation #49
0.6.0 (2023-09-20)#
Bump egglog dep
Breaking Changes#
Switches
RunReport
to include more granular timings
New Features#
Uncategorized#
Added initial supported for Python objects #31
Renamed
BaseExpr
toExpr
for succinctnessStarted adding tutorial for using with array API and sklearn], using this to drive the support for more Python integration
Added a PyObject sort with the
save_object
andload_object
egraphs methods and theexec
Added more general mechanism to upcast Python arguments into egglog expressions, by registering
converter
sAdded support for default arguments (this required refactoring declerations so that pretty printing can lookup expressions)
Added support for properties
Added support for passing args as keywords
Add support for pure Python methods, using the
preserve
kwarg to implement functions like__bool__
on expressions.Fix
__str__
method when pretty printing breaks.Added to/from i64 to i64 methods.
Upgraded
egg-smol
dependency (changes)
Add support for functions which mutates their args, like
__setitem__
#35Makes conversions transitive #38
Add support for reflective operators #39
Make reflective operators map directly to non-reflective #40
Includes latest egglog changes #42
Switches to termdag introduced in egglog #176
Removes custom fork of egglog now that visualizations are in core
Adds int and float to string functions
Switches
define
tolet
Tidy up notebook appearence #43
Display expressions as code in Jupyter notebook
Display all expressions when graphing
Start adding to string support #45
Fix adding rules for sorts defined in other modules
Split out array API into multiple module
tidy up docs homepage
0.5.1 (2023-07-18)#
Added support for negation on
f64
sortUpgraded
egg-smol
dependency (changes)
0.5.0 (2023-05-03)#
Renamed
config()
torun()
to better matchegglog
commandFixed
relation
type signatureAdded default limit of 1 to
run()
to matchegglog
command and moved to second argUpgraded
egglog
dependency (changes)Added
Set
sort and removed set method fromMap
Added
Vec
sortAdded support for variable args for builtin functions, to use in creation of
Vec
andSet
sorts.Added suport for joining
String
s
Switch generated egg names to use
.
as seperate (i.e.Math.__add__
) instead of_
(i.e.Math___add__
)Adds support for modules to define functions/sorts/rules without executing them, for reuse in other modules
Moved simplifying and running rulesets to the
run
andsimplify
methods on theEGraph
from those methods on theRuleset
since we can now createRulset
s for modules which don’t have an EGraph attached and can’t be run
Fixed extracting classmethods which required generic args to cls
Added support for alternative way of creating variables using functions
Add NDarray example
Render EGraphs with
graphviz
in the notebook (used in progress egglog PR).Add images to doc examples
Add
%%egglog
magic to the notebook
0.4.0 (2023-05-03)#
Change name to
egglog
fromegg-smol
, to mirror upstream change. Note that all previous versions are published under theegg-smol
PyPi package while this and later are underegglog
.
0.3.1 (2023-05-02)#
Fix bug calling methods on paramterized types (e.g.
Map[i64, i64].empty().insert(i64(0), i64(1))
)Fix bug for Unit type (egg name is
Unit
notunit
)Use
@class_
decorator to force subclassingExpr
Workaround extracting definitions until upstream is fixed
Rename
Map.map_remove
toMap.remove
.Add lambda calculus example
0.3.0 (2023-04-26)#
0.2.0 (2023-03-27)#
This release adds support for a high level API for e-graphs.
There is an examples of the high level API in the tutorials.