Python bindings for egg

Overview

Python bindings for egg

Installing

  • Install maturin, a cool Rust/Python builder thingy.
    • Download from their site or just pip install maturin.
  • Type make install to build and install snake_egg into your python installation.
    • This will reinstall over any existing snake_egg installation.
    • You may want to do this in a virtualenv.

If you'd like to manually install it, just run maturin build and find the wheels in ./target/wheels/.

Comments
  • Support other types for expressions and dynamic appliers

    Support other types for expressions and dynamic appliers

    The goal of this PR is to get @kszucs's work, which updates this repo to "support user defined python classes (not just named tuple) and dynamic appliers", in a spot to merge into the main repo. @kszucs if you prefer me not to include these changes in a PR, let me know, I am happy to add my own changes on the main here. I opted to build them off of yours because you had already done some work here and I didn't want to cause a merge conflict if you later decided to merge them upstream.

    The TODO items before this is ready for merge currently are:

    • [x] See if it is possible to avoid the change making Subst.vec public
    • [x] Keep package named snake-egg instead of egg (Can switch to egg if folks prefer. There is already an egg pypi package, so the package name would have to be different).
    • [x] Update the existing static typings to include new features
    • [x] Make sure the tests pass in CI
    • [x] Replace ibis tests with other dynamic applier example

    Happy to chat more if anyone else has thoughts here.


    EDIT: I have postponed the following items in this PR and could be tackled in follow up PRs to limit the scope in this one.

    • [ ] Extend the ability to accept various types by including a way to specify different construct/deconstruct functions, keeping it backwards compatible with @kscucs's definition by using those as default.
    • [ ] Possibly start adding some basic documentation that could then be refactored into a full sphinx doc later.
    • [ ] Copy over lambda calculus example. This needs conditional rewrites and also the ability to define analysis merge behavior. It would serve as a good test for a more complicated dynamic application.
    opened by saulshanabrook 9
  • Add stub defintions

    Add stub defintions

    In this PR I have started adding a .pyi stub file for the library, to expose the types statically for tools like MyPy to consume. I have started adding stubs to not only help future downstream users of this library but to also increase my familiarity to the features this library exposes.

    I also added MyPy as a development dependency, so that we can use its stubtest tool to verify the stubs match the actual implementation.

    I also added a test to github actions to verify the stubs.

    TODO:

    • [x] Add all classes and functions
    • [x] Make tests run on PRs to verify in CI
    • [x] FIx submodule issue
    opened by saulshanabrook 6
  • Crash when right-hand-side is single variable?

    Crash when right-hand-side is single variable?

    Hello, thanks for adding this API!

    I'm trying to run the tests on my machine but they seem to fail when I include tests that have a single variable on the right-hand-side. For example, the rewrite rule https://github.com/egraphs-good/snake-egg/blob/c593d6aeb45ac8047facd9ffcb63f59a84bfd996/snake_egg/tests/test_simple.py#L27 causes the following error when I run make test:

    thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "Rewrite add-0 refers to unbound var ?a"', src/core.rs:88:63
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Traceback (most recent call last):
      File "/Users/fmora/Documents/software/snake-egg/snake_egg/tests/test_simple.py", line 27, in <module>
        Rewrite(Add(a, 0), a, name="add-0"),
    pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: "Rewrite add-0 refers to unbound var ?a"
    make: *** [test] Error 1
    

    When I comment out all the rewrite rules in the test set that have a single variable on the rhs, this error goes away. Have you seen this before? Do you know what is going on?

    Thank you!!

    opened by FedericoAureliano 4
  • Constant Folding

    Constant Folding

    Any plans to allow for constant folding or the definition of other types of analyses from Python?

    Happy to contribute, but for a full PR think I would need some guidance.

    opened by bedeio 4
  • Fix stubtest by ignoring spurious NamedTuple errors

    Fix stubtest by ignoring spurious NamedTuple errors

    Stubtest was previously raising errors on the tests defined in the module by comparing the stubs for the built-in NamedTuple class with their runtime implementation. We did not implement this class and so we want to ignore any errors raised about it.

    This error was raised in #7 but for some reason did not fail in CI until that was merged, so this is a follow-up PR.

    opened by saulshanabrook 2
  • Feature request: node extract

    Feature request: node extract

    It would be useful for egg to allow an extraction method that returns recexpers representing all enodes in an eclass. I am happy to make a pull request if needed.

    opened by IanBriggs 1
  • Don't use stubtest in CI

    Don't use stubtest in CI

    The stubtest seems to have broken in #7. This disables it in CI for now, since the errors it raises are spurious. It replaces #8, which was overly broad and didn't do what was intended.

    opened by saulshanabrook 0
  • Consider adding python wheels on pypi

    Consider adding python wheels on pypi

    Hi, I'm an open source developer and got interested in your project to use it to preprocess IR of computational graphs for onnx, pytorch, tensorflow, jax and on. To make it possible to include your work as a dependency, python wheels have to be provided on pypi. Do you mind me helping to set up github CI publishing installable wheels for common operating systems like linux, windows, macos? So far I've checked there is no package snake-egg on pypi, so you might need to register it there

    opened by ferrine 4
