diff --git a/Cargo.lock b/Cargo.lock index e6678c6..be8877f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,9 +127,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cc" @@ -345,12 +345,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "foreign_vec" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee1b05cbd864bcaecbd3455d6d967862d446e4ebfc3c2e5e5b9841e53cba6673" - [[package]] name = "getrandom" version = "0.2.15" @@ -392,12 +386,6 @@ dependencies = [ "serde", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -430,7 +418,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.52.0", ] [[package]] @@ -824,9 +812,9 @@ dependencies = [ [[package]] name = "polars" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3351ea4570e54cd556e6755b78fe7a2c85368d820c0307cca73c96e796a7ba" +checksum = "ad002eb9c541b4f7e0c7c759cefe884a0350e15d241231ac4be31c5568c15070" dependencies = [ "getrandom", "polars-arrow", @@ -844,9 +832,9 @@ dependencies = [ [[package]] name = "polars-arrow" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba65fc4bcabbd64fca01fd30e759f8b2043f0963c57619e331d4b534576c0b47" +checksum = "32d19c6db79cb6a3c55af3b5a3976276edaab64cbf7f69b392617c2af30d7742" dependencies = [ "ahash", "atoi", @@ -858,7 +846,6 @@ dependencies = [ "either", "ethnum", "fast-float", - "foreign_vec", "getrandom", "hashbrown", "itoa", @@ -866,6 +853,7 @@ dependencies = [ "lz4", "multiversion", "num-traits", + "parking_lot", "polars-arrow-format", "polars-error", "polars-utils", @@ -889,9 +877,9 @@ dependencies = [ [[package]] name = "polars-compute" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f099516af30ac9ae4b4480f4ad02aa017d624f2f37b7a16ad4e9ba52f7e5269" +checksum = "30194a5ff325f61d6fcb62dc215c9210f308fc4fc85a493ef777dbcd938cba24" dependencies = [ "bytemuck", "either", @@ -905,9 +893,9 @@ dependencies = [ [[package]] name = "polars-core" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2439484be228b8c302328e2f953e64cfd93930636e5c7ceed90339ece7fef6c" +checksum = "2ba2a3b736d55b92a12889672d0197dc25ad321ab23eba4168a3b6316a6b6349" dependencies = [ "ahash", "bitflags", @@ -937,9 +925,9 @@ dependencies = [ [[package]] name = "polars-error" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9b06dfbe79cabe50a7f0a90396864b5ee2c0e0f8d6a9353b2343c29c56e937" +checksum = "07101d1803ca2046cdb3a8adb1523ddcc879229860f0ac56a853034269dec1e1" dependencies = [ "polars-arrow-format", "regex", @@ -949,9 +937,9 @@ dependencies = [ [[package]] name = "polars-expr" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c630385a56a867c410a20f30772d088f90ec3d004864562b84250b35268f97" +checksum = "dd5c69634ddbb0f44186cd1c42d166963fc756f9cc994438e941bc2703ddbbab" dependencies = [ "ahash", "bitflags", @@ -969,9 +957,9 @@ dependencies = [ [[package]] name = "polars-ffi" -version = "0.41.1" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf2cb86f7c01523d95998760200836d98b49653172ee35fb871c4f301d85569" +checksum = "121eb464d69f70284fa675f791e8a8fa5539efebb588ba9193ac90998c9c647c" dependencies = [ "polars-arrow", "polars-core", @@ -979,9 +967,9 @@ dependencies = [ [[package]] name = "polars-io" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d7363cd14e4696a28b334a56bd11013ff49cc96064818ab3f91a126e453462d" +checksum = "a48ddf416ae185336c3d7880d2e05b7e55686e3e0da1014e5e7325eff9c7d722" dependencies = [ "ahash", "atoi_simd", @@ -989,6 +977,7 @@ dependencies = [ "chrono", "chrono-tz 0.8.6", "fast-float", + "glob", "home", "itoa", "memchr", @@ -1011,9 +1000,9 @@ dependencies = [ [[package]] name = "polars-json" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "543d7d3853f2c52dbfedee9ebf0d58c4ff3b92aadee5309150b2d14df49d6253" +checksum = "f0a43388585a922524e8bbaa1ed1391c9c4b0768a644585609afa9a2fd5fc702" dependencies = [ "ahash", "chrono", @@ -1033,13 +1022,12 @@ dependencies = [ [[package]] name = "polars-lazy" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03877e74e42b5340ae52ded705f6d5d14563d90554c9177b01b91ed2412a56ed" +checksum = "a514a85df9e7d501c71c96f094861d0608b05a3f533447b1c0ea9cf714162fcb" dependencies = [ "ahash", "bitflags", - "glob", "memchr", "once_cell", "polars-arrow", @@ -1059,10 +1047,11 @@ dependencies = [ [[package]] name = "polars-mem-engine" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea9e17771af750c94bf959885e4b3f5b14149576c62ef3ec1c9ef5827b2a30f" +checksum = "2d057df81b17b4f0ea0e4424ee34f755e6b9ccfba432ecb2fe57dc4da6da2713" dependencies = [ + "memmap2", "polars-arrow", "polars-core", "polars-error", @@ -1077,9 +1066,9 @@ dependencies = [ [[package]] name = "polars-ops" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6066552eb577d43b307027fb38096910b643ffb2c89a21628c7e41caf57848d0" +checksum = "01ba44233249b7937491b5d2bdbf14e4ad534c0a65d06548c3bc418fc3e60791" dependencies = [ "ahash", "argminmax", @@ -1107,12 +1096,13 @@ dependencies = [ [[package]] name = "polars-parquet" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b35b2592a2e7ef7ce9942dc2120dc4576142626c0e661668e4c6b805042e461" +checksum = "bb2993265079ffa07dd16277189444424f8d787b00b01c6f6e001f58bab543ce" dependencies = [ "ahash", "base64", + "bytemuck", "ethnum", "num-traits", "parquet-format-safe", @@ -1126,9 +1116,9 @@ dependencies = [ [[package]] name = "polars-pipe" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021bce7768c330687d735340395a77453aa18dd70d57c184cbb302311e87c1b9" +checksum = "0ccba94c4fa9fded0f41730f7649574c72d6d938a840731c7e4eea4e7ed5cecf" dependencies = [ "crossbeam-channel", "crossbeam-queue", @@ -1152,15 +1142,18 @@ dependencies = [ [[package]] name = "polars-plan" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220d0d7c02d1c4375802b2813dbedcd1a184df39c43b74689e729ede8d5c2921" +checksum = "5d6b29cc53d6c086c09b11050b01c25c28f6a91339036ba1fb1250fcf0d89e74" dependencies = [ "ahash", + "bitflags", "bytemuck", + "chrono", "chrono-tz 0.8.6", "either", "hashbrown", + "memmap2", "once_cell", "percent-encoding", "polars-arrow", @@ -1179,9 +1172,9 @@ dependencies = [ [[package]] name = "polars-row" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1d70d87a2882a64a43b431aea1329cb9a2c4100547c95c417cc426bb82408b3" +checksum = "6e11f43f48466c4b1caa6dc61c381dc10c2d67b87fcb74bc996e21c4f7b0a311" dependencies = [ "bytemuck", "polars-arrow", @@ -1191,9 +1184,9 @@ dependencies = [ [[package]] name = "polars-sql" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6fc1c9b778862f09f4a347f768dfdd3d0ba9957499d306d83c7103e0fa8dc5b" +checksum = "6e9338806e7254618eb819cc632c34b75b71d462222a913f9c1035ed81911ddc" dependencies = [ "hex", "once_cell", @@ -1212,9 +1205,9 @@ dependencies = [ [[package]] name = "polars-time" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "179f98313a15c0bfdbc8cc0f1d3076d08d567485b9952d46439f94fbc3085df5" +checksum = "30a601ab9a62e733b8b560b37642321cb1933faa194864739f6a59d6dfc4d686" dependencies = [ "atoi", "bytemuck", @@ -1233,14 +1226,16 @@ dependencies = [ [[package]] name = "polars-utils" -version = "0.41.3" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e6dd89fcccb1ec1a62f752c9a9f2d482a85e9255153f46efecc617b4996d50" +checksum = "19dd73207bd15efb0ae5c9c3ece3227927ed6a16ad63578acec342378e6bdcb4" dependencies = [ "ahash", "bytemuck", + "bytes", "hashbrown", "indexmap", + "memmap2", "num-traits", "once_cell", "polars-error", @@ -1254,7 +1249,7 @@ dependencies = [ [[package]] name = "polars_xdt" -version = "0.15.1" +version = "0.15.2" dependencies = [ "chrono", "chrono-tz 0.9.0", @@ -1305,15 +1300,15 @@ checksum = "1190fd18ae6ce9e137184f207593877e70f39b015040156b1e05081cdfe3733a" [[package]] name = "pyo3" -version = "0.21.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8" +checksum = "831e8e819a138c36e212f3af3fd9eeffed6bf1510a805af35b0edee5ffa59433" dependencies = [ "cfg-if", "indoc", "libc", "memoffset", - "parking_lot", + "once_cell", "portable-atomic", "pyo3-build-config", "pyo3-ffi", @@ -1323,9 +1318,9 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.21.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" +checksum = "1e8730e591b14492a8945cdff32f089250b05f5accecf74aeddf9e8272ce1fa8" dependencies = [ "once_cell", "target-lexicon", @@ -1333,9 +1328,9 @@ dependencies = [ [[package]] name = "pyo3-ffi" -version = "0.21.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403" +checksum = "5e97e919d2df92eb88ca80a037969f44e5e70356559654962cbb3316d00300c6" dependencies = [ "libc", "pyo3-build-config", @@ -1343,9 +1338,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.21.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c" +checksum = "eb57983022ad41f9e683a599f2fd13c3664d7063a3ac5714cae4b7bee7d3f206" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -1355,11 +1350,11 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.21.2" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c" +checksum = "ec480c0c51ddec81019531705acac51bcdbeae563557c982aa8263bb96880372" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "pyo3-build-config", "quote", @@ -1368,10 +1363,12 @@ dependencies = [ [[package]] name = "pyo3-polars" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "910d4952410bded2d87e13d48ca8e59b7fe028b07d29deaffd4539b3d906e75f" +checksum = "5ffa7f0af4fb0ec561a736c75f4090938dc4c6c01ea235fc70b97fc5512d5688" dependencies = [ + "libc", + "once_cell", "polars", "polars-core", "polars-ffi", @@ -1385,9 +1382,9 @@ dependencies = [ [[package]] name = "pyo3-polars-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b6ee1fa8425af0d3ec588cba614fc2f3fd8e4838fb74f38987e697196884fe" +checksum = "8ec018e2563ba4e42b7311c84b10da132c10a56bf91bd2cddd45ffb985becb9c" dependencies = [ "polars-core", "polars-ffi", @@ -1664,9 +1661,9 @@ dependencies = [ [[package]] name = "sqlparser" -version = "0.47.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "295e9930cd7a97e58ca2a070541a3ca502b17f5d1fa7157376d0fabd85324f25" +checksum = "a4a404d0e14905361b918cb8afdb73605e25c1d5029312bd9785142dcb3aa49e" dependencies = [ "log", ] @@ -1723,7 +1720,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", @@ -1754,15 +1751,14 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.30.12" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "732ffa00f53e6b2af46208fba5718d9662a421049204e156328b66791ffa15ae" +checksum = "d4115055da5f572fff541dd0c4e61b0262977f453cc9fe04be83aba25a89bdab" dependencies = [ - "cfg-if", "core-foundation-sys", "libc", + "memchr", "ntapi", - "once_cell", "windows", ] @@ -1942,11 +1938,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.52.0" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" dependencies = [ - "windows-core", + "windows-core 0.57.0", "windows-targets", ] @@ -1959,6 +1955,49 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-sys" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 58ad7b5..e391d0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polars_xdt" -version = "0.15.2" +version = "0.15.3" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -9,14 +9,14 @@ name = "polars_xdt" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.21.2", features = ["extension-module", "abi3-py38"] } -pyo3-polars = { version = "0.15.0", features = ["derive"] } +pyo3 = { version = "0.22.2", features = ["extension-module", "abi3-py38"] } +pyo3-polars = { version = "0.16.0", features = ["derive"] } serde = { version = "1", features = ["derive"] } chrono = { version = "0.4.38", default-features = false, features = ["std", "unstable-locales"] } chrono-tz = "0.9.0" -polars = { version = "0.41.3", features = ["strings", "timezones"]} -polars-ops = { version = "0.41.3", default-features = false } -polars-arrow = { version = "0.41.3", default-features = false } +polars = { version = "0.42.0", features = ["strings", "timezones"]} +polars-ops = { version = "0.42.0", default-features = false } +polars-arrow = { version = "0.42.0", default-features = false } [target.'cfg(target_os = "linux")'.dependencies] jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] } diff --git a/polars_xdt/functions.py b/polars_xdt/functions.py index ecf0a31..6efcf04 100644 --- a/polars_xdt/functions.py +++ b/polars_xdt/functions.py @@ -16,7 +16,7 @@ if TYPE_CHECKING: from datetime import date - from polars.type_aliases import IntoExpr + from polars_xdt.typing import IntoExpr RollStrategy: TypeAlias = Literal["raise", "forward", "backward"] diff --git a/polars_xdt/typing.py b/polars_xdt/typing.py new file mode 100644 index 0000000..2581250 --- /dev/null +++ b/polars_xdt/typing.py @@ -0,0 +1,15 @@ +from typing import TYPE_CHECKING, Union + +if TYPE_CHECKING: + import sys + + import polars as pl + + if sys.version_info >= (3, 10): + from typing import TypeAlias + else: + from typing_extensions import TypeAlias + from polars.datatypes import DataType, DataTypeClass + + IntoExpr: TypeAlias = Union[pl.Expr, str, pl.Series] + PolarsDataType: TypeAlias = Union[DataType, DataTypeClass] diff --git a/src/expressions.rs b/src/expressions.rs index e9e8b8e..aa9a5fc 100644 --- a/src/expressions.rs +++ b/src/expressions.rs @@ -115,12 +115,8 @@ fn dst_offset(inputs: &[Series]) -> PolarsResult { } } -fn list_idx_dtype(input_fields: &[Field]) -> PolarsResult { - let field = Field::new(input_fields[0].name(), DataType::List(Box::new(IDX_DTYPE))); - Ok(field.clone()) -} - -#[polars_expr(output_type_func=list_idx_dtype)] +// todo: can we make this bigidx-dependent? +#[polars_expr(output_type=UInt32)] fn arg_previous_greater(inputs: &[Series]) -> PolarsResult { let ser = &inputs[0]; match ser.dtype() { diff --git a/src/lib.rs b/src/lib.rs index f7995d7..faa0c37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ mod timezone; mod to_julian; mod utc_offsets; -use pyo3::types::PyModule; +use pyo3::types::{PyModule, PyModuleMethods}; use pyo3::{pymodule, Bound, PyResult}; #[cfg(target_os = "linux")]