Skip to content
Open
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
56 changes: 34 additions & 22 deletions Cargo.lock

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

29 changes: 15 additions & 14 deletions THIRD-PARTY-LICENSES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

------
** pydantic; version 2.14.3 -- https://pypi.org/project/pydantic/
** pydantic; version 2.14.4 -- https://pypi.org/project/pydantic/
The MIT License (MIT)

Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors.
Expand All @@ -48,7 +48,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

------
** pydantic_core; version 2.50.4 -- https://pypi.org/project/pydantic_core/
** pydantic_core; version 2.50.5 -- https://pypi.org/project/pydantic_core/
The MIT License (MIT)

Copyright (c) 2022 Samuel Colvin
Expand All @@ -72,7 +72,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

------
** PyYAML; version 6.0.3 -- https://pypi.org/project/PyYAML/
** PyYAML; version 6.0.4 -- https://pypi.org/project/PyYAML/
Copyright (c) 2017-2021 Ingy döt Net
Copyright (c) 2006-2016 Kirill Simonov

Expand Down Expand Up @@ -2110,7 +2110,7 @@ limitations under the License.
** regex-automata; version 0.4.18 -- https://crates.io/crates/regex-automata
** regex-syntax; version 0.8.11 -- https://crates.io/crates/regex-syntax
** regex; version 1.13.1 -- https://crates.io/crates/regex
** ruff_unicode_names2; version 0.0.21 -- https://crates.io/crates/ruff_unicode_names2
** ruff_unicode_names2; version 0.0.22 -- https://crates.io/crates/ruff_unicode_names2
** signal-hook-registry; version 1.4.8 -- https://crates.io/crates/signal-hook-registry
** smallvec; version 1.15.2 -- https://crates.io/crates/smallvec
** stacker; version 0.1.25 -- https://crates.io/crates/stacker
Expand Down Expand Up @@ -2740,9 +2740,9 @@ limitations under the License.
** itoa; version 1.0.18 -- https://crates.io/crates/itoa
** libc; version 0.2.189 -- https://crates.io/crates/libc
** manyhow-macros; version 0.14.1 -- https://crates.io/crates/manyhow-macros
** openjd-expr; version 0.15.0 -- https://crates.io/crates/openjd-expr
** openjd-model; version 0.16.0 -- https://crates.io/crates/openjd-model
** openjd-sessions; version 0.10.0 -- https://crates.io/crates/openjd-sessions
** openjd-expr; version 0.18.1 -- https://crates.io/crates/openjd-expr
** openjd-model; version 0.18.0 -- https://crates.io/crates/openjd-model
** openjd-sessions; version 0.12.1 -- https://crates.io/crates/openjd-sessions
** pin-project-lite; version 0.2.17 -- https://crates.io/crates/pin-project-lite
** portable-atomic; version 1.15.0 -- https://crates.io/crates/portable-atomic
** proc-macro2; version 1.0.107 -- https://crates.io/crates/proc-macro2
Expand All @@ -2760,6 +2760,7 @@ limitations under the License.
** serde_core; version 1.0.229 -- https://crates.io/crates/serde_core
** serde_derive; version 1.0.229 -- https://crates.io/crates/serde_derive
** serde_json; version 1.0.151 -- https://crates.io/crates/serde_json
** serde_path_to_error; version 0.1.20 -- https://crates.io/crates/serde_path_to_error
** shlex; version 2.0.1 -- https://crates.io/crates/shlex
** siphasher; version 1.0.3 -- https://crates.io/crates/siphasher
** syn; version 2.0.119 -- https://crates.io/crates/syn
Expand Down Expand Up @@ -3198,11 +3199,11 @@ SOFTWARE.


