Skip to content

Commit

Permalink
Merge pull request #92 from egraphs-good/saulshanabrook/issue18
Browse files Browse the repository at this point in the history
Move org & update docs name
  • Loading branch information
saulshanabrook authored Nov 24, 2023
2 parents 3e58a99 + f5684ab commit e8bcca6
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 38 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 metadsl
Copyright (c) 2022 E-Graphs Good

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# `egglog` Python wrapper

[![Documentation Status](https://readthedocs.org/projects/egg-smol-python/badge/?version=latest)](https://egg-smol-python.readthedocs.io/en/latest/?badge=latest) [![Test](https://github.com/metadsl/egglog-python/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/metadsl/egglog-python/actions/workflows/CI.yml) [![PyPi Package](https://img.shields.io/pypi/v/egglog.svg)](https://pypi.org/project/egglog/) [![License](https://img.shields.io/pypi/l/egglog.svg)](https://pypi.org/project/egglog/) [![Python Versions](https://img.shields.io/pypi/pyversions/egglog.svg)](https://pypi.org/project/egglog/) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
[![Documentation Status](https://readthedocs.org/projects/egglog-python/badge/?version=latest)](https://egglog-python.readthedocs.io/en/latest/?badge=latest) [![Test](https://github.com/egraphs-good/egglog-python/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/egraphs-good/egglog-python/actions/workflows/CI.yml) [![PyPi Package](https://img.shields.io/pypi/v/egglog.svg)](https://pypi.org/project/egglog/) [![License](https://img.shields.io/pypi/l/egglog.svg)](https://pypi.org/project/egglog/) [![Python Versions](https://img.shields.io/pypi/pyversions/egglog.svg)](https://pypi.org/project/egglog/) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

`egglog` is a Python package that provides bindings to the Rust library [`egglog`](https://github.com/egraphs-good/egglog/),
allowing you to use e-graphs in Python for optimization, symbolic computation, and analysis.

Please see the [documentation](https://egg-smol-python.readthedocs.io/en/latest/?badge=latest) for more information.
Please see the [documentation](https://egglog-python.readthedocs.io/en/latest/?badge=latest) for more information.

Come say hello [on the e-graphs Zulip](https://egraphs.zulipchat.com/#narrow/stream/375765-egglog/) or [open an issue](https://github.com/metadsl/egglog-python/issues/new/choose)!
Come say hello [on the e-graphs Zulip](https://egraphs.zulipchat.com/#narrow/stream/375765-egglog/) or [open an issue](https://github.com/egraphs-good/egglog-python/issues/new/choose)!
2 changes: 1 addition & 1 deletion docs/_templates/comments.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src="https://giscus.app/client.js"
data-repo="metadsl/egglog-python"
data-repo="egraphs-good/egglog-python"
data-repo-id="R_kgDOIXA8ig"
data-category="Documentation Comments"
data-category-id="DIC_kwDOIXA8is4CbCqh"
Expand Down
48 changes: 26 additions & 22 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@ _This project uses semantic versioning_

## UNRELEASED

- Fix `as_egglog_string` proprety.

## 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 method to get egglog source from e-graph (#82)[https://github.com/metadsl/egglog-python/pull/82].
- 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 to `egraph.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_`, and `union` to the correct type (#84)[https://github.com/metadsl/egglog-python/pull/84].
- Update RTD name to new project name of `egglog-python` from `egg-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/metadsl/egglog-python/pull/78] for more details.
See (#78)[https://github.com/egraphs-good/egglog-python/pull/78] for more details.

## 2.0.0 (2023-11-17)

Expand All @@ -29,7 +33,7 @@ We also change the `PyObject` primitive to behave similarly. Instead of calling

## Bug fixes

- Properly expose `birewrite` at top level (#72)[https://github.com/metadsl/egglog-python/pull/72].
- 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
Expand Down Expand Up @@ -72,15 +76,15 @@ We also change the `PyObject` primitive to behave similarly. Instead of calling

### New Features

- Adds ability for custom user defined types in a union for proper static typing with conversions [#49](https://github.com/metadsl/egglog-python/pull/49)
- Adds `py_eval` function to `EGraph` as a helper to eval Python code. [#49](https://github.com/metadsl/egglog-python/pull/49)
- Adds on hover behavior for edges in graphviz SVG output to make them easier to trace [#49](https://github.com/metadsl/egglog-python/pull/49)
- Adds `egglog.exp.program_gen` module that will compile expressions into Python statements/functions [#49](https://github.com/metadsl/egglog-python/pull/49)
- Adds `py_exec` primitive function for executing Python code [#49](https://github.com/metadsl/egglog-python/pull/49)
- Adds ability for custom user defined types in a union for proper static typing with conversions [#49](https://github.com/egraphs-good/egglog-python/pull/49)
- Adds `py_eval` function to `EGraph` as a helper to eval Python code. [#49](https://github.com/egraphs-good/egglog-python/pull/49)
- Adds on hover behavior for edges in graphviz SVG output to make them easier to trace [#49](https://github.com/egraphs-good/egglog-python/pull/49)
- Adds `egglog.exp.program_gen` module that will compile expressions into Python statements/functions [#49](https://github.com/egraphs-good/egglog-python/pull/49)
- Adds `py_exec` primitive function for executing Python code [#49](https://github.com/egraphs-good/egglog-python/pull/49)

### Bug fixes

- Clean up example in tutorial with demand based expression generation [#49](https://github.com/metadsl/egglog-python/pull/49)
- Clean up example in tutorial with demand based expression generation [#49](https://github.com/egraphs-good/egglog-python/pull/49)

## 0.6.0 (2023-09-20)

Expand All @@ -92,14 +96,14 @@ We also change the `PyObject` primitive to behave similarly. Instead of calling

### New Features

- Add ability to pass `seminaive` flag to Egraph to replicate `--naive` CLI flag [#48](https://github.com/metadsl/egglog-python/pull/48)
- Add ability to inline leaves $n$ times instead of just once for visualization [#48](https://github.com/metadsl/egglog-python/pull/48)
- Add `Relation` and `PrintOverallStatistics` low level commands [#46](https://github.com/metadsl/egglog-python/pull/46)
- Adds `count-matches` and `replace` string commands [#46](https://github.com/metadsl/egglog-python/pull/46)
- Add ability to pass `seminaive` flag to Egraph to replicate `--naive` CLI flag [#48](https://github.com/egraphs-good/egglog-python/pull/48)
- Add ability to inline leaves $n$ times instead of just once for visualization [#48](https://github.com/egraphs-good/egglog-python/pull/48)
- Add `Relation` and `PrintOverallStatistics` low level commands [#46](https://github.com/egraphs-good/egglog-python/pull/46)
- Adds `count-matches` and `replace` string commands [#46](https://github.com/egraphs-good/egglog-python/pull/46)

### Uncategorized

- Added initial supported for Python objects [#31](https://github.com/metadsl/egglog-python/pull/31)
- Added initial supported for Python objects [#31](https://github.com/egraphs-good/egglog-python/pull/31)

- Renamed `BaseExpr` to `Expr` for succinctness
- Add [slides for zoom presentation with Open Teams](explanation/2023_07_presentation)
Expand All @@ -115,19 +119,19 @@ We also change the `PyObject` primitive to behave similarly. Instead of calling
- Added to/from i64 to i64 methods.
- Upgraded `egg-smol` dependency ([changes](https://github.com/saulshanabrook/egg-smol/compare/353c4387640019bd2066991ee0488dc6d5c54168...2ac80cb1162c61baef295d8e6d00351bfe84883f))

- Add support for functions which mutates their args, like `__setitem__` [#35](https://github.com/metadsl/egglog-python/pull/35)
- Makes conversions transitive [#38](https://github.com/metadsl/egglog-python/pull/38)
- Add support for reflective operators [#39](https://github.com/metadsl/egglog-python/pull/39)
- Make reflective operators map directly to non-reflective [#40](https://github.com/metadsl/egglog-python/pull/40)
- Includes latest egglog changes [#42](https://github.com/metadsl/egglog-python/pull/42)
- Add support for functions which mutates their args, like `__setitem__` [#35](https://github.com/egraphs-good/egglog-python/pull/35)
- Makes conversions transitive [#38](https://github.com/egraphs-good/egglog-python/pull/38)
- Add support for reflective operators [#39](https://github.com/egraphs-good/egglog-python/pull/39)
- Make reflective operators map directly to non-reflective [#40](https://github.com/egraphs-good/egglog-python/pull/40)
- Includes latest egglog changes [#42](https://github.com/egraphs-good/egglog-python/pull/42)
- Switches to termdag introduced in [egglog #176](https://github.com/egraphs-good/egglog/pull/176)
- Removes custom fork of egglog now that visualizations are in core
- Adds int and float to string functions
- Switches `define` to `let`
- Tidy up notebook appearence [#43](https://github.com/metadsl/egglog-python/pull/43)
- Tidy up notebook appearence [#43](https://github.com/egraphs-good/egglog-python/pull/43)
- Display expressions as code in Jupyter notebook
- Display all expressions when graphing
- Start adding to string support [#45](https://github.com/metadsl/egglog-python/pull/45)
- Start adding to string support [#45](https://github.com/egraphs-good/egglog-python/pull/45)
- Fix adding rules for sorts defined in other modules
- Split out array API into multiple module
- tidy up docs homepage
Expand Down Expand Up @@ -172,7 +176,7 @@ We also change the `PyObject` primitive to behave similarly. Instead of calling

## 0.3.0 (2023-04-26)

- [Upgrade `egglog` from `08a6e8fecdb77e6ba72a1b1d9ff4aff33229912c` to `6f2633a5fa379487fb389b80fc1225866f8b8c1a`.](https://github.com/metadsl/egglog-python/pull/14)
- [Upgrade `egglog` from `08a6e8fecdb77e6ba72a1b1d9ff4aff33229912c` to `6f2633a5fa379487fb389b80fc1225866f8b8c1a`.](https://github.com/egraphs-good/egglog-python/pull/14)

## 0.2.0 (2023-03-27)

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/metadsl/egglog-python",
"url": "https://github.com/egraphs-good/egglog-python",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
},
Expand All @@ -123,7 +123,7 @@
}

html_context = {
"github_user": "metadsl",
"github_user": "egraphs-good",
"github_repo": "egglog-python",
"github_version": "main",
"doc_path": "docs",
Expand Down
2 changes: 1 addition & 1 deletion docs/explanation/2023_07_presentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -12081,7 +12081,7 @@
"\n",
"Welcome new contributations, experiments, and conversations...\n",
"\n",
"_Come say hello at [github.com/metadsl/egglog-python](https://github.com/metadsl/egglog-python) ad [egraphs.zulipchat.com](https://egraphs.zulipchat.com/)!_\n"
"_Come say hello at [github.com/egraphs-good/egglog-python](https://github.com/egraphs-good/egglog-python) ad [egraphs.zulipchat.com](https://egraphs.zulipchat.com/)!_\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/explanation/2023_11_09_portland_state.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@
"Thank you!\n",
"\n",
"- Saul Shanabrook\n",
"- [https://github.com/metadsl/egglog-python](https://github.com/metadsl/egglog-python)\n"
"- [https://github.com/egraphs-good/egglog-python](https://github.com/egraphs-good/egglog-python)\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/explanation/2023_11_pydata_lightning_talk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6822,7 +6822,7 @@
" - dont reimplement the world: build on academic programming language research\n",
"\n",
"- `pip install egglog`\n",
"- https://github.com/metadsl/egglog-python\n",
"- https://github.com/egraphs-good/egglog-python\n",
"- Say hello: https://egraphs.zulipchat.com/\n"
]
},
Expand Down
2 changes: 1 addition & 1 deletion docs/explanation/pldi_2023_presentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4920,7 +4920,7 @@
"...\n",
"```\n",
"\n",
"_Come say hello at [github.com/metadsl/egglog-python](https://github.com/metadsl/egglog-python)!_\n"
"_Come say hello at [github.com/egraphs-good/egglog-python](https://github.com/egraphs-good/egglog-python)!_\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ It follows [SPEC 0](https://scientific-python.org/specs/spec-0000/) in terms of
There is [a Zulip stream](https://egraphs.zulipchat.com/#narrow/stream/375765-egglog) for the `egglog` project
which you are welcome to open a thread on.

There are also [Github issues](https://github.com/metadsl/egglog-python/issues) and [discussions](https://github.com/metadsl/egglog-python/discussions)
There are also [Github issues](https://github.com/egraphs-good/egglog-python/issues) and [discussions](https://github.com/egraphs-good/egglog-python/discussions)
which you can use to ask questions.

## Stability
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/sklearn.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"Now, we can try executing it with `egglog` instead. In this mode, we aren't actually passing in any particular\n",
"NDArray, but instead just using variables to represent the X and Y values.\n",
"\n",
"These are defined in the [`egglog.exp.array_api` module](https://github.com/metadsl/egglog-python/blob/main/python/egglog/exp/array_api.py), as typed values:\n",
"These are defined in the [`egglog.exp.array_api` module](https://github.com/egraphs-good/egglog-python/blob/main/python/egglog/exp/array_api.py), as typed values:\n",
"\n",
"```python\n",
"@array_api_module.class_\n",
Expand Down Expand Up @@ -5855,7 +5855,7 @@
"\n",
"We are getting closer to a form we could translate back to Numba, but we have to make a few changes. Numba doesn't\n",
"support the `axis` keyword for `mean` or `std`, but it does support it for `sum`, so we have to translate all forms\n",
"from one to the other, with a rule like this (defined in [`egglog.exp.array_api_numba`](https://github.com/metadsl/egglog-python/blob/main/python/egglog/exp/array_api_numba.py)):\n",
"from one to the other, with a rule like this (defined in [`egglog.exp.array_api_numba`](https://github.com/egraphs-good/egglog-python/blob/main/python/egglog/exp/array_api_numba.py)):\n",
"\n",
"```python\n",
"axis = OptionalIntOrTuple.some(IntOrTuple.int(i))\n",
Expand Down Expand Up @@ -6167,8 +6167,8 @@
")\n",
"```\n",
"\n",
"We pull in all those rewrite rules from the [`egglog.exp.array_api_program_gen` module](https://github.com/metadsl/egglog-python/blob/main/python/egglog/exp/array_api_program_gen.py).\n",
"They depend on another module, [`egglog.exp.program_gen` module](https://github.com/metadsl/egglog-python/blob/main/python/egglog/exp/program_gen.py), which provides generic translations\n",
"We pull in all those rewrite rules from the [`egglog.exp.array_api_program_gen` module](https://github.com/egraphs-good/egglog-python/blob/main/python/egglog/exp/array_api_program_gen.py).\n",
"They depend on another module, [`egglog.exp.program_gen` module](https://github.com/egraphs-good/egglog-python/blob/main/python/egglog/exp/program_gen.py), which provides generic translations\n",
"from expressions and statements into strings.\n",
"\n",
"We can run these rules to get out a Python function object:\n"
Expand Down
1 change: 1 addition & 0 deletions python/egglog/egraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ def __post_init__(self, modules: list[Module], seminaive: bool, save_egglog_stri
self._egglog_string = ""

def _process_commands(self, commands: Iterable[bindings._Command]) -> None:
commands = list(commands)
self._egraph.run_program(*commands)
if isinstance(self._egglog_string, str):
self._egglog_string += "\n".join(str(c) for c in commands) + "\n"
Expand Down

0 comments on commit e8bcca6

Please sign in to comment.