Skip to content

Commit fbe9948

Browse files
Merge pull request #276 from egraphs-good/update
Upgrade dependencies
2 parents be60768 + 1b38778 commit fbe9948

File tree

12 files changed

+121
-83
lines changed

12 files changed

+121
-83
lines changed

.github/workflows/version.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
# This seperates the release process from the test process, so we can still release if we need to and tests are failing
1212
name: Bump Version
1313
on:
14+
push:
15+
branches:
16+
- main
17+
pull_request:
1418
workflow_dispatch:
1519
inputs:
1620
type:
@@ -27,6 +31,7 @@ jobs:
2731
bump:
2832
runs-on: ubuntu-latest
2933
permissions: write-all
34+
if: github.event_name == 'workflow_dispatch'
3035
outputs:
3136
version: ${{ steps.bump.outputs.version }}
3237
steps:
@@ -52,10 +57,14 @@ jobs:
5257
matrix:
5358
target: [aarch64, ppc64]
5459
needs: [bump]
60+
if: ${{ always() }}
5561
steps:
5662
- uses: actions/checkout@v4
63+
if: ${{ needs.bump.result == 'success' }}
5764
with:
5865
ref: version-${{ needs.bump.outputs.version }}
66+
- uses: actions/checkout@v4
67+
if: ${{ needs.bump.result == 'skipped' }}
5968
- uses: PyO3/maturin-action@v1.47.1
6069
with:
6170
target: ${{ matrix.target }}
@@ -65,17 +74,21 @@ jobs:
6574
- name: Upload wheels
6675
uses: actions/upload-artifact@v4
6776
with:
68-
name: wheels-linux
77+
name: wheels-linux-${{ matrix.target }}
6978
path: dist
7079

7180
linux:
7281
name: build linux
7382
runs-on: ubuntu-latest
7483
needs: [bump]
84+
if: ${{ always() }}
7585
steps:
7686
- uses: actions/checkout@v4
87+
if: ${{ needs.bump.result == 'success' }}
7788
with:
7889
ref: version-${{ needs.bump.outputs.version }}
90+
- uses: actions/checkout@v4
91+
if: ${{ needs.bump.result == 'skipped' }}
7992
- name: Setup QEMU
8093
uses: docker/setup-qemu-action@v3
8194
- uses: PyO3/maturin-action@v1.47.1
@@ -93,10 +106,14 @@ jobs:
93106
name: build windows
94107
runs-on: windows-latest
95108
needs: [bump]
109+
if: ${{ always() }}
96110
steps:
97111
- uses: actions/checkout@v4
112+
if: ${{ needs.bump.result == 'success' }}
98113
with:
99114
ref: version-${{ needs.bump.outputs.version }}
115+
- uses: actions/checkout@v4
116+
if: ${{ needs.bump.result == 'skipped' }}
100117
- uses: PyO3/maturin-action@v1.47.1
101118
with:
102119
command: build
@@ -111,10 +128,14 @@ jobs:
111128
name: build macos
112129
runs-on: macos-latest
113130
needs: [bump]
131+
if: ${{ always() }}
114132
steps:
115133
- uses: actions/checkout@v4
134+
if: ${{ needs.bump.result == 'success' }}
116135
with:
117136
ref: version-${{ needs.bump.outputs.version }}
137+
- uses: actions/checkout@v4
138+
if: ${{ needs.bump.result == 'skipped' }}
118139
- uses: PyO3/maturin-action@v1.47.1
119140
with:
120141
command: build
@@ -130,7 +151,7 @@ jobs:
130151
name: Release
131152
runs-on: ubuntu-latest
132153
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch')
133-
needs: [macos, windows, linux, linux-cross]
154+
needs: [macos, windows, linux, linux-cross, bump]
134155
steps:
135156
- uses: actions/download-artifact@v4
136157
with:

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
exclude: ^python/tests/__snapshots__/
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.7.3
4+
rev: v0.11.0
55
hooks:
66
- id: ruff
77
args: [--fix, --exit-non-zero-on-fix]
88
- id: ruff-format
99
- repo: https://github.com/astral-sh/uv-pre-commit
1010
# uv version.
11-
rev: 0.5.31
11+
rev: 0.6.8
1212
hooks:
1313
- id: uv-lock

Cargo.lock

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ name = "egglog"
1010
crate-type = ["cdylib"]
1111

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

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