------
** ruff_python_ast; version 0.0.21 -- https://crates.io/crates/ruff_python_ast
** ruff_python_parser; version 0.0.21 -- https://crates.io/crates/ruff_python_parser
** ruff_python_trivia; version 0.0.21 -- https://crates.io/crates/ruff_python_trivia
** ruff_source_file; version 0.0.21 -- https://crates.io/crates/ruff_source_file
** ruff_text_size; version 0.0.21 -- https://crates.io/crates/ruff_text_size
** ruff_python_ast; version 0.0.22 -- https://crates.io/crates/ruff_python_ast
** ruff_python_parser; version 0.0.22 -- https://crates.io/crates/ruff_python_parser
** ruff_python_trivia; version 0.0.22 -- https://crates.io/crates/ruff_python_trivia
** ruff_source_file; version 0.0.22 -- https://crates.io/crates/ruff_source_file
** ruff_text_size; version 0.0.22 -- https://crates.io/crates/ruff_text_size
MIT License

Copyright (c) <year> <copyright holders>
Expand Down Expand Up @@ -3328,7 +3329,7 @@ THE SOFTWARE.


------
** nix; version 0.31.3 -- https://crates.io/crates/nix
** nix; version 0.32.0 -- https://crates.io/crates/nix
The MIT License (MIT)

Copyright (c) 2015 Carl Lerche + nix-rust Authors
Expand Down Expand Up @@ -3396,7 +3397,7 @@ authorization of the copyright holder.


------
** ruff_unicode_names2; version 0.0.21 -- https://crates.io/crates/ruff_unicode_names2
** ruff_unicode_names2; version 0.0.22 -- https://crates.io/crates/ruff_unicode_names2
UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE

Unicode Data Files include all data files under the directories http://www.unicode.org/Public/, http://www.unicode.org/reports/, http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and http://www.unicode.org/utility/trac/browser/.
Expand Down
6 changes: 3 additions & 3 deletions rust-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ name = "_openjd_rs"
crate-type = ["cdylib", "rlib"]

[dependencies]
openjd-expr = "0.15.0"
openjd-model = "0.16.0"
openjd-sessions = "0.10.0"
openjd-expr = "0.18.1"
openjd-model = "0.18.0"
openjd-sessions = "0.12.1"
tokio = { version = "1", features = ["rt-multi-thread"] }
uuid = { version = "1", features = ["v4"] }
serde_json = "1"
Expand Down
37 changes: 22 additions & 15 deletions rust-bindings/src/expr/expr_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use std::collections::HashMap;

use openjd_expr::types::{ExprType, TypeCode};

use super::errors::expr_err_to_py;

// ── PyTypeCode enum ──

#[cfg_attr(
Expand Down Expand Up @@ -248,7 +250,7 @@ impl PyExprType {
.collect();
validate_typecode_arity(code, &rust_params)?;
return Ok(PyExprType {
inner: ExprType::new(code, rust_params),
inner: ExprType::new(code, rust_params).map_err(expr_err_to_py)?,
});
}
// String form
Expand All @@ -259,7 +261,7 @@ impl PyExprType {
let rust_params: Vec<ExprType> = p.iter().map(|p| p.inner.clone()).collect();
validate_typecode_arity(code, &rust_params)?;
return Ok(PyExprType {
inner: ExprType::new(code, rust_params),
inner: ExprType::new(code, rust_params).map_err(expr_err_to_py)?,
});
}
// Single-arg string form: ExprType("list[int]")
Expand All @@ -273,23 +275,25 @@ impl PyExprType {
}

