From 1b499deeeb333f9f959a9204a42fd836516ff57a Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Thu, 25 Apr 2024 12:36:36 -0600 Subject: [PATCH 1/6] feat(python): Added `remove_rows` to pylace CoreEngine which removes rows based on index. --- pylace/src/lib.rs | 57 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index 3f750b26..c53e43dd 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -13,7 +13,7 @@ use df::{DataFrameLike, PyDataFrame, PySeries}; use lace::data::DataSource; use lace::metadata::SerializedType; use lace::prelude::ColMetadataList; -use lace::{EngineUpdateConfig, FType, HasStates, OracleT}; +use lace::{Datum, EngineUpdateConfig, FType, HasStates, OracleT, TableIndex}; use polars::prelude::{DataFrame, NamedFrom, Series}; use pyo3::create_exception; use pyo3::exceptions::{PyIndexError, PyRuntimeError, PyValueError}; @@ -1179,6 +1179,61 @@ impl CoreEngine { Ok(()) } + /// Remove Rows at the given indices + fn remove_rows(&mut self, rows: &PyList) -> PyResult { + let remove: Vec = rows + .into_iter() + .map(|x| x.str().map(|s| s.to_string())) + .collect::>>()?; + + let row_idxs: Vec = remove + .iter() + .map(|row_name| { + self.engine.codebook.row_index(row_name).ok_or_else(|| { + PyIndexError::new_err(format!( + "{row_name} is not a valid row index" + )) + }) + }) + .collect::>>()?; + + let mut df = polars::frame::DataFrame::empty(); + let index = polars::series::Series::new( + "index", + remove.iter().map(|x| x.clone()).collect::>(), + ); + df.with_column(index).map_err(to_pyerr)?; + + for col_ix in 0..self.engine.n_cols() { + let values = row_idxs + .iter() + .map(|&row_ix| { + self.engine.datum(row_ix, col_ix).map_err(to_pyerr) + }) + .collect::>>()?; + + let ftype = self.engine.ftype(col_ix).map_err(to_pyerr)?; + let srs = utils::vec_to_srs( + values, + col_ix, + ftype, + &self.engine.codebook, + )?; + df.with_column(srs.0).map_err(to_pyerr)?; + } + + self.engine + .remove_data( + row_idxs + .into_iter() + .map(|idx| TableIndex::Row(idx)) + .collect::>>(), + ) + .map_err(to_pyerr)?; + + Ok(PyDataFrame(df)) + } + /// Append new columns to the Engine fn append_columns( &mut self, From d0884bf6ee222630e06128deee0ba8e6bdda8868 Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Thu, 25 Apr 2024 16:40:10 -0600 Subject: [PATCH 2/6] feat(python): Added Codebook.with_index to create a new codebook from an existing one fixup: Updated based on comments from @swandog --- pylace/src/lib.rs | 19 ++++++++++++++----- pylace/src/metadata.rs | 9 +++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index c53e43dd..192e52e0 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -1179,7 +1179,19 @@ impl CoreEngine { Ok(()) } - /// Remove Rows at the given indices + /// Remove Rows at the given indices. + /// + /// Example + /// ------- + /// + /// >>> import lace + /// >>> engine = lace.Engine('animals.rp') + /// >>> n_rows = engine.shape[0] + /// >>> removed = engine.remove_rows(["wolf", "ox"]) + /// >>> removed["index"].to_list() + /// ["wolf", "ox"] + /// >>> n_rows - 1 == engine.shape[0] + /// True fn remove_rows(&mut self, rows: &PyList) -> PyResult { let remove: Vec = rows .into_iter() @@ -1198,10 +1210,7 @@ impl CoreEngine { .collect::>>()?; let mut df = polars::frame::DataFrame::empty(); - let index = polars::series::Series::new( - "index", - remove.iter().map(|x| x.clone()).collect::>(), - ); + let index = polars::series::Series::new("index", remove); df.with_column(index).map_err(to_pyerr)?; for col_ix in 0..self.engine.n_cols() { diff --git a/pylace/src/metadata.rs b/pylace/src/metadata.rs index 1706e77a..87ad430f 100644 --- a/pylace/src/metadata.rs +++ b/pylace/src/metadata.rs @@ -668,6 +668,15 @@ impl Codebook { Ok(()) } } + + /// Create a new codebook with the same columns but row indices from another dataframe. + fn with_index(&self, new_index: Vec) -> PyResult { + let row_names = RowNameList::try_from(new_index).map_err(to_pyerr)?; + Ok(Self(lace::codebook::Codebook { + row_names, + ..self.0.clone() + })) + } } #[pyfunction] From ea3b2b60eebb36eecf87ebb9f5f432f9a682bebf Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Thu, 2 May 2024 16:29:19 -0600 Subject: [PATCH 3/6] feat(python): Added tests for Codebook.with_index and Engine.remove_rows fixup: Corrected formatting in the python module --- pylace/lace/engine.py | 37 ++++++++++++++++++++++++++++++++++- pylace/src/lib.rs | 9 +++------ pylace/tests/test_codebook.py | 8 ++++++++ pylace/tests/test_engine.py | 10 ++++++++++ 4 files changed, 57 insertions(+), 7 deletions(-) diff --git a/pylace/lace/engine.py b/pylace/lace/engine.py index d729b218..aed646c3 100644 --- a/pylace/lace/engine.py +++ b/pylace/lace/engine.py @@ -2,7 +2,7 @@ import itertools as it from os import PathLike -from typing import TYPE_CHECKING, Dict, List, Optional, Union +from typing import TYPE_CHECKING, Dict, List, Optional, Union, Set import pandas as pd import plotly.express as px @@ -2387,6 +2387,41 @@ def clustermap( else: return ClusterMap(df, linkage) + def remove_rows( + self, + indices: Union[pd.Series, List[str], pd.Series, Set[str]], + ) -> pl.DataFrame: + """ + Remove rows from the table. + + Parameters + ---------- + indices: Union[pd.Series, List[str], pd.Series, Set[str]] + Rows to remove from the Engine, specified by index or id name. + + Example + ------- + Remove crab and squid from the animals example engine. + + >>> from lace.examples import Animals + >>> engine = Animals() + >>> n_rows = engine.n_rows + >>> removed = engine.remove_rows(["cow", "wolf"]) + >>> n_rows == engine.n_rows + 1 + True + >>> removed["index"] # doctest: +NORMALIZE_WHITESPACE + ┌────────┐ + │ index │ + │ --- │ + │ str │ + ╞════════╡ + │ cow │ + │ wolf │ + └────────┘ + + """ + return self.engine.remove_rows(indices) + class _TqdmUpdateHandler: def __init__(self): diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index 192e52e0..9690ca1c 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -1190,13 +1190,10 @@ impl CoreEngine { /// >>> removed = engine.remove_rows(["wolf", "ox"]) /// >>> removed["index"].to_list() /// ["wolf", "ox"] - /// >>> n_rows - 1 == engine.shape[0] + /// >>> n_rows - 2 == engine.shape[0] /// True - fn remove_rows(&mut self, rows: &PyList) -> PyResult { - let remove: Vec = rows - .into_iter() - .map(|x| x.str().map(|s| s.to_string())) - .collect::>>()?; + fn remove_rows(&mut self, rows: &Bound) -> PyResult { + let remove: Vec = rows.extract()?; let row_idxs: Vec = remove .iter() diff --git a/pylace/tests/test_codebook.py b/pylace/tests/test_codebook.py index c8dd9a09..f354f17b 100644 --- a/pylace/tests/test_codebook.py +++ b/pylace/tests/test_codebook.py @@ -3,6 +3,7 @@ import polars as pl import lace +from lace.examples import Animals def test_engine_from_polars_with_codebook_smoke(): @@ -65,3 +66,10 @@ def test_engine_with_boolean_string_columns(): assert str(engine.codebook.column_metadata["b"].value_map) == str( lace.ValueMap.bool() ) + + +def test_with_index(): + codebook = Animals().engine.codebook + new_codebook = codebook.with_index(["a", "b", "c"]) + + assert new_codebook.shape[0] == 3 diff --git a/pylace/tests/test_engine.py b/pylace/tests/test_engine.py index 55d17119..b55604eb 100644 --- a/pylace/tests/test_engine.py +++ b/pylace/tests/test_engine.py @@ -11,3 +11,13 @@ def test_deep_copy(): assert a.columns == b.columns assert a.shape == b.shape + + +def test_remove_rows(): + from lace.examples import Animals + + engine = Animals() + n_rows = engine.n_rows + removed = engine.remove_rows(["cow", "wolf"]) + assert n_rows == engine.n_rows + 2 + assert removed["index"].len() == 2 From 32c222aa04ad15a300f5e76db598e80920fc420a Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Tue, 30 Apr 2024 16:25:10 -0600 Subject: [PATCH 4/6] chore: Updated CI's maturin, ARM building on MacOS 14, and book versions --- .github/scripts/find_compatible_wheel.py | 20 +++++++++++------ .github/workflows/python-build-test.yaml | 24 +++++++++++---------- book/lace_preprocess_mdbook_yaml/Cargo.toml | 4 ++-- pylace/pyproject.toml | 2 +- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.github/scripts/find_compatible_wheel.py b/.github/scripts/find_compatible_wheel.py index af3a9a34..08857173 100644 --- a/.github/scripts/find_compatible_wheel.py +++ b/.github/scripts/find_compatible_wheel.py @@ -10,23 +10,29 @@ description="Program to find wheels in a directory compatible with the current version of Python" ) -parser.add_argument("package", help="The name of the package that you are searching for a wheel for") +parser.add_argument( + "package", help="The name of the package that you are searching for a wheel for" +) parser.add_argument("dir", help="the directory under which to search for the wheels") -args=parser.parse_args() +args = parser.parse_args() -wheel=None +wheel = None for tag in sys_tags(): print(f"Looking for file matching tag {tag}", file=sys.stderr) - matches=glob.glob(args.package + "*" + str(tag) + "*.whl", root_dir=args.dir) + matches = glob.glob(args.package + "*" + str(tag) + "*.whl", root_dir=args.dir) if len(matches) == 1: - wheel=matches[0] + wheel = matches[0] break elif len(matches) > 1: - print("Found multiple matches for the same tag " + str(tag), matches, file=sys.stderr) + print( + f"Found multiple matches for the same tag `{tag}`", + matches, + file=sys.stderr, + ) -if wheel: +if wheel: print(os.path.join(args.dir, wheel)) else: sys.exit("Did not find compatible wheel") diff --git a/.github/workflows/python-build-test.yaml b/.github/workflows/python-build-test.yaml index caecdb8a..0259ba33 100644 --- a/.github/workflows/python-build-test.yaml +++ b/.github/workflows/python-build-test.yaml @@ -20,7 +20,7 @@ jobs: defaults: run: working-directory: pylace - + steps: - uses: actions/checkout@v4 @@ -30,7 +30,7 @@ jobs: python-version: '3.12' cache: 'pip' cache-dependency-path: "pylace/requirements-lint.txt" - + - name: Install Python dependencies run: | pip install --upgrade pip @@ -102,10 +102,11 @@ jobs: - name: Build wheels uses: PyO3/maturin-action@v1 with: + maturin-version: 1.5.1 target: ${{ matrix.target }} args: --release --out dist -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --manifest-path pylace/Cargo.toml manylinux: auto - + - name: Install dev dependencies run: | pip install --upgrade pip @@ -113,7 +114,6 @@ jobs: - name: Install pylace run: | - ls -l ./dist WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) echo "Installing $WHEEL_FILE" pip install $WHEEL_FILE @@ -147,9 +147,10 @@ jobs: - name: Build wheels uses: PyO3/maturin-action@v1 with: + maturin-version: 1.5.1 target: ${{ matrix.target }} args: --release --out dist -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --manifest-path pylace/Cargo.toml - + - name: Install dev dependencies run: | pip install --upgrade pip @@ -157,7 +158,6 @@ jobs: - name: Install pylace run: | - ls -l ./dist $WHEEL_FILE = (python3 .github/scripts/find_compatible_wheel.py pylace ./dist) echo "Installing $WHEEL_FILE" pip install $WHEEL_FILE @@ -172,11 +172,15 @@ jobs: path: dist macos: - runs-on: macos-latest needs: ["lint-python", "lint-rust"] strategy: matrix: - target: [x86_64, aarch64] + include: + - os: macos-latest + target: aarch64 + - os: macos-13 + target: x86_64 + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -190,24 +194,22 @@ jobs: - name: Build wheels uses: PyO3/maturin-action@v1 with: + maturin-version: 1.5.1 target: ${{ matrix.target }} args: --release --out dist -i python3.8 -i python3.9 -i python3.10 -i python3.11 -i python3.12 --manifest-path pylace/Cargo.toml - name: Install dev dependencies - if: ${{ matrix.target != 'aarch64' }} run: | pip install --upgrade pip pip install -r pylace/requirements-dev.txt - name: Install pylace - if: ${{ matrix.target != 'aarch64' }} run: | WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) echo "Installing $WHEEL_FILE" pip install $WHEEL_FILE - name: Run Tests - if: ${{ matrix.target != 'aarch64' }} run: pytest pylace/tests - name: Upload wheels diff --git a/book/lace_preprocess_mdbook_yaml/Cargo.toml b/book/lace_preprocess_mdbook_yaml/Cargo.toml index b202e30a..7a3c0a9e 100644 --- a/book/lace_preprocess_mdbook_yaml/Cargo.toml +++ b/book/lace_preprocess_mdbook_yaml/Cargo.toml @@ -16,8 +16,8 @@ path = "src/main.rs" anyhow = "1.0" clap = "4.2" env_logger = "0.10" -lace_codebook = { path = "../../lace/lace_codebook", version = "0.6.0" } -lace_stats = { path = "../../lace/lace_stats", version = "0.3.0" } +lace_codebook = { path = "../../lace/lace_codebook", version = "0.7.0" } +lace_stats = { path = "../../lace/lace_stats", version = "0.4.0" } log = "0.4" mdbook = "0.4" pulldown-cmark = { version = "0.9", default-features = false } diff --git a/pylace/pyproject.toml b/pylace/pyproject.toml index b827dba9..6651421b 100644 --- a/pylace/pyproject.toml +++ b/pylace/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["maturin>=0.13,<0.14"] +requires = ["maturin>=1.0,<2"] build-backend = "maturin" [project] From 8796e42a6e3c7b6767e6e15354deb1c84439b272 Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Wed, 1 May 2024 07:58:23 -0600 Subject: [PATCH 5/6] feat: Updated pyo3 --- .github/scripts/find_compatible_wheel.py | 2 +- pylace/Cargo.lock | 482 ++++++++++++----------- pylace/Cargo.toml | 2 +- pylace/pyproject.toml | 4 + pylace/requirements-dev.txt | 10 +- pylace/src/df.rs | 17 +- pylace/src/lib.rs | 108 ++--- pylace/src/metadata.rs | 26 +- pylace/src/update_handler.rs | 8 +- pylace/src/utils.rs | 128 +++--- 10 files changed, 420 insertions(+), 367 deletions(-) diff --git a/.github/scripts/find_compatible_wheel.py b/.github/scripts/find_compatible_wheel.py index 08857173..99343631 100644 --- a/.github/scripts/find_compatible_wheel.py +++ b/.github/scripts/find_compatible_wheel.py @@ -21,7 +21,7 @@ for tag in sys_tags(): print(f"Looking for file matching tag {tag}", file=sys.stderr) - matches = glob.glob(args.package + "*" + str(tag) + "*.whl", root_dir=args.dir) + matches = glob.glob(f"{args.package}*{tag}*.whl", root_dir=args.dir) if len(matches) == 1: wheel = matches[0] break diff --git a/pylace/Cargo.lock b/pylace/Cargo.lock index 75d1782f..1b6d316c 100644 --- a/pylace/Cargo.lock +++ b/pylace/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -17,18 +17,18 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "android-tzdata" @@ -56,9 +56,9 @@ dependencies = [ [[package]] name = "argminmax" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202108b46429b765ef483f8a24d5c46f48c14acfdacc086dd4ab6dddf6bcdbd2" +checksum = "52424b59d69d69d5056d508b260553afd91c57e21849579cd1f50ee8b8b88eaa" dependencies = [ "num-traits", ] @@ -96,9 +96,9 @@ checksum = "9ae037714f313c1353189ead58ef9eec30a8e8dc101b2622d461418fd59e28a9" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bincode" @@ -111,56 +111,51 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.83" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" dependencies = [ "jobserver", "libc", + "once_cell", ] [[package]] @@ -171,25 +166,25 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] name = "comfy-table" -version = "7.1.0" +version = "7.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c64043d6c7b7a4c58e39e7efccfdea7b93d885a795d0c054a69dbbf4dd52686" +checksum = "b34115915337defe99b2aff5c2ce6771e5fbc4079f4b506301f5cf394c8452f7" dependencies = [ "crossterm", "strum", - "strum_macros", + "strum_macros 0.26.2", "unicode-width", ] @@ -214,9 +209,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -261,7 +256,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ - "bitflags 2.4.2", + "bitflags", "crossterm_winapi", "libc", "parking_lot", @@ -306,15 +301,15 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dyn-clone" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "encode_unicode" @@ -324,14 +319,14 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "enum_dispatch" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" +checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -360,9 +355,9 @@ checksum = "ee1b05cbd864bcaecbd3455d6d967862d446e4ebfc3c2e5e5b9841e53cba6673" [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" dependencies = [ "cfg-if", "js-sys", @@ -388,9 +383,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -405,9 +400,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -426,9 +421,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -449,20 +444,20 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] [[package]] name = "indicatif" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb28741c9db9a713d93deb3bb9515c20788cef5815265bee4980e87bde7e0f25" +checksum = "763a5a8f45087d6bcea4222e7b72c291a054edf80e4ef6efd2a4979878c7bea3" dependencies = [ "console", "instant", @@ -473,9 +468,9 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "instant" @@ -488,33 +483,33 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -658,9 +653,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" [[package]] name = "libm" @@ -670,20 +665,19 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libredox" -version = "0.0.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.4.2", + "bitflags", "libc", - "redox_syscall", ] [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -691,9 +685,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru" @@ -745,9 +739,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap2" @@ -760,18 +754,18 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" dependencies = [ "autocfg", ] [[package]] name = "multiversion" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c7b9d7fe61760ce5ea19532ead98541f6b4c495d87247aff9826445cf6872a" +checksum = "c4851161a11d3ad0bf9402d90ffc3967bf231768bfd7aeb61755ad06dbf1a142" dependencies = [ "multiversion-macros", "target-features", @@ -779,9 +773,9 @@ dependencies = [ [[package]] name = "multiversion-macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a83d8500ed06d68877e9de1dde76c1dbb83885dcdbda4ef44ccbc3fbda2ac8" +checksum = "79a74ddee9e0c27d2578323c13905793e91622148f138ba29738f9dddb835e90" dependencies = [ "proc-macro2", "quote", @@ -791,9 +785,9 @@ dependencies = [ [[package]] name = "nalgebra" -version = "0.32.3" +version = "0.32.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" +checksum = "3ea4908d4f23254adda3daa60ffef0f1ac7b8c3e9a864cf3cc154b251908a2ef" dependencies = [ "approx", "matrixmultiply", @@ -837,9 +831,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" dependencies = [ "num-bigint", "num-complex", @@ -862,9 +856,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" dependencies = [ "num-traits", "serde", @@ -872,19 +866,18 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -905,9 +898,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -949,9 +942,9 @@ checksum = "efa535d5117d3661134dbf1719b6f0ffe06f2375843b13935db186cd094105eb" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", "parking_lot_core", @@ -959,15 +952,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -1008,9 +1001,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "planus" @@ -1054,7 +1047,7 @@ dependencies = [ "fast-float", "foreign_vec", "getrandom", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "itoa", "lz4", "multiversion", @@ -1089,12 +1082,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f5efe734b6cbe5f97ea769be8360df5324fade396f1f3f5ad7fe9360ca4a23" dependencies = [ "ahash", - "bitflags 2.4.2", + "bitflags", "bytemuck", "chrono", "comfy-table", "either", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "indexmap", "num-traits", "once_cell", @@ -1162,7 +1155,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d7105b40905bb38e8fc4a7fd736594b7491baa12fad3ac492969ca221a1b5d5" dependencies = [ "ahash", - "bitflags 2.4.2", + "bitflags", "glob", "once_cell", "polars-arrow", @@ -1188,7 +1181,7 @@ dependencies = [ "argminmax", "bytemuck", "either", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "indexmap", "memchr", "num-traits", @@ -1212,7 +1205,7 @@ dependencies = [ "crossbeam-channel", "crossbeam-queue", "enum_dispatch", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "num-traits", "polars-arrow", "polars-compute", @@ -1246,7 +1239,7 @@ dependencies = [ "rayon", "regex", "smartstring", - "strum_macros", + "strum_macros 0.25.3", "version_check", ] @@ -1305,7 +1298,7 @@ checksum = "b174ca4a77ad47d7b91a0460aaae65bbf874c8bfbaaa5308675dadef3976bbda" dependencies = [ "ahash", "bytemuck", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "indexmap", "num-traits", "once_cell", @@ -1330,18 +1323,18 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] [[package]] name = "puruspe" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7765e19fb2ba6fd4373b8d90399f5321683ea7c11b598c6bbaa3a72e9c83b8" +checksum = "06a1eed715f625eaa95fba5e049dcf7bc06fa396d6d2e55015b3764e234dfd3f" [[package]] name = "pylace" @@ -1362,15 +1355,16 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.20.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0" +checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8" dependencies = [ "cfg-if", "indoc", "libc", "memoffset", "parking_lot", + "portable-atomic", "pyo3-build-config", "pyo3-ffi", "pyo3-macros", @@ -1379,9 +1373,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.20.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be" +checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" dependencies = [ "once_cell", "target-lexicon", @@ -1389,9 +1383,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.20.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1" +checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403" dependencies = [ "libc", "pyo3-build-config", @@ -1399,33 +1393,34 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.20.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3" +checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c" dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "pyo3-macros-backend" -version = "0.20.2" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f" +checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c" dependencies = [ "heck", "proc-macro2", + "pyo3-build-config", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1490,9 +1485,9 @@ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" [[package]] name = "rayon" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -1500,9 +1495,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -1510,18 +1505,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom", "libredox", @@ -1530,9 +1525,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -1542,9 +1537,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -1553,26 +1548,27 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" [[package]] name = "rv" -version = "0.16.3" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35f602941aca67593b30eea71a0b372e50e3ad63e7aa6b98b2ea18ff74ba9cf8" +checksum = "c07e0a3b756794c7ea2f05d93760ffb946ff4f94b255d92444d94c19fd71f4ab" dependencies = [ "doc-comment", "lru", "nalgebra", "num", + "num-traits", "peroxide", "rand", "rand_distr", @@ -1582,9 +1578,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "safe_arch" @@ -1603,29 +1599,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.199" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.199" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" dependencies = [ "itoa", "ryu", @@ -1634,9 +1630,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.9.30" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ "indexmap", "itoa", @@ -1666,9 +1662,9 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "smallvec" -version = "1.12.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smartstring" @@ -1719,9 +1715,9 @@ checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" [[package]] name = "strum" -version = "0.25.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29" [[package]] name = "strum_macros" @@ -1733,7 +1729,20 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.60", +] + +[[package]] +name = "strum_macros" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.60", ] [[package]] @@ -1749,9 +1758,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" dependencies = [ "proc-macro2", "quote", @@ -1760,9 +1769,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.30.5" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb4f3438c8f6389c864e61221cbc97e9bca98b4daf39a5beb7bea660f528bb2" +checksum = "87341a165d73787554941cd5ef55ad728011566fe714e987d1b976c15dbc3a83" dependencies = [ "cfg-if", "core-foundation-sys", @@ -1774,34 +1783,34 @@ dependencies = [ [[package]] name = "target-features" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb5fa503293557c5158bd215fdc225695e567a77e453f5d4452a50a193969bd" +checksum = "c1bbb9f3c5c463a01705937a24fdabc5047929ac764b2d5b9cf681c1f5041ed5" [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] @@ -1827,9 +1836,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" [[package]] name = "unindent" @@ -1839,9 +1848,9 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "version_check" @@ -1857,9 +1866,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1867,24 +1876,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1892,28 +1901,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wide" -version = "0.7.13" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" +checksum = "0f0e39d2c603fdc0504b12b458cf1f34e0b937ed2f4f2dc20796e3e86f34e11f" dependencies = [ "bytemuck", "safe_arch", @@ -1948,7 +1957,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1957,7 +1966,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1975,7 +1984,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.5", ] [[package]] @@ -1995,17 +2004,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -2016,9 +2026,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -2028,9 +2038,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -2040,9 +2050,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -2052,9 +2068,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -2064,9 +2080,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -2076,9 +2092,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -2088,15 +2104,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "xxhash-rust" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" [[package]] name = "zerocopy" @@ -2115,32 +2131,32 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.60", ] [[package]] name = "zstd" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.0.0" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", "pkg-config", diff --git a/pylace/Cargo.toml b/pylace/Cargo.toml index 3612514a..5876af55 100644 --- a/pylace/Cargo.toml +++ b/pylace/Cargo.toml @@ -13,7 +13,7 @@ lace = { path = "../lace", version="0.8.0" } lace_utils = { path = "../lace/lace_utils", version="0.3.0" } rand = "0.8.5" rand_xoshiro = "0.6.0" -pyo3 = { version = "0.20", features = ["extension-module"] } +pyo3 = { version = "0.21", features = ["extension-module"] } serde_json = "1.0.91" serde_yaml = "0.9.17" polars = "0.36" diff --git a/pylace/pyproject.toml b/pylace/pyproject.toml index 6651421b..fc161712 100644 --- a/pylace/pyproject.toml +++ b/pylace/pyproject.toml @@ -131,3 +131,7 @@ strict = true [tool.black] line-length = 80 + + +[tool.maturin] +module-name = "lace.core" diff --git a/pylace/requirements-dev.txt b/pylace/requirements-dev.txt index e5f4356a..aacb02b0 100644 --- a/pylace/requirements-dev.txt +++ b/pylace/requirements-dev.txt @@ -3,8 +3,8 @@ # Dependencies # Tooling -hypothesis==6.65.2 -maturin==0.14.10 -pytest==7.2.0 -pytest-cov==4.0.0 -pytest-xdist==3.1.0 +hypothesis==6.100.2 +maturin==1.5.1 +pytest==8.2.0 +pytest-cov==5.0.0 +pytest-xdist==3.6.1 diff --git a/pylace/src/df.rs b/pylace/src/df.rs index b7d05c00..d7200ac6 100644 --- a/pylace/src/df.rs +++ b/pylace/src/df.rs @@ -4,10 +4,10 @@ use polars::series::Series; use polars_arrow::ffi; use pyo3::exceptions::{PyException, PyIOError, PyValueError}; use pyo3::ffi::Py_uintptr_t; -use pyo3::types::PyModule; +use pyo3::types::{PyAnyMethods, PyModule}; use pyo3::{ - create_exception, FromPyObject, IntoPy, PyAny, PyErr, PyObject, PyResult, - Python, ToPyObject, + create_exception, Bound, FromPyObject, IntoPy, PyAny, PyErr, PyObject, + PyResult, Python, ToPyObject, }; #[derive(Debug)] @@ -146,7 +146,7 @@ impl<'a> FromPyObject<'a> for PyDataFrame { pub(crate) fn to_py_array( array: ArrayRef, py: Python, - pyarrow: &PyModule, + pyarrow: &Bound, ) -> PyResult { let schema = Box::new(ffi::export_field_to_c(&ArrowField::new( "", @@ -173,10 +173,11 @@ impl IntoPy for PySeries { let s = self.0.rechunk(); let name = s.name(); let arr = s.to_arrow(0); - let pyarrow = py.import("pyarrow").expect("pyarrow not installed"); - let polars = py.import("polars").expect("polars not installed"); + let pyarrow = + py.import_bound("pyarrow").expect("pyarrow not installed"); + let polars = py.import_bound("polars").expect("polars not installed"); - let arg = to_py_array(arr, py, pyarrow).unwrap(); + let arg = to_py_array(arr, py, &pyarrow).unwrap(); let s = polars.call_method1("from_arrow", (arg,)).unwrap(); let s = s.call_method1("rename", (name,)).unwrap(); s.to_object(py) @@ -194,7 +195,7 @@ impl IntoPy for PyDataFrame { .map(|s| PySeries(s.clone()).into_py(py)) .collect::>(); - let polars = py.import("polars").expect("polars not installed"); + let polars = py.import_bound("polars").expect("polars not installed"); let df_object = polars.call_method1("DataFrame", (pyseries,)).unwrap(); df_object.into_py(py) } diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index 9690ca1c..c0c6624c 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -114,7 +114,7 @@ impl CoreEngine { /// Load a Engine from metadata #[classmethod] - fn load(_cls: &PyType, path: PathBuf) -> PyResult { + fn load(_cls: &Bound, path: PathBuf) -> PyResult { let (engine, rng) = { let mut engine = lace::Engine::load(path) .map_err(|e| EngineLoadError::new_err(e.to_string()))?; @@ -143,7 +143,7 @@ impl CoreEngine { } /// Return a copy of the engine - fn __deepcopy__(&self, _memo: &PyDict) -> Self { + fn __deepcopy__(&self, _memo: &Bound) -> Self { self.clone() } @@ -238,7 +238,7 @@ impl CoreEngine { .collect() } - fn ftype(&self, col: &PyAny) -> PyResult { + fn ftype(&self, col: &Bound) -> PyResult { let col_ix = utils::value_to_name(col, &self.col_indexer)?; self.engine .ftype(col_ix) @@ -284,9 +284,9 @@ impl CoreEngine { fn feature_params<'p>( &self, py: Python<'p>, - col: &PyAny, + col: &Bound, state_ix: usize, - ) -> PyResult<&'p PyAny> { + ) -> PyResult> { use component::ComponentParams; let col_ix = utils::value_to_index(col, &self.col_indexer)?; @@ -302,16 +302,16 @@ impl CoreEngine { let mixture = self.engine.states[state_ix].feature_as_mixture(col_ix); match ComponentParams::from(mixture) { ComponentParams::Bernoulli(params) => { - Ok(params.into_py(py).into_ref(py)) + Ok(params.into_py(py).into_bound(py)) } ComponentParams::Categorical(params) => { - Ok(params.into_py(py).into_ref(py)) + Ok(params.into_py(py).into_bound(py)) } ComponentParams::Gaussian(params) => { - Ok(params.into_py(py).into_ref(py)) + Ok(params.into_py(py).into_bound(py)) } ComponentParams::Poisson(params) => { - Ok(params.into_py(py).into_ref(py)) + Ok(params.into_py(py).into_bound(py)) } } } @@ -361,7 +361,7 @@ impl CoreEngine { /// array([0.125, 0. ]) /// >>> engine.depprob([('swims', 'flippers'), ('swims', 'fast')]) /// array([0.875, 0.25 ]) - fn depprob(&self, col_pairs: &PyList) -> PyResult { + fn depprob(&self, col_pairs: &Bound) -> PyResult { let pairs = list_to_pairs(col_pairs, &self.col_indexer)?; self.engine .depprob_pw(&pairs) @@ -373,11 +373,11 @@ impl CoreEngine { #[pyo3(signature=(col_pairs, n_mc_samples=1000, mi_type="iqr"))] fn mi( &self, - col_pairs: &PyList, + col_pairs: &Bound, n_mc_samples: usize, mi_type: &str, ) -> PyResult { - let pairs = list_to_pairs(col_pairs, &self.col_indexer)?; + let pairs = list_to_pairs(&col_pairs, &self.col_indexer)?; let mi_type = utils::str_to_mitype(mi_type)?; self.engine .mi_pw(&pairs, n_mc_samples, mi_type) @@ -440,8 +440,8 @@ impl CoreEngine { #[pyo3(signature=(row_pairs, wrt=None, col_weighted=false))] fn rowsim( &self, - row_pairs: &PyList, - wrt: Option<&PyAny>, + row_pairs: &Bound, + wrt: Option<&Bound>, col_weighted: bool, ) -> PyResult { let variant = if col_weighted { @@ -465,8 +465,8 @@ impl CoreEngine { fn pairwise_fn( &self, fn_name: &str, - pairs: &PyList, - fn_kwargs: Option<&PyDict>, + pairs: &Bound, + fn_kwargs: Option<&Bound>, ) -> PyResult { match fn_name { "depprob" => self.depprob(pairs).map(|xs| (xs, &self.col_indexer)), @@ -481,9 +481,9 @@ impl CoreEngine { "rowsim" => { let args = fn_kwargs.map_or_else( || Ok(utils::RowsimArgs::default()), - utils::rowsim_args_from_dict, + |dict| utils::rowsim_args_from_dict(dict), )?; - self.rowsim(pairs, args.wrt, args.col_weighted) + self.rowsim(pairs, args.wrt.as_ref(), args.col_weighted) .map(|xs| (xs, &self.row_indexer)) } _ => Err(PyErr::new::(format!( @@ -544,8 +544,8 @@ impl CoreEngine { #[pyo3(signature = (cols, given=None, n=1))] fn simulate( &mut self, - cols: &PyAny, - given: Option<&PyDict>, + cols: &Bound, + given: Option<&Bound>, n: usize, ) -> PyResult { let col_ixs = pyany_to_indices(cols, &self.col_indexer)?; @@ -583,8 +583,8 @@ impl CoreEngine { #[pyo3(signature = (row, col, n=1))] fn draw( &mut self, - row: &PyAny, - col: &PyAny, + row: &Bound, + col: &Bound, n: usize, ) -> PyResult { let row_ix = utils::value_to_index(row, &self.row_indexer)?; @@ -636,8 +636,8 @@ impl CoreEngine { /// ``` fn logp( &self, - values: &PyAny, - given: Option<&PyDict>, + values: &Bound, + given: Option<&Bound>, state_ixs: Option>, ) -> PyResult { let df_vals = @@ -664,8 +664,8 @@ impl CoreEngine { fn logp_scaled( &self, - values: &PyAny, - given: Option<&PyDict>, + values: &Bound, + given: Option<&Bound>, state_ixs: Option>, ) -> PyResult { let df_vals = @@ -693,9 +693,9 @@ impl CoreEngine { #[pyo3(signature=(col, rows=None, values=None, state_ixs=None))] fn surprisal( &self, - col: &PyAny, - rows: Option<&PyAny>, - values: Option<&PyAny>, + col: &Bound, + rows: Option<&Bound>, + values: Option<&Bound>, state_ixs: Option>, ) -> PyResult { let col_ix = utils::value_to_index(col, &self.col_indexer)?; @@ -817,7 +817,11 @@ impl CoreEngine { } #[pyo3(signature=(row, wrt=None))] - fn novelty(&self, row: &PyAny, wrt: Option<&PyAny>) -> PyResult { + fn novelty( + &self, + row: &Bound, + wrt: Option<&Bound>, + ) -> PyResult { let row_ix = utils::value_to_index(row, &self.row_indexer)?; let wrt = wrt .map(|cols| utils::pyany_to_indices(cols, &self.col_indexer)) @@ -828,7 +832,11 @@ impl CoreEngine { } #[pyo3(signature=(cols, n_mc_samples=1000))] - fn entropy(&self, cols: &PyAny, n_mc_samples: usize) -> PyResult { + fn entropy( + &self, + cols: &Bound, + n_mc_samples: usize, + ) -> PyResult { let col_ixs = utils::pyany_to_indices(cols, &self.col_indexer)?; self.engine .entropy(&col_ixs, n_mc_samples) @@ -855,8 +863,8 @@ impl CoreEngine { #[pyo3(signature=(col, rows=None, with_uncertainty=true))] fn impute( &mut self, - col: &PyAny, - rows: Option<&PyAny>, + col: &Bound, + rows: Option<&Bound>, with_uncertainty: bool, ) -> PyResult { use lace::cc::feature::Feature; @@ -938,8 +946,8 @@ impl CoreEngine { #[pyo3(signature=(target, given=None, state_ixs=None, with_uncertainty=true))] fn predict( &self, - target: &PyAny, - given: Option<&PyDict>, + target: &Bound, + given: Option<&Bound>, state_ixs: Option>, with_uncertainty: bool, ) -> PyResult> { @@ -972,8 +980,8 @@ impl CoreEngine { #[pyo3(signature=(target, given=None, state_ixs=None))] fn variability( &self, - target: &PyAny, - given: Option<&PyDict>, + target: &Bound, + given: Option<&Bound>, state_ixs: Option>, ) -> PyResult { let col_ix = value_to_index(target, &self.col_indexer)?; @@ -1123,7 +1131,7 @@ impl CoreEngine { /// ... ) /// >>> /// >>> engine.append_rows(row) - fn append_rows(&mut self, rows: &PyAny) -> PyResult<()> { + fn append_rows(&mut self, rows: &Bound) -> PyResult<()> { let df_vals = pandas_to_insert_values( rows, &self.col_indexer, @@ -1243,7 +1251,7 @@ impl CoreEngine { /// Append new columns to the Engine fn append_columns( &mut self, - cols: &PyAny, + cols: &Bound, mut metadata: Vec, ) -> PyResult<()> { let suppl_types = Some( @@ -1316,7 +1324,7 @@ impl CoreEngine { } /// Delete a given column from the ``Engine`` - fn del_column(&mut self, col: &PyAny) -> PyResult<()> { + fn del_column(&mut self, col: &Bound) -> PyResult<()> { let col_ix = utils::value_to_index(col, &self.col_indexer)?; self.col_indexer.drop_by_ix(col_ix)?; self.engine.del_column(col_ix).map_err(to_pyerr) @@ -1334,9 +1342,9 @@ impl CoreEngine { /// The new value at the cell fn edit_cell( &mut self, - row: &PyAny, - col: &PyAny, - value: &PyAny, + row: &Bound, + col: &Bound, + value: &Bound, ) -> PyResult<()> { let row_ix = utils::value_to_index(row, &self.row_indexer)?; let col_ix = utils::value_to_index(col, &self.col_indexer)?; @@ -1360,7 +1368,7 @@ impl CoreEngine { fn categorical_support( &self, - col: &PyAny, + col: &Bound, ) -> PyResult>> { use lace::codebook::ValueMap as Vm; let col_ix = utils::value_to_index(col, &self.col_indexer)?; @@ -1397,7 +1405,7 @@ impl CoreEngine { } pub fn __getstate__(&self, py: Python) -> PyResult { - Ok(PyBytes::new( + Ok(PyBytes::new_bound( py, &bincode::serialize(&self).map_err(|e| { PyValueError::new_err(format!( @@ -1434,7 +1442,8 @@ create_exception!(lace, EngineUpdateError, pyo3::exceptions::PyException); /// A Python module implemented in Rust. #[pymodule] -fn core(py: Python, m: &PyModule) -> PyResult<()> { +#[pyo3(name = "core")] +fn core(py: Python, m: &Bound) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?; @@ -1453,7 +1462,10 @@ fn core(py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_function(wrap_pyfunction!(infer_srs_metadata, m)?)?; m.add_function(wrap_pyfunction!(metadata::codebook_from_df, m)?)?; - m.add("EngineLoadError", py.get_type::())?; - m.add("EngineUpdateError", py.get_type::())?; + m.add("EngineLoadError", py.get_type_bound::())?; + m.add( + "EngineUpdateError", + py.get_type_bound::(), + )?; Ok(()) } diff --git a/pylace/src/metadata.rs b/pylace/src/metadata.rs index 87ad430f..27aa53dd 100644 --- a/pylace/src/metadata.rs +++ b/pylace/src/metadata.rs @@ -278,7 +278,7 @@ impl ValueMap { /// Create a map of ``k`` unsigned integers #[classmethod] #[pyo3(signature = (k))] - pub fn int(_cls: &PyType, k: usize) -> Self { + pub fn int(_cls: &Bound, k: usize) -> Self { Self(lace::codebook::ValueMap::U8(k)) } @@ -295,7 +295,7 @@ impl ValueMap { /// The strings are not unique #[classmethod] #[pyo3(signature = (values))] - pub fn string(_cls: &PyType, values: Vec) -> PyResult { + pub fn string(_cls: &Bound, values: Vec) -> PyResult { lace::codebook::ValueMap::try_from(values) .map_err(PyValueError::new_err) .map(Self) @@ -303,7 +303,7 @@ impl ValueMap { /// Create a map from boolean #[classmethod] - pub fn bool(_cls: &PyType) -> Self { + pub fn bool(_cls: &Bound) -> Self { Self(lace::codebook::ValueMap::Bool) } @@ -349,7 +349,7 @@ impl ColumnMetadata { #[classmethod] #[pyo3(signature = (name, prior=None, hyper=None))] pub fn continuous( - _cls: &PyType, + _cls: &Bound, name: String, prior: Option, hyper: Option, @@ -386,7 +386,7 @@ impl ColumnMetadata { #[classmethod] #[pyo3(signature = (name, k, value_map=None, prior=None, hyper=None))] pub fn categorical( - _cls: &PyType, + _cls: &Bound, name: String, k: usize, value_map: Option, @@ -423,7 +423,7 @@ impl ColumnMetadata { #[classmethod] #[pyo3(signature = (name, prior=None, hyper=None))] pub fn count( - _cls: &PyType, + _cls: &Bound, name: String, prior: Option, hyper: Option, @@ -512,7 +512,7 @@ impl PriorProcess { #[classmethod] #[pyo3(signature=(alpha_shape=1.0, alpha_rate=1.0, d_a=0.5, d_b=0.5))] pub fn pitman_yor( - _cls: &PyType, + _cls: &Bound, alpha_shape: f64, alpha_rate: f64, d_a: f64, @@ -526,7 +526,11 @@ impl PriorProcess { #[classmethod] #[pyo3(signature=(alpha_shape=1.0, alpha_rate=1.0))] - pub fn dirichlet(_cls: &PyType, alpha_shape: f64, alpha_rate: f64) -> Self { + pub fn dirichlet( + _cls: &Bound, + alpha_shape: f64, + alpha_rate: f64, + ) -> Self { PriorProcess(lace::codebook::PriorProcess::Dirichlet { alpha_prior: Gamma::new(alpha_shape, alpha_rate).unwrap(), }) @@ -708,7 +712,7 @@ pub struct CodebookBuilder { impl CodebookBuilder { #[classmethod] /// Load a Codebook from a path. - fn load(_cls: &PyType, path: PathBuf) -> Self { + fn load(_cls: &Bound, path: PathBuf) -> Self { Self { method: CodebookMethod::Path(path), } @@ -717,7 +721,7 @@ impl CodebookBuilder { #[classmethod] #[pyo3(signature = (cat_cutoff=None, state_prior_process=None, view_prior_process=None, use_hypers=true))] fn infer( - _cls: &PyType, + _cls: &Bound, cat_cutoff: Option, state_prior_process: Option, view_prior_process: Option, @@ -734,7 +738,7 @@ impl CodebookBuilder { } #[classmethod] - fn codebook(_cls: &PyType, codebook: Codebook) -> Self { + fn codebook(_cls: &Bound, codebook: Codebook) -> Self { Self { method: CodebookMethod::Codebook(codebook), } diff --git a/pylace/src/update_handler.rs b/pylace/src/update_handler.rs index 023e18e3..643834ea 100644 --- a/pylace/src/update_handler.rs +++ b/pylace/src/update_handler.rs @@ -4,7 +4,7 @@ use std::sync::{Arc, Mutex}; use lace::cc::state::State; use lace::update_handler::UpdateHandler; use lace::EngineUpdateConfig; -use pyo3::{pyclass, IntoPy, Py, PyAny}; +use pyo3::{prelude::PyDictMethods, pyclass, IntoPy, Py, PyAny}; /// Python version of `EngineUpdateConfig`. #[derive(Clone, Debug)] @@ -36,7 +36,7 @@ impl PyUpdateHandler { macro_rules! pydict { ($py: expr, $($key:tt : $val:expr),* $(,)?) => {{ - let map = pyo3::types::PyDict::new($py); + let map = pyo3::types::PyDict::new_bound($py); $( let _ = map.set_item($key, $val.into_py($py)) .expect("Should be able to set item in PyDict"); @@ -59,7 +59,7 @@ macro_rules! call_pyhandler_noret { ); handler - .call_method(py, $func_name, (), kwargs.into()) + .call_method_bound(py, $func_name, (), Some(&kwargs)) .expect("Expected python call_method to return successfully"); }) }}; @@ -79,7 +79,7 @@ macro_rules! call_pyhandler_ret { ); handler - .call_method(py, $func_name, (), kwargs.into()) + .call_method_bound(py, $func_name, (), Some(&kwargs)) .expect("Expected python call_method to return successfully") .extract(py) .expect("Failed to extract expected type") diff --git a/pylace/src/utils.rs b/pylace/src/utils.rs index 033dcd94..a7848640 100644 --- a/pylace/src/utils.rs +++ b/pylace/src/utils.rs @@ -184,7 +184,7 @@ pub(crate) struct MiArgs { #[derive(Default)] pub(crate) struct RowsimArgs<'a> { - pub(crate) wrt: Option<&'a PyAny>, + pub(crate) wrt: Option>, pub(crate) col_weighted: bool, } @@ -205,7 +205,7 @@ pub(crate) fn coltype_to_ftype(col_type: &ColType) -> FType { } } -pub(crate) fn mi_args_from_dict(dict: &PyDict) -> PyResult { +pub(crate) fn mi_args_from_dict(dict: &Bound) -> PyResult { let n_mc_samples: Option = dict .get_item("n_mc_samples")? .map(|any| any.extract::()) @@ -222,13 +222,15 @@ pub(crate) fn mi_args_from_dict(dict: &PyDict) -> PyResult { }) } -pub(crate) fn rowsim_args_from_dict(dict: &PyDict) -> PyResult { +pub(crate) fn rowsim_args_from_dict<'a>( + dict: &'a Bound<'a, PyDict>, +) -> PyResult> { let col_weighted: Option = dict .get_item("col_weighted")? .map(|any| any.extract::()) .transpose()?; - let wrt: Option<&PyAny> = dict.get_item("wrt")?; + let wrt: Option> = dict.get_item("wrt")?; Ok(RowsimArgs { wrt, @@ -427,7 +429,7 @@ impl Indexer { } pub(crate) fn pairs_list_iter<'a>( - pairs: &'a PyList, + pairs: &'a Bound<'a, PyList>, indexer: &'a Indexer, ) -> impl Iterator> + 'a { pairs.iter().map(|item| { @@ -438,28 +440,36 @@ pub(crate) fn pairs_list_iter<'a>( "A pair consists of two items", )) } else { - value_to_index(&ixs[0], indexer).and_then(|a| { - value_to_index(&ixs[1], indexer).map(|b| (a, b)) - }) + ixs.get_item(0) + .and_then(|a| value_to_index(&a, indexer)) + .and_then(|a| { + ixs.get_item(1) + .and_then(|b| value_to_index(&b, indexer)) + .map(|b| (a, b)) + }) } }) .unwrap_or_else(|_| { - let ixs: &PyTuple = item.downcast()?; + let ixs: &Bound = item.downcast()?; if ixs.len() != 2 { Err(PyErr::new::( "A pair consists of two items", )) } else { - value_to_index(&ixs[0], indexer).and_then(|a| { - value_to_index(&ixs[1], indexer).map(|b| (a, b)) - }) + ixs.get_item(0) + .and_then(|a| value_to_index(&a, indexer)) + .and_then(|a| { + ixs.get_item(1) + .and_then(|b| value_to_index(&b, indexer)) + .map(|b| (a, b)) + }) } }) }) } pub(crate) fn list_to_pairs<'a>( - pairs: &'a PyList, + pairs: &'a Bound, indexer: &'a Indexer, ) -> PyResult> { pairs_list_iter(pairs, indexer).collect() @@ -501,11 +511,12 @@ pub(crate) fn datum_to_value(datum: Datum) -> PyResult> { }) } -fn pyany_to_category(val: &PyAny) -> PyResult { +fn pyany_to_category(val: &Bound) -> PyResult { use lace::Category; - let name = val.get_type().name()?; + let ty = val.get_type(); + let name = ty.name()?; - match name { + match name.as_ref() { "int" => { let x = val.downcast::()?.extract::()?; Ok(Category::U8(x)) @@ -518,7 +529,7 @@ fn pyany_to_category(val: &PyAny) -> PyResult { let x = val.downcast::()?.extract::()?; Ok(Category::String(x)) } - "int64" | "int32" | "int16" | "int8" => { + "numpy.int64" | "numpy.int32" | "numpy.int16" | "numpy.int8" => { let x = val.call_method("__int__", (), None)?.extract::()?; Ok(Category::U8(x)) } @@ -528,7 +539,10 @@ fn pyany_to_category(val: &PyAny) -> PyResult { } } -pub(crate) fn value_to_datum(val: &PyAny, ftype: FType) -> PyResult { +pub(crate) fn value_to_datum( + val: &Bound, + ftype: FType, +) -> PyResult { if val.is_none() { return Ok(Datum::Missing); } @@ -558,7 +572,7 @@ pub(crate) fn value_to_datum(val: &PyAny, ftype: FType) -> PyResult { } pub(crate) fn value_to_name( - val: &PyAny, + val: &Bound, indexer: &Indexer, ) -> PyResult { val.extract::().or_else(|_| { @@ -572,7 +586,7 @@ pub(crate) fn value_to_name( } pub(crate) fn value_to_index( - val: &PyAny, + val: &Bound, indexer: &Indexer, ) -> PyResult { val.extract::().or_else(|_| { @@ -588,16 +602,16 @@ pub(crate) fn value_to_index( } pub(crate) fn pyany_to_indices( - cols: &PyAny, + cols: &Bound, indexer: &Indexer, ) -> PyResult> { cols.iter()? - .map(|res| res.and_then(|val| value_to_index(val, indexer))) + .map(|res| res.and_then(|val| value_to_index(&val, indexer))) .collect() } pub(crate) fn dict_to_given( - dict_opt: Option<&PyDict>, + dict_opt: Option<&Bound>, engine: &lace::Engine, indexer: &Indexer, ) -> PyResult> { @@ -608,9 +622,9 @@ pub(crate) fn dict_to_given( let conditions = dict .iter() .map(|(key, value)| { - value_to_index(key, indexer).and_then(|ix| { + value_to_index(&key, indexer).and_then(|ix| { value_to_datum( - value, + &value, engine.ftype(ix).expect( "Index from indexer ought to be valid.", ), @@ -625,7 +639,7 @@ pub(crate) fn dict_to_given( } } -pub(crate) fn srs_to_strings(srs: &PyAny) -> PyResult> { +pub(crate) fn srs_to_strings(srs: &Bound) -> PyResult> { let list: &PyList = srs.call_method0("to_list")?.extract()?; list.iter() @@ -661,23 +675,23 @@ pub(crate) fn parts_to_insert_values( } pub(crate) fn pyany_to_data( - data: &PyAny, + data: &Bound, ftype: FType, ) -> PyResult> { data.iter()? - .map(|res| res.and_then(|val| value_to_datum(val, ftype))) + .map(|res| res.and_then(|val| value_to_datum(&val, ftype))) .collect() } fn process_row_dict( - row_dict: &PyDict, + row_dict: &Bound, _col_indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, ) -> PyResult> { let mut row_data: Vec = Vec::with_capacity(row_dict.len()); for (name_any, value_any) in row_dict { - let col_name: &PyString = name_any.downcast()?; + let col_name: &Bound = name_any.downcast()?; let col_name = col_name.to_str()?; let ftype = engine .codebook @@ -692,21 +706,21 @@ fn process_row_dict( ))) })?; - row_data.push(value_to_datum(value_any, ftype)?); + row_data.push(value_to_datum(&value_any, ftype)?); } Ok(row_data) } // Works on list of dicts fn values_to_data( - data: &PyList, + data: &Bound, col_indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, ) -> PyResult>> { data.iter() .map(|row_any| { - let row_dict: &PyDict = row_any.downcast()?; + let row_dict: &Bound = row_any.downcast()?; process_row_dict(row_dict, col_indexer, engine, suppl_types) }) .collect() @@ -723,7 +737,7 @@ pub(crate) struct DataFrameComponents { // FIXME: pass the 'py' in so that we can handle errors better. The // `Python::with_gil` thing makes using `?` a pain. fn df_to_values( - df: &PyAny, + df: &Bound, col_indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, @@ -734,12 +748,12 @@ fn df_to_values( if columns.get_type().name()?.contains("Index") { // Is a Pandas dataframe let index = df.getattr("index")?; - let row_names = srs_to_strings(index).ok(); + let row_names = srs_to_strings(&index).ok(); let cols = columns.call_method0("tolist")?.to_object(py); - let kwargs = PyDict::new(py); + let kwargs = PyDict::new_bound(py); kwargs.set_item("orient", "records")?; - let data = df.call_method("to_dict", (), Some(kwargs))?; + let data = df.call_method("to_dict", (), Some(&kwargs))?; (cols, data, row_names) } else { // Is a Polars dataframe @@ -749,11 +763,11 @@ fn df_to_values( // Find all the index columns let mut index_col_names = list .iter() - .map(|s| s.extract::<&str>()) + .map(|s| s.extract::()) .map(|s| { s.map(|s| { - if is_index_col(s) { - Some(String::from(s)) + if is_index_col(&s) { + Some(s) } else { None } @@ -784,7 +798,7 @@ fn df_to_values( // Get the indices from the index if it exists let row_names = df.get_item(index_name) - .and_then(srs_to_strings) + .and_then(|srs: pyo3::Bound<'_, pyo3::PyAny>| srs_to_strings(&srs)) .map_err(|err| { PyValueError::new_err(format!( "Indices in index '{index_name}' are not strings: {err}")) @@ -794,7 +808,7 @@ fn df_to_values( (df, Some(row_names)) } else { - (df, None) + (df.clone(), None) }; let data = df.call_method0("to_dicts")?; @@ -802,19 +816,19 @@ fn df_to_values( } }; - let data: &PyList = data.extract()?; - let columns: &PyList = columns.extract(py)?; + let data: Bound = data.extract()?; + let columns: Bound = columns.extract(py)?; // will return nothing if there are unknown column names let col_ixs = columns .iter() - .map(|col_name| value_to_index(col_name, col_indexer)) + .map(|col_name| value_to_index(&col_name, col_indexer)) .collect::, _>>() .ok(); let col_names = columns .iter() .map(|name| name.extract()) .collect::, _>>()?; - let values = values_to_data(data, col_indexer, engine, suppl_types)?; + let values = values_to_data(&data, col_indexer, engine, suppl_types)?; Ok(DataFrameComponents { col_ixs, @@ -826,35 +840,36 @@ fn df_to_values( } fn srs_to_column_values( - srs: &PyAny, + srs: &Bound, indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, ) -> PyResult { let data = srs.call_method0("to_frame")?; - df_to_values(data, indexer, engine, suppl_types) + df_to_values(&data, indexer, engine, suppl_types) } fn srs_to_row_values( - srs: &PyAny, + srs: &Bound, indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, ) -> PyResult { let data = srs.call_method0("to_frame")?.call_method0("transpose")?; - df_to_values(data, indexer, engine, suppl_types) + df_to_values(&data, indexer, engine, suppl_types) } pub(crate) fn pandas_to_logp_values( - xs: &PyAny, + xs: &Bound, indexer: &Indexer, engine: &lace::Engine, ) -> PyResult { - let type_name = xs.get_type().name()?; + let ty = xs.get_type(); + let type_name = ty.name()?; - match type_name { + match type_name.as_ref() { "DataFrame" => df_to_values(xs, indexer, engine, None), "Series" => srs_to_column_values(xs, indexer, engine, None), t => Err(PyErr::new::(format!( @@ -864,14 +879,15 @@ pub(crate) fn pandas_to_logp_values( } pub(crate) fn pandas_to_insert_values( - xs: &PyAny, + xs: &Bound, col_indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, ) -> PyResult { - let type_name = xs.get_type().name()?; + let ty = xs.get_type(); + let type_name = ty.name()?; - match type_name { + match type_name.as_ref() { "DataFrame" => df_to_values(xs, col_indexer, engine, suppl_types), "Series" => srs_to_row_values(xs, col_indexer, engine, suppl_types), t => Err(PyErr::new::(format!( From 5b56e655510c5e718ab299b934fcab9ce70d1ed1 Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Wed, 1 May 2024 19:00:50 -0600 Subject: [PATCH 6/6] chore: Updated changelog and citation --- .github/workflows/changelog.yaml | 2 +- CHANGELOG.md | 7 +++++-- CITATION.cff | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/changelog.yaml b/.github/workflows/changelog.yaml index e4ad53b7..7ed08df9 100644 --- a/.github/workflows/changelog.yaml +++ b/.github/workflows/changelog.yaml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - + - run: | eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" brew install nbbrd/tap/heylogs diff --git a/CHANGELOG.md b/CHANGELOG.md index 90cef260..e35455b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,15 +20,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Changed `SerializedType` default to `Bincode` - moved `Assignment` from `lace_cc` to `lace_stats` -## [python-0.8.0] 2024-04-10 +## [python-0.8.0] - 2024-04-10 ### Added -- Added ability Pitman-Yor prior process +- Added ability Pitman-Yor prior process. +- Added `remove_rows` to `Engine`. +- Added `with_index` to `CodeBook`. ### Changed - `StateAlpha` and `ViewAlpha` transitions are now `StatePriorProcessParams` and `ViewPriorProcessParams` +- Updated Pyo3 version to 0.21 ## [python-0.7.1] - 2024-02-27 diff --git a/CITATION.cff b/CITATION.cff index 153a78d9..50abe654 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -34,5 +34,5 @@ keywords: - Bayesian - Machine Learning license: BUSL-1.1 -version: 0.7.0 +version: 0.8.0 date-released: '2024-02-07'