2525
# Use unreleased version of egglog in experimental
2626
[patch.'https://github.com/egraphs-good/egglog']

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ ignore = [
8989
# allow star imports
9090
"F405",
9191
"F403",
92-
# Dont care if cls isnt typed explicitly in classmethod
93-
"ANN102",
94-
# Same for self
95-
"ANN101",
92+
# allow shadow builtin import
93+
"A004",
9694
# Allow single line docstrings on multiple lines
9795
"D200",
9896
"D212",

python/egglog/functionalize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,4 @@ def wrapper(*args):
8888
wrapper.__name__ = f.__name__
8989

9090
# Partially apply the wrapper function with the current values of the free vars
91-
return cast(T, partial(wrapper, *(v for _, _, v, _ in additional_arg_filtered)))
91+
return cast("T", partial(wrapper, *(v for _, _, v, _ in additional_arg_filtered)))

python/egglog/runtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ def __hash__(self) -> int:
286286
return hash((id(self.__egg_decls_thunk__), self.__egg_tp__))
287287

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

292292
@property
293293
def __parameters__(self) -> tuple[object, ...]:

python/tests/test_program_gen.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
from __future__ import annotations
33

44
import inspect
5-
from types import FunctionType
6-
from typing import cast
5+
from typing import TYPE_CHECKING, cast
76

87
from egglog import *
98
from egglog.exp.program_gen import *
109

10+
if TYPE_CHECKING:
11+
from types import FunctionType
12+
1113

1214
class Math(Expr):
1315
def __init__(self, value: i64Like) -> None: ...
@@ -85,6 +87,6 @@ def test_py_object():
8587
egraph.register(evalled)
8688
egraph.run((to_program_ruleset | eval_program_rulseset | program_gen_ruleset).saturate())
8789
with egraph.set_current():
88-
res = cast(FunctionType, evalled.as_py_object.eval())
90+
res = cast("FunctionType", evalled.as_py_object.eval())
8991
assert res(1, 2) == 13
9092
assert inspect.getsource(res)

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.79.0"
2+
channel = "1.85.0"

src/conversions.rs

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::utils::*;
44
use egglog::ast::Symbol;
55
use ordered_float::OrderedFloat;
66
use pyo3::prelude::*;
7-
use pyo3::types::PyDeltaAccess;
7+
use pyo3::types::{PyDelta, PyDeltaAccess};
88
use std::collections::HashMap;
99
use std::sync::Arc;
1010

@@ -460,9 +460,13 @@ impl FromPyObject<'_> for Box<Schedule> {
460460
}
461461
}
462462

463-
impl IntoPy<PyObject> for Box<Schedule> {
464-
fn into_py(self, py: Python<'_>) -> PyObject {
465-
(*self).into_py(py)
463+
impl<'py> IntoPyObject<'py> for Box<Schedule> {
464+
type Target = PyAny; // the Python type
465+
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
466+
type Error = pyo3::PyErr;
467+
468+
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
469+
Ok((*self).into_pyobject(py)?.as_any().clone())
466470
}
467471
}
468472

@@ -472,9 +476,13 @@ impl FromPyObject<'_> for Box<Command> {
472476
}
473477
}
474478

475-
impl IntoPy<PyObject> for Box<Command> {
476-
fn into_py(self, py: Python<'_>) -> PyObject {
477-
(*self).into_py(py)
479+
impl<'py> IntoPyObject<'py> for Box<Command> {
480+
type Target = PyAny; // the Python type
481+
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
482+
type Error = pyo3::PyErr;
483+
484+
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
485+
Ok((*self).into_pyobject(py)?.as_any().clone())
478486
}
479487
}
480488

@@ -495,9 +503,13 @@ impl FromPyObject<'_> for WrappedOrderedF64 {
495503
}
496504
}
497505

498-
impl IntoPy<PyObject> for WrappedOrderedF64 {
499-
fn into_py(self, py: Python<'_>) -> PyObject {
500-
self.0.into_inner().into_py(py)
506+
impl<'py> IntoPyObject<'py> for WrappedOrderedF64 {
507+
type Target = PyAny; // the Python type
508+
type Output = Bound<'py, Self::Target>; // in most cases this will be `Bound`
509+
type Error = pyo3::PyErr;
510+
511+
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
512+
Ok((self.0.into_inner()).into_pyobject(py)?.as_any().clone())
501513
}
502514
}
503515

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

526-
impl IntoPy<PyObject> for WrappedDuration {
527-
fn into_py(self, py: Python<'_>) -> PyObject {
542+
fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error> {
528543
let d = self.0;
529-
pyo3::types::PyDelta::new_bound(
544+
Ok(pyo3::types::PyDelta::new(
530545
py,
531546
0,
532547
0,
533548
d.as_millis()
534549
.try_into()
535550
.expect("Failed to convert miliseconds to int32 when converting duration"),
536551
true,
537-
)
538-
.expect("Failed to contruct timedelta")
539-
.into()
552+
)?
553+
.clone())
540554
}
541555
}

0 commit comments

Comments
 (0)