Owner
Using e-graphs to build cool stuff
null
corange-rs CorangeCorange lucidscape/corange-rs — Corange bindings

CORANGE-RS This crate provides an interface to the Corange game engine, written in Pure C, SDL and OpenGL by Daniel Holden. Features include: deferred

null 43 Jul 22, 2022
Rust bindings for GDNative

GDNative bindings for Rust Rust bindings to the Godot game engine. Website | User Guide | API Documentation Stability The bindings cover most of the e

null 3.2k Jan 9, 2023
SDL bindings for Rust

Rust-SDL Bindings for SDL in Rust Overview Rust-SDL is a library for talking to SDL from Rust. Low-level C components are wrapped in Rust code to make

Brian Anderson 174 Nov 22, 2022
SDL2 bindings for Rust

Rust-SDL2 Bindings for SDL2 in Rust Changelog for 0.34.2 Overview Rust-SDL2 is a library for talking to the new SDL2.0 libraries from Rust. Low-level

null 2.2k Jan 5, 2023
SFML bindings for Rust

rust-sfml Rust bindings for SFML, the Simple and Fast Multimedia Library. Requirements Linux, Windows, or OS X Rust 1.42 or later SFML 2.5 CSFML 2.5 D

Jeremy Letang 567 Jan 7, 2023
Rust bindings for libtcod 1.6.3 (the Doryen library/roguelike toolkit)

Warning: Not Maintained This project is no longer actively developed or maintained. Please accept our apologies. Open pull requests may still get merg

Tomas Sedovic 226 Nov 17, 2022
Some Rust bindings for Binary Ninja

Binary Ninja Rust Bindings Work in progress Rust bindings geared towards analysis. Features added as they come up. No promises anything works at this

Cory Duplantis 21 May 5, 2022
Pure and simple Vulkan bindings generated from Vulkan-Headers!

mira Pure and simple Vulkan bindings generated from Vulkan-Headers! Mira provides a simple and straightforward way to interact with Vulkan. Everything

maresia 3 Mar 3, 2022
Qt Quick / QML bindings for Rust

qmlrsng Qt Quick bindings for Rust, based on libqmlbind. The crate libqmlbind-sys wraps libqmlbind C library in Rust and exposes an unsafe API. The go

Nicolas Bigaouette 5 Jul 13, 2017
Idiomatic Rust bindings for Pdfium

Idiomatic Rust bindings for Pdfium pdfium-render provides an idiomatic high-level Rust interface around the low-level bindings to Pdfium exposed by th

Alastair Carey 65 Jan 8, 2023
Bindings to TinyGL, a Small, Free and Fast Subset of OpenGL

TinyGL is a very lightweight partial OpenGL implementation. Its small size makes it ideal for static linking.

null 12 Oct 13, 2022
Wein2D.js bindings for creating browser games in Rust using WebAssembly.

Wein2D.js-WASM Wein2D.js bindings for creating browser games in Rust using WebAssembly. Wein2D.js-WASM requires Wein2d.js to be loaded in the same doc

DevTaube 1 Apr 14, 2022
A simple Verlet integration solver written using the Rust SDL2 bindings.

Rust Verlet Solver A simple Verlet integration solver written using the Rust SDL2 bindings. Where's the friction?! Building cargo-vcpkg is required in

Will 8 Jun 6, 2022
MMDeploy bindings for Rust.

rust-mmdeploy-sys MMDeploy bindings for Rust. ?? THIS REPO IS STILL UNDER CONSTRUCTION! Prerequisites NOTICE: Linux only. Onnxruntime only. In order t

梦阳 2 Sep 29, 2022
Rust bindings for googleprojectzero/TinyInst

tinyinst-rs FFI to TinyInst. Created for LibAFL. Dependencies cxxbridge cargo-make python3 git Running the test Open a terminal and set up your build

Advanced Fuzzing League ++ 12 Jan 20, 2023
Rust bindings for entity-gym.

EntityGym for Rust EntityGym is a Python library that defines a novel entity-based abstraction for reinforcement learning environments which enables h

null 18 Apr 15, 2023
Safe, fully-featured bindings to the Tracy profiler

Complete Rust bindings for the Tracy profiler. Getting Started Just add the following to your Cargo.toml: [dependencies.tracy] package = "tracy_full"

Shaye Garg 12 May 6, 2023
A simple Verlet integration solver written using the Rust SDL2 bindings.

Rust Verlet Solver A simple Verlet integration solver written using the Rust SDL2 bindings. Where's the friction?! Building cargo-vcpkg is required in

Will 8 Jun 6, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
A prolog like syntax for egg

egglog Using the egg library with a file format and semantics similar to datalog. Explanatory blog posts: https://www.philipzucker.com/egglog-checkpoi

Philip Zucker 40 Dec 1, 2022