From eb94631ccd12544143c64809157497e8e29622fc Mon Sep 17 00:00:00 2001 From: Baxter Eaves Date: Thu, 31 Aug 2023 11:54:03 -0500 Subject: [PATCH 01/18] Expose component parameters in pylace --- pylace/Cargo.lock | 10 +-- pylace/lace/engine.py | 57 +++++++++++++++++ pylace/src/component.rs | 131 ++++++++++++++++++++++++++++++++++++++++ pylace/src/lib.rs | 39 ++++++++++++ 4 files changed, 232 insertions(+), 5 deletions(-) create mode 100644 pylace/src/component.rs diff --git a/pylace/Cargo.lock b/pylace/Cargo.lock index d3aa7575..4262d9c5 100644 --- a/pylace/Cargo.lock +++ b/pylace/Cargo.lock @@ -962,7 +962,7 @@ dependencies = [ [[package]] name = "lace" -version = "0.3.0" +version = "0.3.1" dependencies = [ "bincode", "clap", @@ -1000,7 +1000,7 @@ dependencies = [ [[package]] name = "lace_cc" -version = "0.1.4" +version = "0.1.5" dependencies = [ "enum_dispatch", "indicatif", @@ -1022,7 +1022,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.4" +version = "0.1.5" dependencies = [ "flate2", "lace_consts", @@ -1069,7 +1069,7 @@ dependencies = [ [[package]] name = "lace_metadata" -version = "0.1.4" +version = "0.1.5" dependencies = [ "bincode", "dirs", @@ -1931,7 +1931,7 @@ checksum = "fe7765e19fb2ba6fd4373b8d90399f5321683ea7c11b598c6bbaa3a72e9c83b8" [[package]] name = "pylace" -version = "0.3.0" +version = "0.3.1" dependencies = [ "arrow2", "lace", diff --git a/pylace/lace/engine.py b/pylace/lace/engine.py index 12c46563..18dfdfa6 100644 --- a/pylace/lace/engine.py +++ b/pylace/lace/engine.py @@ -445,6 +445,63 @@ def row_assignments(self, state_ix: int): """ return self.engine.row_assignments(state_ix) + def feature_params( + self, + col: Union[int, str], + state_ixs: Optional[List[int]]=None + ) -> Dict: + """Get the component parameters for a given column + + Parameters + ---------- + col: int or str + The index or name of the column from which to retrieve parameters + state_ixs: List[int], optional + And optional list of state indices from which to return parameters + + Returns + ------- + params: Dict[List] + `params[state_ix][component_ix]` is the component parameters for the + given component in the given state + + Examples + -------- + + Get Gaussian component parameters from the Satellites dataset + + >>> from lace.examples import Satellites + >>> sats = Satellites() + >>> gauss_params = sats.feature_params("Period_minutes") + >>> g = gauss_params[1][0] + >>> g + Gaussian(mu=97.38792034245135, sigma=8.864698646528195) + >>> g.mu + 97.38792034245135 + + Get categorical weights from the Satellites dataset + + >>> cat_params = sats.feature_params("Class_of_Orbit", state_ixs=[2]) + >>> c = cat_params[2][0] + >>> c + Categorical_4(weights=[0.7196355242414928, ..., 0.12915471912497747]) + >>> c.weights # doctest: +ELLIPSIS + [0.7196355242414928, ..., 0.12915471912497747] + + You can also select columns by integer index + + >>> sats.columns[3] + 'Class_of_Orbit' + >>> params = sats.feature_params(3) + >>> params[0][1] + Categorical_4(weights=[0.0016550494108113051, ..., 0.000028906241993218738]) + """ + if state_ixs is None: + state_ixs = list(range(self.n_states)) + + return { state_ix: self.engine.feature_params(col, state_ix) + for state_ix in state_ixs } + def __getitem__(self, ix): df = self.engine[ix] if df.shape[0] == 1 and df.shape[1] == 2: diff --git a/pylace/src/component.rs b/pylace/src/component.rs new file mode 100644 index 00000000..dde2b944 --- /dev/null +++ b/pylace/src/component.rs @@ -0,0 +1,131 @@ +use lace::stats::rv::dist::{Bernoulli, Categorical, Gaussian, Poisson}; +use lace::stats::MixtureType; +use pyo3::prelude::*; + +impl From for ComponentParams { + fn from(mixture: MixtureType) -> Self { + match mixture { + MixtureType::Bernoulli(mm) => mm.components().as_slice().into(), + MixtureType::Categorical(mm) => mm.components().as_slice().into(), + MixtureType::Gaussian(mm) => mm.components().as_slice().into(), + MixtureType::Poisson(mm) => mm.components().as_slice().into(), + } + } +} + +pub enum ComponentParams { + Bernoulli(Vec), + Categorical(Vec), + Gaussian(Vec), + Poisson(Vec), +} + +#[pyclass(get_all)] +pub struct BernoulliParams { + pub p: f64, +} + +#[pymethods] +impl BernoulliParams { + pub fn __repr__(&self) -> String { + format!("Bernoulli(p={})", self.p) + } +} + +#[pyclass(get_all)] +pub struct GaussianParams { + pub mu: f64, + pub sigma: f64, +} + +#[pymethods] +impl GaussianParams { + pub fn __repr__(&self) -> String { + format!("Gaussian(mu={}, sigma={})", self.mu, self.sigma) + } +} + +#[pyclass(get_all)] +pub struct PoissonParams { + pub rate: f64, +} + +#[pymethods] +impl PoissonParams { + pub fn __repr__(&self) -> String { + format!("Poisson(rate={})", self.rate) + } +} + +#[pyclass(get_all)] +pub struct CategoricalParams { + pub weights: Vec, +} + +#[pymethods] +impl CategoricalParams { + pub fn __repr__(&self) -> String { + let k = self.weights.len(); + let weights_str = match k { + 0 => "[]".to_string(), + 1 => "[1.0]".to_string(), + 2 => format!("[{}, {}]", self.weights[0], self.weights[1]), + _ => format!( + "[{}, ..., {}]", + self.weights[0], + self.weights.last().unwrap() + ), + }; + + format!( + "Categorical_{}(weights={})", + self.weights.len(), + weights_str + ) + } +} + +impl From<&Bernoulli> for BernoulliParams { + fn from(dist: &Bernoulli) -> Self { + BernoulliParams { p: dist.p() } + } +} + +impl From<&Categorical> for CategoricalParams { + fn from(dist: &Categorical) -> Self { + CategoricalParams { + weights: dist.weights(), + } + } +} + +impl From<&Gaussian> for GaussianParams { + fn from(dist: &Gaussian) -> Self { + GaussianParams { + mu: dist.mu(), + sigma: dist.sigma(), + } + } +} + +impl From<&Poisson> for PoissonParams { + fn from(dist: &Poisson) -> Self { + PoissonParams { rate: dist.rate() } + } +} + +macro_rules! impl_from_slice_dist { + ($variant: ident) => { + impl From<&[$variant]> for ComponentParams { + fn from(dists: &[$variant]) -> Self { + let inner = dists.iter().map(|dist| dist.into()).collect(); + ComponentParams::$variant(inner) + } + } + }; +} + +impl_from_slice_dist!(Bernoulli); +impl_from_slice_dist!(Gaussian); +impl_from_slice_dist!(Categorical); +impl_from_slice_dist!(Poisson); diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index f9460720..07fb8521 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -1,3 +1,4 @@ +mod component; mod df; mod metadata; mod transition; @@ -273,6 +274,43 @@ impl CoreEngine { } } + fn feature_params<'p>( + &self, + py: Python<'p>, + col: &PyAny, + state_ix: usize, + ) -> PyResult<&'p PyAny> { + use component::ComponentParams; + + let col_ix = utils::value_to_index(col, &self.col_indexer)?; + + let n_states = self.engine.n_states(); + if state_ix >= n_states { + return Err(PyIndexError::new_err(format!( + "State index {state_ix} is out of bounds for Engine with \ + {n_states} states" + ))); + } + + 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)) + } + ComponentParams::Categorical(params) => { + Ok(params.into_py(py).into_ref(py)) + } + ComponentParams::Gaussian(params) => { + Ok(params.into_py(py).into_ref(py)) + } + ComponentParams::Poisson(params) => { + Ok(params.into_py(py).into_ref(py)) + } + } + + // Ok(component::FeatureParams::from(mixture)) + } + fn diagnostics(&self) -> Vec>> { (0..self.n_states()) .map(|ix| { @@ -1282,6 +1320,7 @@ fn core(_py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?; + m.add_class::()?; m.add_function(wrap_pyfunction!(infer_srs_metadata, m)?)?; m.add_function(wrap_pyfunction!(metadata::codebook_from_df, m)?)?; Ok(()) From 4293125a8eb513439c49ab04e07cf29c1f660232 Mon Sep 17 00:00:00 2001 From: Baxter Eaves Date: Thu, 31 Aug 2023 12:24:48 -0500 Subject: [PATCH 02/18] run black --- pylace/lace/engine.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pylace/lace/engine.py b/pylace/lace/engine.py index 18dfdfa6..eab3e966 100644 --- a/pylace/lace/engine.py +++ b/pylace/lace/engine.py @@ -446,9 +446,7 @@ def row_assignments(self, state_ix: int): return self.engine.row_assignments(state_ix) def feature_params( - self, - col: Union[int, str], - state_ixs: Optional[List[int]]=None + self, col: Union[int, str], state_ixs: Optional[List[int]] = None ) -> Dict: """Get the component parameters for a given column @@ -489,7 +487,7 @@ def feature_params( [0.7196355242414928, ..., 0.12915471912497747] You can also select columns by integer index - + >>> sats.columns[3] 'Class_of_Orbit' >>> params = sats.feature_params(3) @@ -499,8 +497,10 @@ def feature_params( if state_ixs is None: state_ixs = list(range(self.n_states)) - return { state_ix: self.engine.feature_params(col, state_ix) - for state_ix in state_ixs } + return { + state_ix: self.engine.feature_params(col, state_ix) + for state_ix in state_ixs + } def __getitem__(self, ix): df = self.engine[ix] From 04387784d0a0345f7e067ddfdca6c680f350a40e Mon Sep 17 00:00:00 2001 From: Baxter Eaves Date: Thu, 31 Aug 2023 12:28:45 -0500 Subject: [PATCH 03/18] run ruff.. --- pylace/lace/engine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pylace/lace/engine.py b/pylace/lace/engine.py index eab3e966..0d94eb74 100644 --- a/pylace/lace/engine.py +++ b/pylace/lace/engine.py @@ -448,7 +448,8 @@ def row_assignments(self, state_ix: int): def feature_params( self, col: Union[int, str], state_ixs: Optional[List[int]] = None ) -> Dict: - """Get the component parameters for a given column + """ + Get the component parameters for a given column. Parameters ---------- @@ -465,7 +466,6 @@ def feature_params( Examples -------- - Get Gaussian component parameters from the Satellites dataset >>> from lace.examples import Satellites From f624be5360a505a5d114df11fb54db82d6e19a83 Mon Sep 17 00:00:00 2001 From: Baxter Eaves Date: Thu, 31 Aug 2023 15:52:33 -0500 Subject: [PATCH 04/18] Remove some commented code --- pylace/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index 07fb8521..bfbbead1 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -307,8 +307,6 @@ impl CoreEngine { Ok(params.into_py(py).into_ref(py)) } } - - // Ok(component::FeatureParams::from(mixture)) } fn diagnostics(&self) -> Vec>> { From eeb8cd1c5e98b7316904a95d840f42d16c3f434a Mon Sep 17 00:00:00 2001 From: Baxter Eaves Date: Tue, 5 Sep 2023 08:59:18 -0500 Subject: [PATCH 05/18] remove extra pyo3 export --- pylace/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index bfbbead1..481c1a62 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -1318,7 +1318,6 @@ fn core(_py: Python, m: &PyModule) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?; - m.add_class::()?; m.add_function(wrap_pyfunction!(infer_srs_metadata, m)?)?; m.add_function(wrap_pyfunction!(metadata::codebook_from_df, m)?)?; Ok(()) From e229c23125bd939b8d52c5d754280a49f5cd35de Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Fri, 1 Sep 2023 18:49:30 -0500 Subject: [PATCH 06/18] Simple helper script to find a python wheel compatible with a python runtime --- .github/scripts/find_compatible_wheel.py | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/scripts/find_compatible_wheel.py diff --git a/.github/scripts/find_compatible_wheel.py b/.github/scripts/find_compatible_wheel.py new file mode 100644 index 00000000..64ba58be --- /dev/null +++ b/.github/scripts/find_compatible_wheel.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import argparse +from packaging.tags import sys_tags +import os.path +import glob +import sys + +parser = argparse.ArgumentParser( + 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("dir", help="the directory under which to search for the wheels") + +args=parser.parse_args() + +wheel=None + +for tag in sys_tags(): + matches=glob.glob(args.package + "*" + str(tag) + ".whl", root_dir=args.dir) + if len(matches) == 1: + wheel=matches[0] + break + elif len(matches) > 1: + print("Found multiple matches for the same tag " + str(tag), matches, file=sys.stderr) + +if wheel: + print(os.path.join(args.dir, wheel)) +else: + sys.exit("Did not find compatible wheel") From 503787fb67f102bcca4317163fa7ac0557fb4b51 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Fri, 1 Sep 2023 18:56:12 -0500 Subject: [PATCH 07/18] Changed python tests to find a specific local wheel file and install it directly We were having trouble being sure that `pip` would install a local wheel file over downloading a wheel from PyPi and using it instead These changes should help force us to install the exact wheel we created --- .github/workflows/python-build-test.yaml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-build-test.yaml b/.github/workflows/python-build-test.yaml index b7dbcf11..a9064f67 100644 --- a/.github/workflows/python-build-test.yaml +++ b/.github/workflows/python-build-test.yaml @@ -113,7 +113,10 @@ jobs: pip install -r pylace/requirements-dev.txt - name: Install pylace - run: pip install --find-links dist pylace + run: | + WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) + echo "Installing $WHEEL_FILE" + pip install $WHEEL_FILE - name: Run Tests run: pytest pylace/tests @@ -152,7 +155,10 @@ jobs: pip install -r pylace/requirements-dev.txt - name: Install pylace - run: pip install --find-links dist pylace + run: | + WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) + echo "Installing $WHEEL_FILE" + pip install $WHEEL_FILE - name: Run Tests run: pytest pylace/tests @@ -192,7 +198,10 @@ jobs: - name: Install pylace if: ${{ matrix.target != 'aarch64' }} - run: pip install --find-links dist pylace + 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' }} @@ -224,10 +233,10 @@ jobs: run: npm install -g codedown - name: Install Wheel - # Install using the direct file name to prevent downloading from PyPi - # My tests indicate that using --find-links still grabs `pylace` from PyPi - # unless the version is higher than what is published on PyPi - run: pip install dist/pylace-*-cp311-cp311-manylinux_*_x86_64.manylinux*_x86_64.whl + run: | + WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) + echo "Installing $WHEEL_FILE" + pip install $WHEEL_FILE - name: Test MDBook Code Samples (Python) env: From db5a899d1f981bc8f0fd30f2601d9349702d6ab6 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Fri, 1 Sep 2023 21:15:20 -0500 Subject: [PATCH 08/18] Added debugging statements --- .github/scripts/find_compatible_wheel.py | 1 + .github/workflows/python-build-test.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/scripts/find_compatible_wheel.py b/.github/scripts/find_compatible_wheel.py index 64ba58be..2f3701d4 100644 --- a/.github/scripts/find_compatible_wheel.py +++ b/.github/scripts/find_compatible_wheel.py @@ -18,6 +18,7 @@ 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) if len(matches) == 1: wheel=matches[0] diff --git a/.github/workflows/python-build-test.yaml b/.github/workflows/python-build-test.yaml index a9064f67..2b30c361 100644 --- a/.github/workflows/python-build-test.yaml +++ b/.github/workflows/python-build-test.yaml @@ -114,6 +114,7 @@ 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 @@ -156,6 +157,7 @@ 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 From d2fec5b6b64c9ca116a13ee52add0c237fa4d3dd Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Fri, 1 Sep 2023 21:47:55 -0500 Subject: [PATCH 09/18] Make sure to notice when the new script runs --- .github/workflows/python-build-test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-build-test.yaml b/.github/workflows/python-build-test.yaml index 2b30c361..8b0020d4 100644 --- a/.github/workflows/python-build-test.yaml +++ b/.github/workflows/python-build-test.yaml @@ -15,6 +15,7 @@ on: - 'book/**' - '.github/workflows/python-build-test.yaml' - '.github/scripts/run_code_in_mdfile.py' + - '.github/scripts/find_compatible_wheel.py' jobs: lint-python: From b1365a3ee93b58421c4fe8192974ae5355303833 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Fri, 1 Sep 2023 21:48:43 -0500 Subject: [PATCH 10/18] Some wheel filenames have more parts to the filename that I wasn't accounting for in my glob --- .github/scripts/find_compatible_wheel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/find_compatible_wheel.py b/.github/scripts/find_compatible_wheel.py index 2f3701d4..af3a9a34 100644 --- a/.github/scripts/find_compatible_wheel.py +++ b/.github/scripts/find_compatible_wheel.py @@ -19,7 +19,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(args.package + "*" + str(tag) + "*.whl", root_dir=args.dir) if len(matches) == 1: wheel=matches[0] break From ebf84f30b1fcefd3d8757f9c68b78bbfbe817e4c Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Sat, 2 Sep 2023 23:05:38 -0500 Subject: [PATCH 11/18] Fixes for parts of the workflow `pip nstall packaging` during the MDBook stage This is installed by default in all the other stages because they are building a package Change to use Powershell format on the windows runner --- .github/workflows/python-build-test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python-build-test.yaml b/.github/workflows/python-build-test.yaml index 8b0020d4..991dbd24 100644 --- a/.github/workflows/python-build-test.yaml +++ b/.github/workflows/python-build-test.yaml @@ -159,7 +159,7 @@ jobs: - name: Install pylace run: | ls -l ./dist - WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) + $WHEEL_FILE = (python3 .github/scripts/find_compatible_wheel.py pylace ./dist) echo "Installing $WHEEL_FILE" pip install $WHEEL_FILE @@ -237,6 +237,7 @@ jobs: - name: Install Wheel run: | + pip install packaging WHEEL_FILE=$(python3 .github/scripts/find_compatible_wheel.py pylace ./dist) echo "Installing $WHEEL_FILE" pip install $WHEEL_FILE From f09f6572ac759793bb65356c501ea7317d6d8a45 Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Fri, 1 Sep 2023 09:55:58 -0600 Subject: [PATCH 12/18] feat(python): Made Engine copyable via __deepcopy__. --- CHANGELOG.md | 4 ++++ pylace/src/lib.rs | 6 ++++++ pylace/src/utils.rs | 1 + pylace/tests/test_engine.py | 13 +++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 pylace/tests/test_engine.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 311fac4e..6dd85a8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + - Pylace's Engine now implements deepcopy. + + ## [python-0.3.1] - 2023-08-28 ### Fixed diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index f9460720..4634fd88 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -25,6 +25,7 @@ use metadata::{Codebook, CodebookBuilder}; use crate::utils::*; +#[derive(Clone)] #[pyclass(subclass)] struct CoreEngine { engine: lace::Engine, @@ -139,6 +140,11 @@ impl CoreEngine { self.rng = Xoshiro256Plus::seed_from_u64(rng_seed); } + /// Return a copy of the engine + fn __deepcopy__(&self, _memo: &PyDict) -> Self { + self.clone() + } + /// Return the number of states #[getter] fn n_states(&self) -> usize { diff --git a/pylace/src/utils.rs b/pylace/src/utils.rs index 3a379510..9f0171e0 100644 --- a/pylace/src/utils.rs +++ b/pylace/src/utils.rs @@ -387,6 +387,7 @@ pub(crate) fn str_to_mitype(mi_type: &str) -> PyResult { } } +#[derive(Clone, PartialEq, Eq)] pub(crate) struct Indexer { pub to_ix: HashMap, pub to_name: HashMap, diff --git a/pylace/tests/test_engine.py b/pylace/tests/test_engine.py new file mode 100644 index 00000000..55d17119 --- /dev/null +++ b/pylace/tests/test_engine.py @@ -0,0 +1,13 @@ +from copy import deepcopy + +from lace import examples + + +def test_deep_copy(): + a = examples.Animals() + b = deepcopy(a) + + assert a is not b + + assert a.columns == b.columns + assert a.shape == b.shape From 35c3e439b31a7781e26010aecd2125c3b8e9687c Mon Sep 17 00:00:00 2001 From: Mike Schmidt Date: Fri, 1 Sep 2023 08:52:07 -0600 Subject: [PATCH 13/18] fix: Fixed a few pylace bugs - Fixed pylace's `__getitem__` index name to match other accessors. - Fixed pylace's `append_column_metadata` to refer to the correct internal function. - Pylace will try to use Python's internal conversion for floats in `value_to_datum` conversion. --- CHANGELOG.md | 7 +++++++ pylace/Cargo.lock | 10 +++++----- pylace/lace/codebook.py | 2 +- pylace/src/lib.rs | 3 ++- pylace/src/utils.rs | 11 +---------- pylace/tests/test_index_names.py | 26 ++++++++++++++++++++++++++ 6 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 pylace/tests/test_index_names.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 311fac4e..a988eaab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fixed pylace's `__getitem__` index name to match other accessors. +- Fixed pylace's `append_column_metadata` to refer to the correct internal function. +- Pylace will try to use Python's internal conversion for floats in `value_to_datum` conversion. + + ## [python-0.3.1] - 2023-08-28 ### Fixed diff --git a/pylace/Cargo.lock b/pylace/Cargo.lock index d3aa7575..4262d9c5 100644 --- a/pylace/Cargo.lock +++ b/pylace/Cargo.lock @@ -962,7 +962,7 @@ dependencies = [ [[package]] name = "lace" -version = "0.3.0" +version = "0.3.1" dependencies = [ "bincode", "clap", @@ -1000,7 +1000,7 @@ dependencies = [ [[package]] name = "lace_cc" -version = "0.1.4" +version = "0.1.5" dependencies = [ "enum_dispatch", "indicatif", @@ -1022,7 +1022,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.4" +version = "0.1.5" dependencies = [ "flate2", "lace_consts", @@ -1069,7 +1069,7 @@ dependencies = [ [[package]] name = "lace_metadata" -version = "0.1.4" +version = "0.1.5" dependencies = [ "bincode", "dirs", @@ -1931,7 +1931,7 @@ checksum = "fe7765e19fb2ba6fd4373b8d90399f5321683ea7c11b598c6bbaa3a72e9c83b8" [[package]] name = "pylace" -version = "0.3.0" +version = "0.3.1" dependencies = [ "arrow2", "lace", diff --git a/pylace/lace/codebook.py b/pylace/lace/codebook.py index 5d3c2223..cf73ef39 100644 --- a/pylace/lace/codebook.py +++ b/pylace/lace/codebook.py @@ -360,7 +360,7 @@ def set_view_alpha_prior(self, shape: float = 1.0, rate: float = 1.0): def append_column_metadata(self, col_metadata: List[_lc.ColumnMetadata]): """Append new columns to the codebook.""" codebook = copy.copy(self) - codebook.codebook.append_col_metadata(col_metadata) + codebook.codebook.append_column_metadata(col_metadata) return codebook def set_row_names( diff --git a/pylace/src/lib.rs b/pylace/src/lib.rs index f9460720..82ab4123 100644 --- a/pylace/src/lib.rs +++ b/pylace/src/lib.rs @@ -187,7 +187,7 @@ impl CoreEngine { let (row_ixs, col_ixs) = ixs.ixs(&self.engine.codebook)?; let index = polars::series::Series::new( - "Index", + "index", row_ixs .iter() .map(|ix| ix.1.clone()) @@ -1104,6 +1104,7 @@ impl CoreEngine { let write_mode = lace::WriteMode { overwrite: lace::OverwriteMode::Deny, insert: lace::InsertMode::DenyNewColumns, + allow_extend_support: true, ..Default::default() }; self.engine diff --git a/pylace/src/utils.rs b/pylace/src/utils.rs index 3a379510..371cc88f 100644 --- a/pylace/src/utils.rs +++ b/pylace/src/utils.rs @@ -289,9 +289,6 @@ pub(crate) fn vec_to_srs( } } FType::Count => Ok(srs_from_vec!(values, name, u32, Count)), - // ftype => Err(PyErr::new::(format!( - // "Simulated unsupported ftype: {ftype:?}" - // ))), } .map(PySeries) } @@ -358,9 +355,6 @@ pub(crate) fn simulate_to_df( } } FType::Count => Ok(srs_from_simulate!(values, i, name, u32, Count)), - // ftype => Err(PyErr::new::(format!( - // "Simulated unsupported ftype: {ftype:?}" - // ))), }?; df.with_column(srs).map_err(|err| { PyErr::new::(format!( @@ -537,10 +531,7 @@ pub(crate) fn value_to_datum(val: &PyAny, ftype: FType) -> PyResult { match ftype { FType::Continuous => { - let x: f64 = { - let f: &PyFloat = val.downcast().unwrap(); - f.value() - }; + let x: f64 = val.extract().unwrap(); if x.is_nan() { Ok(Datum::Missing) } else { diff --git a/pylace/tests/test_index_names.py b/pylace/tests/test_index_names.py new file mode 100644 index 00000000..7bfded25 --- /dev/null +++ b/pylace/tests/test_index_names.py @@ -0,0 +1,26 @@ +import pytest + +from lace.examples import Animals + + +@pytest.fixture(scope="module") +def animals(): + animals = Animals() + animals.df = animals.df.to_pandas().set_index("id") + return animals + + +def test_impute_index_name(animals): + """Check impute returns the correct index name.""" + engine = animals.engine + + predicted = engine.impute(0, rows=engine.index) + assert "index" in predicted.columns + + +def test_getitem_index_name(animals): + """Check __getitem__ returns the correct index name.""" + engine = animals.engine + + df = engine["fierce"] + assert "index" in df.columns From bd58ff9c1f8bcc3f5a618569f3429567a2095761 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Tue, 19 Sep 2023 17:29:49 -0500 Subject: [PATCH 14/18] Updated `polars` rust version to `0.33` Updated `polars` to `0.33` This is to avoid triggering the need for `cmake` when building `polars`, which can still happen if `--locked` is not used Updated `arrow2` version to match the version now used in `polars` Updated `chrono` version in `Cargo.lock`s to allow the updated `arrow2` to compile --- .github/scripts/run_code_in_mdfile.py | 2 +- book/lace_preprocess_mdbook_yaml/Cargo.lock | 128 ++++++++------ lace/Cargo.lock | 174 +++++++------------- lace/Cargo.toml | 2 +- lace/lace_codebook/Cargo.toml | 2 +- pylace/Cargo.lock | 174 +++++++------------- pylace/Cargo.toml | 4 +- pylace/src/df.rs | 4 + pylace/src/utils.rs | 2 +- 9 files changed, 196 insertions(+), 296 deletions(-) diff --git a/.github/scripts/run_code_in_mdfile.py b/.github/scripts/run_code_in_mdfile.py index a7ea3053..eb04d8f8 100644 --- a/.github/scripts/run_code_in_mdfile.py +++ b/.github/scripts/run_code_in_mdfile.py @@ -44,7 +44,7 @@ def process_file(file, language, version): rust_script_contents = f"""//! ```cargo //! [dependencies] //! lace = {{ path = ".", version="{version}" }} - //! polars = {{ version = "=0.32.0", features=["csv"] }} + //! polars = {{ version = "0.33", features=["csv"] }} //! rand = "0.8" //! rand_xoshiro = "0.6" //! ``` diff --git a/book/lace_preprocess_mdbook_yaml/Cargo.lock b/book/lace_preprocess_mdbook_yaml/Cargo.lock index a153e188..5eea269c 100644 --- a/book/lace_preprocess_mdbook_yaml/Cargo.lock +++ b/book/lace_preprocess_mdbook_yaml/Cargo.lock @@ -63,6 +63,12 @@ dependencies = [ "url", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -163,9 +169,9 @@ dependencies = [ [[package]] name = "arrow2" -version = "0.17.4" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c468daea140b747d781a1da9f7db5f0a8e6636d4af20cc539e43d05b0604fa" +checksum = "963fef509b757bcbbf9e5ffa23bcb345614d99f4f6f531f97417b27b8604d389" dependencies = [ "ahash", "arrow-format", @@ -180,13 +186,14 @@ dependencies = [ "futures", "getrandom", "hash_hasher", + "hashbrown 0.14.0", "lexical-core", "lz4", "multiversion", "num-traits", "parquet2", "regex", - "regex-syntax 0.6.29", + "regex-syntax", "rustc_version", "simdutf8", "streaming-iterator", @@ -315,7 +322,7 @@ checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", "once_cell", - "regex-automata", + "regex-automata 0.1.10", "serde", ] @@ -374,14 +381,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ + "android-tzdata", "iana-time-zone", - "num-integer", "num-traits", - "winapi", + "windows-targets 0.48.0", ] [[package]] @@ -509,6 +516,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.15" @@ -621,9 +638,9 @@ checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elasticlunr-rs" @@ -1311,7 +1328,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.4" +version = "0.1.5" dependencies = [ "flate2", "lace_consts", @@ -1609,9 +1626,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memmap2" @@ -2098,9 +2115,9 @@ dependencies = [ [[package]] name = "polars" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7298f78a752ab4374b2158cd25346a30885af955b52f16404ecd1f603cedf987" +checksum = "3030de163b9ff2c9dac9a12dcb9be25cc0f2bc7c8e7cd2e4b2592ebed458ce6a" dependencies = [ "getrandom", "polars-core", @@ -2114,9 +2131,9 @@ dependencies = [ [[package]] name = "polars-arrow" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d16e1c69d8b0904fd5468ec87e58dbd1ff70eade5dcee7d2998a5aeef73e7d5" +checksum = "35cd38a64fb389fd990e4efd433a36331c995c981d353bfef83b5de4d87f1828" dependencies = [ "arrow2", "atoi", @@ -2131,9 +2148,9 @@ dependencies = [ [[package]] name = "polars-core" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6185468ae1f3c4e59ca7ff0c35a1ee131b6b646f26320cad37dd9ed9372b19c" +checksum = "08367c014c07fa8f141680e024f926cab3a1fe839605a8fcf2223647eb45ca71" dependencies = [ "ahash", "arrow2", @@ -2162,9 +2179,9 @@ dependencies = [ [[package]] name = "polars-error" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a7d4c872ec0775112a0c527a8d4f74e2ef92f024b795fe7a8b00a21910a5dc" +checksum = "9b20a09651a299979354945819dc2ce017964b80b916954e9d2ce39002a5f949" dependencies = [ "arrow2", "regex", @@ -2173,18 +2190,16 @@ dependencies = [ [[package]] name = "polars-io" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbf1693b4f0a87bd576f02c11ebd3d3413199ac919d821c635536144e80affe" +checksum = "88cf4a89c18a90ac20dfbcdfd19ab50ad4ac5a76fc7bb775d3c28bb738cf1f34" dependencies = [ "ahash", "arrow2", - "async-trait", "bytes", "chrono", "fast-float", "flate2", - "futures", "home", "lexical", "lexical-core", @@ -2203,14 +2218,13 @@ dependencies = [ "serde_json", "simd-json", "simdutf8", - "tokio", ] [[package]] name = "polars-json" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1c6c79be2387ffb2f20743d192c11083be0e8bc0adf6d742ce28f1e7ca1142" +checksum = "d6d5666176d681706aef5a06a57597c83391948b3d958f9fbe9b4cf016527eb8" dependencies = [ "ahash", "arrow2", @@ -2226,9 +2240,9 @@ dependencies = [ [[package]] name = "polars-lazy" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707075e6317b047864cccc665d4d27c4936ecdfe54798019bb6dc1d0bc237063" +checksum = "5110eab438848c981cc5f541fbc5b21bb263fd707000b4715233074fb2630fcf" dependencies = [ "ahash", "bitflags 2.4.0", @@ -2250,9 +2264,9 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e64910ae597343e3bec8c90c5c5db59ca835e28296dda725718bbc0ce91d15" +checksum = "7740d7bc4c2ca08044f9ef599638e116fdd7d687e80d1974b698e390c6ce4252" dependencies = [ "argminmax", "arrow2", @@ -2262,16 +2276,19 @@ dependencies = [ "polars-arrow", "polars-core", "polars-utils", + "regex", "smartstring", "version_check", ] [[package]] name = "polars-pipe" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9072be429b07e9282ec24030bc379fe77237aeda78c87a6f566d5d04a9e52e0" +checksum = "1f30c5e77c5594ddc958a46fe2e021da2feba9c94e767e1d798bd82ac5a33c3b" dependencies = [ + "crossbeam-channel", + "crossbeam-queue", "enum_dispatch", "hashbrown 0.14.0", "num-traits", @@ -2289,9 +2306,9 @@ dependencies = [ [[package]] name = "polars-plan" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "289b7f2a9139fe13622872860207ef282aea0534578f917e0705a4bab73751aa" +checksum = "678cbeb730e29e50f0f8d844102d15454fc6113a74c667eab046c0e4a4322a9e" dependencies = [ "ahash", "arrow2", @@ -2311,9 +2328,9 @@ dependencies = [ [[package]] name = "polars-row" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a238c05921b0bd0064aaa2b9155909c9ff7ed92418fffd3f9f84ba4444531a43" +checksum = "c52ef8885b9d13f848839594fbab21ad79fc63f7e11c19cdc2cfe9bb03c313ac" dependencies = [ "arrow2", "polars-error", @@ -2322,9 +2339,9 @@ dependencies = [ [[package]] name = "polars-sql" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ae24b6aaa2b2edbee81f2f74cea0e54d71686f121c03d14115297641c6c096" +checksum = "4d716855267e3516f722287f68cf10e650e33f7197df83a79e680602471456fc" dependencies = [ "polars-arrow", "polars-core", @@ -2337,9 +2354,9 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b7d1b30aa65e113d7abd3bd5f3c301df2e033c5fb0d2085c12847b2d9484b3" +checksum = "a2eb75a24f11b55a400b52dc19a2a3e949aaaa46a911f99496de4485b1127063" dependencies = [ "arrow2", "atoi", @@ -2356,11 +2373,12 @@ dependencies = [ [[package]] name = "polars-utils" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38f1f0fee4bf34bfcb37ba556c69644097270c4fc6a722708d3f7a9e8c0b692" +checksum = "2a4a5e743509096322cad39104d56e329fe2748483a3354a0f0c354724f3cef6" dependencies = [ "ahash", + "bytemuck", "hashbrown 0.14.0", "num-traits", "once_cell", @@ -2517,13 +2535,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.1", + "regex-automata 0.3.8", + "regex-syntax", ] [[package]] @@ -2533,16 +2552,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] -name = "regex-syntax" -version = "0.6.29" +name = "regex-automata" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rustc_version" diff --git a/lace/Cargo.lock b/lace/Cargo.lock index 833773f6..45189acc 100644 --- a/lace/Cargo.lock +++ b/lace/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -165,9 +156,9 @@ dependencies = [ [[package]] name = "arrow2" -version = "0.17.4" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c468daea140b747d781a1da9f7db5f0a8e6636d4af20cc539e43d05b0604fa" +checksum = "963fef509b757bcbbf9e5ffa23bcb345614d99f4f6f531f97417b27b8604d389" dependencies = [ "ahash", "arrow-format", @@ -182,13 +173,14 @@ dependencies = [ "futures", "getrandom", "hash_hasher", + "hashbrown 0.14.0", "lexical-core", "lz4", "multiversion", "num-traits", "parquet2", "regex", - "regex-syntax 0.6.29", + "regex-syntax", "rustc_version", "simdutf8", "streaming-iterator", @@ -281,21 +273,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "backtrace" -version = "0.3.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.13.1" @@ -414,15 +391,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "winapi", + "windows-targets 0.48.1", ] [[package]] @@ -609,6 +586,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -758,9 +745,9 @@ checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encode_unicode" @@ -989,12 +976,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - [[package]] name = "glob" version = "0.3.1" @@ -1583,9 +1564,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memmap2" @@ -1832,15 +1813,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -[[package]] -name = "object" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.18.0" @@ -2039,9 +2011,9 @@ dependencies = [ [[package]] name = "polars" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7298f78a752ab4374b2158cd25346a30885af955b52f16404ecd1f603cedf987" +checksum = "3030de163b9ff2c9dac9a12dcb9be25cc0f2bc7c8e7cd2e4b2592ebed458ce6a" dependencies = [ "getrandom", "polars-core", @@ -2055,9 +2027,9 @@ dependencies = [ [[package]] name = "polars-arrow" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d16e1c69d8b0904fd5468ec87e58dbd1ff70eade5dcee7d2998a5aeef73e7d5" +checksum = "35cd38a64fb389fd990e4efd433a36331c995c981d353bfef83b5de4d87f1828" dependencies = [ "arrow2", "atoi", @@ -2072,9 +2044,9 @@ dependencies = [ [[package]] name = "polars-core" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6185468ae1f3c4e59ca7ff0c35a1ee131b6b646f26320cad37dd9ed9372b19c" +checksum = "08367c014c07fa8f141680e024f926cab3a1fe839605a8fcf2223647eb45ca71" dependencies = [ "ahash", "arrow2", @@ -2103,9 +2075,9 @@ dependencies = [ [[package]] name = "polars-error" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a7d4c872ec0775112a0c527a8d4f74e2ef92f024b795fe7a8b00a21910a5dc" +checksum = "9b20a09651a299979354945819dc2ce017964b80b916954e9d2ce39002a5f949" dependencies = [ "arrow2", "regex", @@ -2114,18 +2086,16 @@ dependencies = [ [[package]] name = "polars-io" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbf1693b4f0a87bd576f02c11ebd3d3413199ac919d821c635536144e80affe" +checksum = "88cf4a89c18a90ac20dfbcdfd19ab50ad4ac5a76fc7bb775d3c28bb738cf1f34" dependencies = [ "ahash", "arrow2", - "async-trait", "bytes", "chrono", "fast-float", "flate2", - "futures", "home", "lexical", "lexical-core", @@ -2144,14 +2114,13 @@ dependencies = [ "serde_json", "simd-json", "simdutf8", - "tokio", ] [[package]] name = "polars-json" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1c6c79be2387ffb2f20743d192c11083be0e8bc0adf6d742ce28f1e7ca1142" +checksum = "d6d5666176d681706aef5a06a57597c83391948b3d958f9fbe9b4cf016527eb8" dependencies = [ "ahash", "arrow2", @@ -2167,9 +2136,9 @@ dependencies = [ [[package]] name = "polars-lazy" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707075e6317b047864cccc665d4d27c4936ecdfe54798019bb6dc1d0bc237063" +checksum = "5110eab438848c981cc5f541fbc5b21bb263fd707000b4715233074fb2630fcf" dependencies = [ "ahash", "bitflags 2.3.3", @@ -2191,9 +2160,9 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e64910ae597343e3bec8c90c5c5db59ca835e28296dda725718bbc0ce91d15" +checksum = "7740d7bc4c2ca08044f9ef599638e116fdd7d687e80d1974b698e390c6ce4252" dependencies = [ "argminmax", "arrow2", @@ -2203,16 +2172,19 @@ dependencies = [ "polars-arrow", "polars-core", "polars-utils", + "regex", "smartstring", "version_check", ] [[package]] name = "polars-pipe" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9072be429b07e9282ec24030bc379fe77237aeda78c87a6f566d5d04a9e52e0" +checksum = "1f30c5e77c5594ddc958a46fe2e021da2feba9c94e767e1d798bd82ac5a33c3b" dependencies = [ + "crossbeam-channel", + "crossbeam-queue", "enum_dispatch", "hashbrown 0.14.0", "num-traits", @@ -2230,9 +2202,9 @@ dependencies = [ [[package]] name = "polars-plan" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "289b7f2a9139fe13622872860207ef282aea0534578f917e0705a4bab73751aa" +checksum = "678cbeb730e29e50f0f8d844102d15454fc6113a74c667eab046c0e4a4322a9e" dependencies = [ "ahash", "arrow2", @@ -2252,9 +2224,9 @@ dependencies = [ [[package]] name = "polars-row" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a238c05921b0bd0064aaa2b9155909c9ff7ed92418fffd3f9f84ba4444531a43" +checksum = "c52ef8885b9d13f848839594fbab21ad79fc63f7e11c19cdc2cfe9bb03c313ac" dependencies = [ "arrow2", "polars-error", @@ -2263,9 +2235,9 @@ dependencies = [ [[package]] name = "polars-sql" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ae24b6aaa2b2edbee81f2f74cea0e54d71686f121c03d14115297641c6c096" +checksum = "4d716855267e3516f722287f68cf10e650e33f7197df83a79e680602471456fc" dependencies = [ "polars-arrow", "polars-core", @@ -2278,9 +2250,9 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b7d1b30aa65e113d7abd3bd5f3c301df2e033c5fb0d2085c12847b2d9484b3" +checksum = "a2eb75a24f11b55a400b52dc19a2a3e949aaaa46a911f99496de4485b1127063" dependencies = [ "arrow2", "atoi", @@ -2297,11 +2269,12 @@ dependencies = [ [[package]] name = "polars-utils" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38f1f0fee4bf34bfcb37ba556c69644097270c4fc6a722708d3f7a9e8c0b692" +checksum = "2a4a5e743509096322cad39104d56e329fe2748483a3354a0f0c354724f3cef6" dependencies = [ "ahash", + "bytemuck", "hashbrown 0.14.0", "num-traits", "once_cell", @@ -2466,7 +2439,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] @@ -2477,27 +2450,15 @@ checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustc_version" version = "0.4.0" @@ -2788,16 +2749,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "special" version = "0.10.2" @@ -3012,21 +2963,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "tokio" -version = "1.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" -dependencies = [ - "autocfg", - "backtrace", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.48.0", -] - [[package]] name = "toml" version = "0.7.6" diff --git a/lace/Cargo.toml b/lace/Cargo.toml index c956f5d3..0a1b4217 100644 --- a/lace/Cargo.toml +++ b/lace/Cargo.toml @@ -66,7 +66,7 @@ thiserror = "1.0.19" indicatif = "0.17.0" ctrlc = "3.2.1" flate2 = "1.0.23" -polars = { version = "=0.32.0", features = ["parquet", "json", "ipc", "dtype-full", "decompress"] } +polars = { version = "0.33", features = ["parquet", "json", "ipc", "dtype-full", "decompress"] } [dev-dependencies] approx = "0.5.1" diff --git a/lace/lace_codebook/Cargo.toml b/lace/lace_codebook/Cargo.toml index 5fdb206c..56bf0a59 100644 --- a/lace/lace_codebook/Cargo.toml +++ b/lace/lace_codebook/Cargo.toml @@ -20,7 +20,7 @@ rand = {version="0.8.5", features=["serde1"]} thiserror = "1.0.11" rayon = "1.5" flate2 = "1.0.23" -polars = { version = "=0.32.0", features = ["parquet", "json", "ipc", "dtype-full", "decompress"] } +polars = { version = "0.33", features = ["parquet", "json", "ipc", "dtype-full", "decompress"] } [dev-dependencies] tempfile = "3.3.0" diff --git a/pylace/Cargo.lock b/pylace/Cargo.lock index 4262d9c5..bdabc067 100644 --- a/pylace/Cargo.lock +++ b/pylace/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" -dependencies = [ - "gimli", -] - [[package]] name = "adler" version = "1.0.2" @@ -159,9 +150,9 @@ dependencies = [ [[package]] name = "arrow2" -version = "0.17.4" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c468daea140b747d781a1da9f7db5f0a8e6636d4af20cc539e43d05b0604fa" +checksum = "963fef509b757bcbbf9e5ffa23bcb345614d99f4f6f531f97417b27b8604d389" dependencies = [ "ahash", "arrow-format", @@ -176,13 +167,14 @@ dependencies = [ "futures", "getrandom", "hash_hasher", + "hashbrown 0.14.0", "lexical-core", "lz4", "multiversion", "num-traits", "parquet2", "regex", - "regex-syntax 0.6.29", + "regex-syntax", "rustc_version", "simdutf8", "streaming-iterator", @@ -238,21 +230,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "backtrace" -version = "0.3.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - [[package]] name = "base64" version = "0.21.2" @@ -350,14 +327,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "winapi", + "windows-targets 0.48.1", ] [[package]] @@ -481,6 +458,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -560,9 +547,9 @@ checksum = "304e6508efa593091e97a9abbc10f90aa7ca635b6d2784feff3c89d41dd12272" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encode_unicode" @@ -767,12 +754,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - [[package]] name = "glob" version = "0.3.1" @@ -1275,9 +1256,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memmap2" @@ -1492,15 +1473,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" -[[package]] -name = "object" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.18.0" @@ -1629,9 +1601,9 @@ dependencies = [ [[package]] name = "polars" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7298f78a752ab4374b2158cd25346a30885af955b52f16404ecd1f603cedf987" +checksum = "3030de163b9ff2c9dac9a12dcb9be25cc0f2bc7c8e7cd2e4b2592ebed458ce6a" dependencies = [ "getrandom", "polars-core", @@ -1645,9 +1617,9 @@ dependencies = [ [[package]] name = "polars-arrow" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d16e1c69d8b0904fd5468ec87e58dbd1ff70eade5dcee7d2998a5aeef73e7d5" +checksum = "35cd38a64fb389fd990e4efd433a36331c995c981d353bfef83b5de4d87f1828" dependencies = [ "arrow2", "atoi", @@ -1662,9 +1634,9 @@ dependencies = [ [[package]] name = "polars-core" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6185468ae1f3c4e59ca7ff0c35a1ee131b6b646f26320cad37dd9ed9372b19c" +checksum = "08367c014c07fa8f141680e024f926cab3a1fe839605a8fcf2223647eb45ca71" dependencies = [ "ahash", "arrow2", @@ -1693,9 +1665,9 @@ dependencies = [ [[package]] name = "polars-error" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a7d4c872ec0775112a0c527a8d4f74e2ef92f024b795fe7a8b00a21910a5dc" +checksum = "9b20a09651a299979354945819dc2ce017964b80b916954e9d2ce39002a5f949" dependencies = [ "arrow2", "regex", @@ -1704,18 +1676,16 @@ dependencies = [ [[package]] name = "polars-io" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbf1693b4f0a87bd576f02c11ebd3d3413199ac919d821c635536144e80affe" +checksum = "88cf4a89c18a90ac20dfbcdfd19ab50ad4ac5a76fc7bb775d3c28bb738cf1f34" dependencies = [ "ahash", "arrow2", - "async-trait", "bytes", "chrono", "fast-float", "flate2", - "futures", "home", "lexical", "lexical-core", @@ -1734,14 +1704,13 @@ dependencies = [ "serde_json", "simd-json", "simdutf8", - "tokio", ] [[package]] name = "polars-json" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1c6c79be2387ffb2f20743d192c11083be0e8bc0adf6d742ce28f1e7ca1142" +checksum = "d6d5666176d681706aef5a06a57597c83391948b3d958f9fbe9b4cf016527eb8" dependencies = [ "ahash", "arrow2", @@ -1757,9 +1726,9 @@ dependencies = [ [[package]] name = "polars-lazy" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707075e6317b047864cccc665d4d27c4936ecdfe54798019bb6dc1d0bc237063" +checksum = "5110eab438848c981cc5f541fbc5b21bb263fd707000b4715233074fb2630fcf" dependencies = [ "ahash", "bitflags 2.3.3", @@ -1781,9 +1750,9 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e64910ae597343e3bec8c90c5c5db59ca835e28296dda725718bbc0ce91d15" +checksum = "7740d7bc4c2ca08044f9ef599638e116fdd7d687e80d1974b698e390c6ce4252" dependencies = [ "argminmax", "arrow2", @@ -1793,16 +1762,19 @@ dependencies = [ "polars-arrow", "polars-core", "polars-utils", + "regex", "smartstring", "version_check", ] [[package]] name = "polars-pipe" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9072be429b07e9282ec24030bc379fe77237aeda78c87a6f566d5d04a9e52e0" +checksum = "1f30c5e77c5594ddc958a46fe2e021da2feba9c94e767e1d798bd82ac5a33c3b" dependencies = [ + "crossbeam-channel", + "crossbeam-queue", "enum_dispatch", "hashbrown 0.14.0", "num-traits", @@ -1820,9 +1792,9 @@ dependencies = [ [[package]] name = "polars-plan" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "289b7f2a9139fe13622872860207ef282aea0534578f917e0705a4bab73751aa" +checksum = "678cbeb730e29e50f0f8d844102d15454fc6113a74c667eab046c0e4a4322a9e" dependencies = [ "ahash", "arrow2", @@ -1842,9 +1814,9 @@ dependencies = [ [[package]] name = "polars-row" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a238c05921b0bd0064aaa2b9155909c9ff7ed92418fffd3f9f84ba4444531a43" +checksum = "c52ef8885b9d13f848839594fbab21ad79fc63f7e11c19cdc2cfe9bb03c313ac" dependencies = [ "arrow2", "polars-error", @@ -1853,9 +1825,9 @@ dependencies = [ [[package]] name = "polars-sql" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ae24b6aaa2b2edbee81f2f74cea0e54d71686f121c03d14115297641c6c096" +checksum = "4d716855267e3516f722287f68cf10e650e33f7197df83a79e680602471456fc" dependencies = [ "polars-arrow", "polars-core", @@ -1868,9 +1840,9 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b7d1b30aa65e113d7abd3bd5f3c301df2e033c5fb0d2085c12847b2d9484b3" +checksum = "a2eb75a24f11b55a400b52dc19a2a3e949aaaa46a911f99496de4485b1127063" dependencies = [ "arrow2", "atoi", @@ -1887,11 +1859,12 @@ dependencies = [ [[package]] name = "polars-utils" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e38f1f0fee4bf34bfcb37ba556c69644097270c4fc6a722708d3f7a9e8c0b692" +checksum = "2a4a5e743509096322cad39104d56e329fe2748483a3354a0f0c354724f3cef6" dependencies = [ "ahash", + "bytemuck", "hashbrown 0.14.0", "num-traits", "once_cell", @@ -2131,7 +2104,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] @@ -2142,27 +2115,15 @@ checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustc_version" version = "0.4.0" @@ -2391,16 +2352,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "special" version = "0.10.2" @@ -2570,21 +2521,6 @@ dependencies = [ "crossbeam-channel", ] -[[package]] -name = "tokio" -version = "1.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" -dependencies = [ - "autocfg", - "backtrace", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.48.0", -] - [[package]] name = "toml" version = "0.7.6" diff --git a/pylace/Cargo.toml b/pylace/Cargo.toml index 94c5e273..8dc2c882 100644 --- a/pylace/Cargo.toml +++ b/pylace/Cargo.toml @@ -16,8 +16,8 @@ rand_xoshiro = "0.6.0" pyo3 = { version = "0.19", features = ["extension-module"] } serde_json = "1.0.91" serde_yaml = "0.9.17" -polars = "=0.32.0" -arrow2 = "0.17" +polars = "0.33" +arrow2 = "0.18" [package.metadata.maturin] name = "lace.core" diff --git a/pylace/src/df.rs b/pylace/src/df.rs index 0435dae8..b0c8039a 100644 --- a/pylace/src/df.rs +++ b/pylace/src/df.rs @@ -65,6 +65,9 @@ impl std::convert::From for PyErr { PolarsError::StringCacheMismatch(err) => { StringCacheMismatch::new_err(err.to_string()) } + PolarsError::OutOfBounds(_) => { + OutOfBounds::new_err(err.to_string()) + } }, DataFrameError::Arrow(err) => { ArrowErrorException::new_err(format!("{:?}", err)) @@ -220,3 +223,4 @@ create_exception!(exceptions, ShapeError, PyException); create_exception!(exceptions, SchemaError, PyException); create_exception!(exceptions, DuplicateError, PyException); create_exception!(exceptions, StringCacheMismatch, PyException); +create_exception!(exceptions, OutOfBounds, PyException); diff --git a/pylace/src/utils.rs b/pylace/src/utils.rs index 9f0171e0..c9393c13 100644 --- a/pylace/src/utils.rs +++ b/pylace/src/utils.rs @@ -669,7 +669,7 @@ pub(crate) fn pyany_to_data( fn process_row_dict( row_dict: &PyDict, - col_indexer: &Indexer, + _col_indexer: &Indexer, engine: &lace::Engine, suppl_types: Option<&HashMap>, ) -> Result, PyErr> { From 8cb798b1f9f44d2fee28a0e776c7e5b6bae4f5e9 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Tue, 26 Sep 2023 16:32:46 -0500 Subject: [PATCH 15/18] Bumped versions Bumped rust minor versions Bumped python major versions --- lace/Cargo.lock | 8 ++++---- lace/Cargo.toml | 2 +- lace/lace_cc/Cargo.toml | 4 ++-- lace/lace_codebook/Cargo.toml | 2 +- lace/lace_metadata/Cargo.toml | 4 ++-- pylace/Cargo.lock | 10 +++++----- pylace/Cargo.toml | 4 ++-- pylace/pyproject.toml | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lace/Cargo.lock b/lace/Cargo.lock index 45189acc..bb7ec9cb 100644 --- a/lace/Cargo.lock +++ b/lace/Cargo.lock @@ -1223,7 +1223,7 @@ dependencies = [ [[package]] name = "lace" -version = "0.3.1" +version = "0.3.2" dependencies = [ "approx", "bincode", @@ -1267,7 +1267,7 @@ dependencies = [ [[package]] name = "lace_cc" -version = "0.1.5" +version = "0.1.6" dependencies = [ "approx", "criterion", @@ -1292,7 +1292,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.5" +version = "0.1.6" dependencies = [ "flate2", "indoc", @@ -1345,7 +1345,7 @@ dependencies = [ [[package]] name = "lace_metadata" -version = "0.1.5" +version = "0.1.6" dependencies = [ "bincode", "dirs", diff --git a/lace/Cargo.toml b/lace/Cargo.toml index 0a1b4217..07fae6b4 100644 --- a/lace/Cargo.toml +++ b/lace/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace" -version = "0.3.1" +version = "0.3.2" authors = ["Promised AI"] build = "build.rs" edition = "2021" diff --git a/lace/lace_cc/Cargo.toml b/lace/lace_cc/Cargo.toml index 7efd1918..d6a642ef 100644 --- a/lace/lace_cc/Cargo.toml +++ b/lace/lace_cc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace_cc" -version = "0.1.5" +version = "0.1.6" authors = ["Promised AI"] edition = "2021" exclude = ["tests/*", "resources/test/*", "target/*"] @@ -15,7 +15,7 @@ lace_stats = { path = "../lace_stats", version = "0.1.2" } lace_geweke = { path = "../lace_geweke", version = "0.1.2" } lace_consts = { path = "../lace_consts", version = "0.1.4" } lace_data = { path = "../lace_data", version = "0.1.2" } -lace_codebook = { path = "../lace_codebook", version = "0.1.5" } +lace_codebook = { path = "../lace_codebook", version = "0.1.6" } rand = {version="0.8", features=["serde1"]} rayon = "1.5" serde = { version = "1", features = ["derive"] } diff --git a/lace/lace_codebook/Cargo.toml b/lace/lace_codebook/Cargo.toml index 56bf0a59..1cfa0bf0 100644 --- a/lace/lace_codebook/Cargo.toml +++ b/lace/lace_codebook/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace_codebook" -version = "0.1.5" +version = "0.1.6" authors = ["Promised.ai"] edition = "2021" license = "SSPL-1.0" diff --git a/lace/lace_metadata/Cargo.toml b/lace/lace_metadata/Cargo.toml index ae896dc8..f38f2399 100644 --- a/lace/lace_metadata/Cargo.toml +++ b/lace/lace_metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace_metadata" -version = "0.1.5" +version = "0.1.6" authors = ["Promised AI"] edition = "2021" license = "SSPL-1.0" @@ -11,7 +11,7 @@ description = "Archive of the metadata (savefile) formats for Lace. In charge of [dependencies] lace_stats = { path = "../lace_stats", version = "0.1.4" } lace_data = { path = "../lace_data", version = "0.1.2" } -lace_codebook = { path = "../lace_codebook", version = "0.1.5" } +lace_codebook = { path = "../lace_codebook", version = "0.1.6" } lace_cc = { path = "../lace_cc", version = "0.1.5" } dirs = "5" serde = { version = "1", features = ["derive"] } diff --git a/pylace/Cargo.lock b/pylace/Cargo.lock index bdabc067..5e4b577b 100644 --- a/pylace/Cargo.lock +++ b/pylace/Cargo.lock @@ -943,7 +943,7 @@ dependencies = [ [[package]] name = "lace" -version = "0.3.1" +version = "0.3.2" dependencies = [ "bincode", "clap", @@ -981,7 +981,7 @@ dependencies = [ [[package]] name = "lace_cc" -version = "0.1.5" +version = "0.1.6" dependencies = [ "enum_dispatch", "indicatif", @@ -1003,7 +1003,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.5" +version = "0.1.6" dependencies = [ "flate2", "lace_consts", @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "lace_metadata" -version = "0.1.5" +version = "0.1.6" dependencies = [ "bincode", "dirs", @@ -1904,7 +1904,7 @@ checksum = "fe7765e19fb2ba6fd4373b8d90399f5321683ea7c11b598c6bbaa3a72e9c83b8" [[package]] name = "pylace" -version = "0.3.1" +version = "0.4.0" dependencies = [ "arrow2", "lace", diff --git a/pylace/Cargo.toml b/pylace/Cargo.toml index 8dc2c882..ccd11622 100644 --- a/pylace/Cargo.toml +++ b/pylace/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pylace" -version = "0.3.1" +version = "0.4.0" edition = "2021" license = "SSPL-1.0" @@ -9,7 +9,7 @@ name = "lace" crate-type = ["cdylib"] [dependencies] -lace = { path = "../lace", version="0.3.1" } +lace = { path = "../lace", version="0.3.2" } lace_utils = { path = "../lace/lace_utils", version="0.1.2" } rand = "0.8.5" rand_xoshiro = "0.6.0" diff --git a/pylace/pyproject.toml b/pylace/pyproject.toml index 310ebec9..a5627f75 100644 --- a/pylace/pyproject.toml +++ b/pylace/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "pylace" -version = "0.3.1" +version = "0.4.0" description = "A probabalistic programming ML tool for science" requires-python = ">=3.8" classifiers = [ From 986d5e405f4f554c28a4cec9f832078fbd18ea76 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Tue, 26 Sep 2023 17:03:03 -0500 Subject: [PATCH 16/18] Filled out the `CHANGELOG` --- CHANGELOG.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e1d6123..9559b271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,15 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [python-0.4.0] - 2023-09-27 + +### Added + - Component params now available from `pylace` + - `Engine`s in `pylace` now implement deepcopy + ### Fixed -- Fixed pylace's `__getitem__` index name to match other accessors. -- Fixed pylace's `append_column_metadata` to refer to the correct internal function. -- Pylace will try to use Python's internal conversion for floats in `value_to_datum` conversion. +- Fixed `pylace`'s `__getitem__` index name to match other accessors +- Fixed `pylace`'s `append_column_metadata` to refer to the correct internal function. +- `pylace` will try to use Python's internal conversion for floats in `value_to_datum` conversion. -### Added - - Pylace's Engine now implements deepcopy. +### Changed + +- Updated rust `polars` to version `0.33` +- Updated rust `arrow2` to `0.18` + +## [rust-0.3.2] - 2023-09-27 + +### Fixed + - Upgraded `polars` version to version `0.33` (fixes builds failing due to no `cmake` installed) ## [python-0.3.1] - 2023-08-28 @@ -127,7 +140,9 @@ Initial release on [PyPi](https://pypi.org/) Initial release on [crates.io](https://crates.io/) -[unreleased]: https://github.com/promised-ai/lace/compare/python-0.3.1...HEAD +[unreleased]: https://github.com/promised-ai/lace/compare/python-0.4.0...HEAD +[python-0.4.0]: https://github.com/promised-ai/lace/compare/python-0.3.1...python-0.4.0 +[rust-0.3.2]: https://github.com/promised-ai/lace/compare/rust-0.3.1...rust-0.3.2 [python-0.3.1]: https://github.com/promised-ai/lace/compare/python-0.3.0...python-0.3.1 [rust-0.3.1]: https://github.com/promised-ai/lace/compare/rust-0.3.0...rust-0.3.1 [python-0.3.0]: https://github.com/promised-ai/lace/compare/python-0.2.0...python-0.3.0 From 0cbace9d261b081f2321918f28fb3cc5c93dd2ad Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Tue, 26 Sep 2023 17:34:30 -0500 Subject: [PATCH 17/18] Changed the `rust` version to be a major change rather than a minor/patch --- CHANGELOG.md | 6 +++--- lace/Cargo.lock | 8 ++++---- lace/Cargo.toml | 8 ++++---- lace/lace_cc/Cargo.toml | 4 ++-- lace/lace_codebook/Cargo.toml | 2 +- lace/lace_metadata/Cargo.toml | 6 +++--- pylace/Cargo.lock | 8 ++++---- pylace/Cargo.toml | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9559b271..cd9a60ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [python-0.4.0] - 2023-09-27 -### Added +### Added - Component params now available from `pylace` - `Engine`s in `pylace` now implement deepcopy @@ -24,7 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated rust `polars` to version `0.33` - Updated rust `arrow2` to `0.18` -## [rust-0.3.2] - 2023-09-27 +## [rust-0.4.0] - 2023-09-27 ### Fixed @@ -142,7 +142,7 @@ Initial release on [crates.io](https://crates.io/) [unreleased]: https://github.com/promised-ai/lace/compare/python-0.4.0...HEAD [python-0.4.0]: https://github.com/promised-ai/lace/compare/python-0.3.1...python-0.4.0 -[rust-0.3.2]: https://github.com/promised-ai/lace/compare/rust-0.3.1...rust-0.3.2 +[rust-0.4.0]: https://github.com/promised-ai/lace/compare/rust-0.3.1...rust-0.4.0 [python-0.3.1]: https://github.com/promised-ai/lace/compare/python-0.3.0...python-0.3.1 [rust-0.3.1]: https://github.com/promised-ai/lace/compare/rust-0.3.0...rust-0.3.1 [python-0.3.0]: https://github.com/promised-ai/lace/compare/python-0.2.0...python-0.3.0 diff --git a/lace/Cargo.lock b/lace/Cargo.lock index bb7ec9cb..a05d57bd 100644 --- a/lace/Cargo.lock +++ b/lace/Cargo.lock @@ -1223,7 +1223,7 @@ dependencies = [ [[package]] name = "lace" -version = "0.3.2" +version = "0.4.0" dependencies = [ "approx", "bincode", @@ -1267,7 +1267,7 @@ dependencies = [ [[package]] name = "lace_cc" -version = "0.1.6" +version = "0.2.0" dependencies = [ "approx", "criterion", @@ -1292,7 +1292,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.6" +version = "0.2.0" dependencies = [ "flate2", "indoc", @@ -1345,7 +1345,7 @@ dependencies = [ [[package]] name = "lace_metadata" -version = "0.1.6" +version = "0.2.0" dependencies = [ "bincode", "dirs", diff --git a/lace/Cargo.toml b/lace/Cargo.toml index 07fae6b4..c3e88a72 100644 --- a/lace/Cargo.toml +++ b/lace/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace" -version = "0.3.2" +version = "0.4.0" authors = ["Promised AI"] build = "build.rs" edition = "2021" @@ -35,14 +35,14 @@ name = "lace" path = "bin/main.rs" [dependencies] -lace_cc = { path = "lace_cc", version = "0.1.4" } +lace_cc = { path = "lace_cc", version = "0.2.0" } lace_utils = { path = "lace_utils", version = "0.1.2" } lace_stats = { path = "lace_stats", version = "0.1.3" } -lace_codebook = { path = "lace_codebook", version = "0.1.5" } +lace_codebook = { path = "lace_codebook", version = "0.2.0" } lace_geweke = { path = "lace_geweke", version = "0.1.2" } lace_consts = { path = "lace_consts", version = "0.1.4" } lace_data = { path = "lace_data", version = "0.1.2" } -lace_metadata = { path = "lace_metadata", version = "0.1.4" } +lace_metadata = { path = "lace_metadata", version = "0.2.0" } dirs = "5" itertools = "0.11" num = "0.4" diff --git a/lace/lace_cc/Cargo.toml b/lace/lace_cc/Cargo.toml index d6a642ef..08edbb5d 100644 --- a/lace/lace_cc/Cargo.toml +++ b/lace/lace_cc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace_cc" -version = "0.1.6" +version = "0.2.0" authors = ["Promised AI"] edition = "2021" exclude = ["tests/*", "resources/test/*", "target/*"] @@ -15,7 +15,7 @@ lace_stats = { path = "../lace_stats", version = "0.1.2" } lace_geweke = { path = "../lace_geweke", version = "0.1.2" } lace_consts = { path = "../lace_consts", version = "0.1.4" } lace_data = { path = "../lace_data", version = "0.1.2" } -lace_codebook = { path = "../lace_codebook", version = "0.1.6" } +lace_codebook = { path = "../lace_codebook", version = "0.2.0" } rand = {version="0.8", features=["serde1"]} rayon = "1.5" serde = { version = "1", features = ["derive"] } diff --git a/lace/lace_codebook/Cargo.toml b/lace/lace_codebook/Cargo.toml index 1cfa0bf0..3fc924c4 100644 --- a/lace/lace_codebook/Cargo.toml +++ b/lace/lace_codebook/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace_codebook" -version = "0.1.6" +version = "0.2.0" authors = ["Promised.ai"] edition = "2021" license = "SSPL-1.0" diff --git a/lace/lace_metadata/Cargo.toml b/lace/lace_metadata/Cargo.toml index f38f2399..56c8c675 100644 --- a/lace/lace_metadata/Cargo.toml +++ b/lace/lace_metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lace_metadata" -version = "0.1.6" +version = "0.2.0" authors = ["Promised AI"] edition = "2021" license = "SSPL-1.0" @@ -11,8 +11,8 @@ description = "Archive of the metadata (savefile) formats for Lace. In charge of [dependencies] lace_stats = { path = "../lace_stats", version = "0.1.4" } lace_data = { path = "../lace_data", version = "0.1.2" } -lace_codebook = { path = "../lace_codebook", version = "0.1.6" } -lace_cc = { path = "../lace_cc", version = "0.1.5" } +lace_codebook = { path = "../lace_codebook", version = "0.2.0" } +lace_cc = { path = "../lace_cc", version = "0.2.0" } dirs = "5" serde = { version = "1", features = ["derive"] } serde_yaml = "0.9.4" diff --git a/pylace/Cargo.lock b/pylace/Cargo.lock index 5e4b577b..ccbeb6ea 100644 --- a/pylace/Cargo.lock +++ b/pylace/Cargo.lock @@ -943,7 +943,7 @@ dependencies = [ [[package]] name = "lace" -version = "0.3.2" +version = "0.4.0" dependencies = [ "bincode", "clap", @@ -981,7 +981,7 @@ dependencies = [ [[package]] name = "lace_cc" -version = "0.1.6" +version = "0.2.0" dependencies = [ "enum_dispatch", "indicatif", @@ -1003,7 +1003,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.6" +version = "0.2.0" dependencies = [ "flate2", "lace_consts", @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "lace_metadata" -version = "0.1.6" +version = "0.2.0" dependencies = [ "bincode", "dirs", diff --git a/pylace/Cargo.toml b/pylace/Cargo.toml index ccd11622..fa466527 100644 --- a/pylace/Cargo.toml +++ b/pylace/Cargo.toml @@ -9,7 +9,7 @@ name = "lace" crate-type = ["cdylib"] [dependencies] -lace = { path = "../lace", version="0.3.2" } +lace = { path = "../lace", version="0.4.0" } lace_utils = { path = "../lace/lace_utils", version="0.1.2" } rand = "0.8.5" rand_xoshiro = "0.6.0" From 37384629c517575da6cbad1f96af3f926d451e19 Mon Sep 17 00:00:00 2001 From: Ken Swanson Date: Tue, 26 Sep 2023 18:55:59 -0500 Subject: [PATCH 18/18] Fixed version in book checker --- book/lace_preprocess_mdbook_yaml/Cargo.lock | 2 +- book/lace_preprocess_mdbook_yaml/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/book/lace_preprocess_mdbook_yaml/Cargo.lock b/book/lace_preprocess_mdbook_yaml/Cargo.lock index 5eea269c..7f0868c9 100644 --- a/book/lace_preprocess_mdbook_yaml/Cargo.lock +++ b/book/lace_preprocess_mdbook_yaml/Cargo.lock @@ -1328,7 +1328,7 @@ dependencies = [ [[package]] name = "lace_codebook" -version = "0.1.5" +version = "0.2.0" dependencies = [ "flate2", "lace_consts", diff --git a/book/lace_preprocess_mdbook_yaml/Cargo.toml b/book/lace_preprocess_mdbook_yaml/Cargo.toml index 50dcbb8d..1e84c7ba 100644 --- a/book/lace_preprocess_mdbook_yaml/Cargo.toml +++ b/book/lace_preprocess_mdbook_yaml/Cargo.toml @@ -18,7 +18,7 @@ path = "src/main.rs" anyhow = "1.0" clap = "4.2" env_logger = "0.9" -lace_codebook = { path = "../../lace/lace_codebook", version = "0.1.1" } +lace_codebook = { path = "../../lace/lace_codebook", version = "0.2.0" } lace_stats = { path = "../../lace/lace_stats", version = "0.1.1" } log = "0.4" mdbook = "0.4"