Skip to content

Upgrade dependencies #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
# This seperates the release process from the test process, so we can still release if we need to and tests are failing
name: Bump Version
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
type:
Expand All @@ -27,6 +31,7 @@ jobs:
bump:
runs-on: ubuntu-latest
permissions: write-all
if: github.event_name == 'workflow_dispatch'
outputs:
version: ${{ steps.bump.outputs.version }}
steps:
Expand All @@ -52,10 +57,14 @@ jobs:
matrix:
target: [aarch64, ppc64]
needs: [bump]
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'success' }}
with:
ref: version-${{ needs.bump.outputs.version }}
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'skipped' }}
- uses: PyO3/maturin-action@v1.47.1
with:
target: ${{ matrix.target }}
Expand All @@ -65,17 +74,21 @@ jobs:
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux
name: wheels-linux-${{ matrix.target }}
path: dist

linux:
name: build linux
runs-on: ubuntu-latest
needs: [bump]
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'success' }}
with:
ref: version-${{ needs.bump.outputs.version }}
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'skipped' }}
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- uses: PyO3/maturin-action@v1.47.1
Expand All @@ -93,10 +106,14 @@ jobs:
name: build windows
runs-on: windows-latest
needs: [bump]
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'success' }}
with:
ref: version-${{ needs.bump.outputs.version }}
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'skipped' }}
- uses: PyO3/maturin-action@v1.47.1
with:
command: build
Expand All @@ -111,10 +128,14 @@ jobs:
name: build macos
runs-on: macos-latest
needs: [bump]
if: ${{ always() }}
steps:
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'success' }}
with:
ref: version-${{ needs.bump.outputs.version }}
- uses: actions/checkout@v4
if: ${{ needs.bump.result == 'skipped' }}
- uses: PyO3/maturin-action@v1.47.1
with:
command: build
Expand All @@ -130,7 +151,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch')
needs: [macos, windows, linux, linux-cross]
needs: [macos, windows, linux, linux-cross, bump]
steps:
- uses: actions/download-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
exclude: ^python/tests/__snapshots__/
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.3
rev: v0.11.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.31
rev: 0.6.8
hooks:
- id: uv-lock
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ name = "egglog"
crate-type = ["cdylib"]

[dependencies]
pyo3 = { version = "0.22.6", features = ["extension-module"] }
pyo3 = { version = "0.23.0", features = ["extension-module"] }

egglog = { git = "https://github.com/saulshanabrook/egg-smol", rev = "889ca7635368d7e382e16a93b2883aba82f1078f" }
egglog-experimental = { git = "https://github.com/egraphs-good/egglog-experimental", rev = "8a1b3d6ad2723a8438f51f05027161e51f37917c" }
egraph-serialize = { version = "0.2.0", features = ["serde", "graphviz"] }
serde_json = "1.0.140"
pyo3-log = "0.11.0"
pyo3-log = "0.12.1"
log = "0.4.26"
lalrpop-util = { version = "0.22", features = ["lexer"] }
ordered-float = "3.7.0"
uuid = { version = "1.15.1", features = ["v4"] }
uuid = { version = "1.16.0", features = ["v4"] }