#[staticmethod]
fn list(elem: &PyExprType) -> Self {
PyExprType {
inner: ExprType::list(elem.inner.clone()),
}
fn list(elem: &PyExprType) -> PyResult<Self> {
Ok(PyExprType {
inner: ExprType::list(elem.inner.clone()).map_err(expr_err_to_py)?,
})
}

#[staticmethod]
fn union(types: Vec<PyExprType>) -> Self {
PyExprType {
inner: ExprType::union(types.into_iter().map(|t| t.inner).collect()),
}
fn union(types: Vec<PyExprType>) -> PyResult<Self> {
Ok(PyExprType {
inner: ExprType::union(types.into_iter().map(|t| t.inner).collect())
.map_err(expr_err_to_py)?,
})
}

fn nullable(&self) -> Self {
PyExprType {
inner: ExprType::union(vec![self.inner.clone(), ExprType::NULLTYPE]),
}
fn nullable(&self) -> PyResult<Self> {
Ok(PyExprType {
inner: ExprType::union(vec![self.inner.clone(), ExprType::NULLTYPE])
.map_err(expr_err_to_py)?,
})
}

fn is_nullable(&self) -> bool {
Expand Down Expand Up @@ -351,7 +355,10 @@ impl PyExprType {
rust_bindings.insert(tc.into(), et.inner);
}
Ok(PyExprType {
inner: self.inner.substitute(&rust_bindings),
inner: self
.inner
.substitute(&rust_bindings)
.map_err(expr_err_to_py)?,
})
}

Expand Down
9 changes: 7 additions & 2 deletions rust-bindings/src/expr/symbol_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ pub(crate) struct PySymbolTable {

pub(crate) fn dict_to_symtab(dict: &Bound<'_, PyDict>) -> PyResult<SymbolTable> {
let mut st = SymbolTable::new();
for (key, value) in dict.iter() {
// A snapshot: converting a value can run user code that changes the dict,
// and PyO3's live dict iterator panics on a size change.
for item in dict.items().iter() {
let (key, value): (Bound<'_, PyAny>, Bound<'_, PyAny>) = item.extract()?;
let k: String = key.extract()?;
if let Ok(sub_dict) = value.cast::<PyDict>() {
let sub = dict_to_symtab(sub_dict)?;
Expand Down Expand Up @@ -425,7 +428,9 @@ pub(crate) fn build_symbol_table(
.map(PathFormat::from)
.unwrap_or_else(PathFormat::host);
let mut st = SymbolTable::new();
for (key, value) in values.iter() {
// A snapshot, as in `dict_to_symtab`.
for item in values.items().iter() {
let (key, value): (Bound<'_, PyAny>, Bound<'_, PyAny>) = item.extract()?;
let dotted: String = key.extract()?;
let target: Option<ExprType> = match types {
Some(t) => match t.get_item(dotted.as_str())? {
Expand Down
11 changes: 11 additions & 0 deletions rust-bindings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use pyo3::prelude::*;
use pyo3::types::PyType;

use openjd_expr::eval::{DEFAULT_MEMORY_LIMIT, DEFAULT_OPERATION_LIMIT};
use openjd_expr::MAX_TYPE_DEPTH;

#[cfg(feature = "stub-gen")]
use pyo3_stub_gen::define_stub_info_gatherer;
Expand Down Expand Up @@ -99,6 +100,7 @@ fn openjd_rs(m: &Bound<'_, PyModule>) -> PyResult<()> {

m.add("DEFAULT_MEMORY_LIMIT", DEFAULT_MEMORY_LIMIT)?;
m.add("DEFAULT_OPERATION_LIMIT", DEFAULT_OPERATION_LIMIT)?;
m.add("MAX_TYPE_DEPTH", MAX_TYPE_DEPTH)?;

register_renamed_exception(
m,
Expand Down Expand Up @@ -188,6 +190,15 @@ fn openjd_rs(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<PyTemplateStepDependency>()?;
m.add_class::<PyTemplateStepScript>()?;
m.add_class::<PyStepTemplate>()?;
// ENV_PARAMS template-time types (unstable upstream; see env_params.rs)
m.add_class::<PyEnvironmentActivation>()?;
m.add_class::<PyExprField>()?;
m.add_class::<PyEnvironmentParameterDefinition>()?;
m.add_function(wrap_pyfunction!(
_reconstruct_environment_parameter_definition,
m
)?)?;
m.add_function(wrap_pyfunction!(_reconstruct_job_parameter_definition, m)?)?;
// JobParameterDefinition variants (template-time)
m.add_class::<PyJobStringParameterDefinition>()?;
m.add_class::<PyJobIntParameterDefinition>()?;
Expand Down
Loading
Loading