# Use unreleased version of egglog in experimental
[patch.'https://github.com/egraphs-good/egglog']
Expand Down
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,8 @@ ignore = [
# allow star imports
"F405",
"F403",
# Dont care if cls isnt typed explicitly in classmethod
"ANN102",
# Same for self
"ANN101",
# allow shadow builtin import
"A004",
# Allow single line docstrings on multiple lines
"D200",
"D212",
Expand Down
2 changes: 1 addition & 1 deletion python/egglog/functionalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ def wrapper(*args):
wrapper.__name__ = f.__name__

# Partially apply the wrapper function with the current values of the free vars
return cast(T, partial(wrapper, *(v for _, _, v, _ in additional_arg_filtered)))
return cast("T", partial(wrapper, *(v for _, _, v, _ in additional_arg_filtered)))
4 changes: 2 additions & 2 deletions python/egglog/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ def __hash__(self) -> int:
return hash((id(self.__egg_decls_thunk__), self.__egg_tp__))

# Support unioning like types
def __or__(self, __value: type) -> object:
return Union[self, __value] # noqa: UP007
def __or__(self, value: type) -> object:
return Union[self, value] # noqa: UP007

@property
def __parameters__(self) -> tuple[object, ...]:
Expand Down
8 changes: 5 additions & 3 deletions python/tests/test_program_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
from __future__ import annotations

import inspect
from types import FunctionType
from typing import cast
from typing import TYPE_CHECKING, cast

from egglog import *
from egglog.exp.program_gen import *

if TYPE_CHECKING:
from types import FunctionType


class Math(Expr):
def __init__(self, value: i64Like) -> None: ...
Expand Down Expand Up @@ -85,6 +87,6 @@ def test_py_object():
egraph.register(evalled)
egraph.run((to_program_ruleset | eval_program_rulseset | program_gen_ruleset).saturate())
with egraph.set_current():
res = cast(FunctionType, evalled.as_py_object.eval())
res = cast("FunctionType", evalled.as_py_object.eval())
assert res(1, 2) == 13
assert inspect.getsource(res)
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.79.0"
channel = "1.85.0"
46 changes: 30 additions & 16 deletions src/conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::utils::*;
use egglog::ast::Symbol;
use ordered_float::OrderedFloat;
use pyo3::prelude::*;
use pyo3::types::PyDeltaAccess;
use pyo3::types::{PyDelta, PyDeltaAccess};
use std::collections::HashMap;
use std::sync::Arc;

Expand Down Expand Up @@ -460,9 +460,13 @@ impl FromPyObject<'_> for Box<Schedule> {
}
}

impl IntoPy<PyObject> for Box<Schedule> {
fn into_py(self, py: Python<'_>) -> PyObject {
(*self).into_py(py)
impl<'py> IntoPyObject<'py> for Box<Schedule> {
type Target = PyAny; // the Python type
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
type Error = pyo3::PyErr;

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
Ok((*self).into_pyobject(py)?.as_any().clone())
}
}

Expand All @@ -472,9 +476,13 @@ impl FromPyObject<'_> for Box<Command> {
}
}

impl IntoPy<PyObject> for Box<Command> {
fn into_py(self, py: Python<'_>) -> PyObject {
(*self).into_py(py)
impl<'py> IntoPyObject<'py> for Box<Command> {
type Target = PyAny; // the Python type
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
type Error = pyo3::PyErr;

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
Ok((*self).into_pyobject(py)?.as_any().clone())
}
}

Expand All @@ -495,9 +503,13 @@ impl FromPyObject<'_> for WrappedOrderedF64 {
}
}

impl IntoPy<PyObject> for WrappedOrderedF64 {
fn into_py(self, py: Python<'_>) -> PyObject {
self.0.into_inner().into_py(py)
impl<'py> IntoPyObject<'py> for WrappedOrderedF64 {
type Target = PyAny; // the Python type
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
type Error = pyo3::PyErr;

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
Ok((self.0.into_inner()).into_pyobject(py)?.as_any().clone())
}
}

Expand All @@ -522,20 +534,22 @@ impl FromPyObject<'_> for WrappedDuration {
)))
}
}
impl<'py> IntoPyObject<'py> for WrappedDuration {
type Target = PyDelta; // the Python type
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
type Error = pyo3::PyErr;

impl IntoPy<PyObject> for WrappedDuration {
fn into_py(self, py: Python<'_>) -> PyObject {
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
let d = self.0;
pyo3::types::PyDelta::new_bound(
Ok(pyo3::types::PyDelta::new(
py,
0,
0,
d.as_millis()
.try_into()
.expect("Failed to convert miliseconds to int32 when converting duration"),
true,
)
.expect("Failed to contruct timedelta")
.into()
)?
.clone())
}
}
Loading
Loading