Skip to content

Commit 3fdda43

Browse files
Bidek56dchrostowski
andauthored
Upgrading to rs-0.46 (#309)
Upgrading: - Pola.rs -> 0.46.0 - toolchain -> nightly-2025-01-05 - Yarn -> 4.7.0 - TS -> 5.8.2 Serialization has been changed in core RS by this [PR](pola-rs/polars#20641) Adding new to_json func due to the serialization change in core RS. --------- Co-authored-by: dchrostowski <[email protected]>
1 parent 3336d08 commit 3fdda43

30 files changed

+1183
-1135
lines changed

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install latest Rust nightly
1515
uses: dtolnay/rust-toolchain@stable
1616
with:
17-
toolchain: nightly-2024-11-28
17+
toolchain: nightly-2025-01-05
1818
components: rustfmt, clippy
1919
- name: Install ghp-import
2020
uses: actions/setup-python@v5

.github/workflows/test-js.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install latest Rust nightly
2121
uses: dtolnay/rust-toolchain@stable
2222
with:
23-
toolchain: nightly-2024-11-28
23+
toolchain: nightly-2025-01-05
2424
components: rustfmt, clippy
2525
- name: Check yarn version
2626
run: yarn --version
@@ -46,7 +46,7 @@ jobs:
4646
- name: Install latest Rust nightly
4747
uses: dtolnay/rust-toolchain@stable
4848
with:
49-
toolchain: nightly-2024-11-28
49+
toolchain: nightly-2025-01-05
5050
components: rustfmt, clippy
5151
- name: Bun version
5252
uses: oven-sh/setup-bun@v1

.yarn/releases/yarn-4.5.3.cjs

Lines changed: 0 additions & 934 deletions
This file was deleted.

.yarn/releases/yarn-4.9.1.cjs

Lines changed: 948 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7-
yarnPath: .yarn/releases/yarn-4.5.3.cjs
7+
yarnPath: .yarn/releases/yarn-4.9.1.cjs

Cargo.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ crate-type = ["cdylib", "lib"]
1515
[dependencies]
1616
ahash = "0.8.11"
1717
bincode = "1.3.3"
18-
napi = { version = "2.16.13", default-features = false, features = [
18+
napi = { version = "2.16.16", default-features = false, features = [
1919
"napi8",
2020
"serde-json",
2121
] }
2222
napi-derive = { version = "2.16.13", default-features = false }
23-
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "58a38af21dccaf3326514494a1db118601c8c2ca", default-features = false }
24-
polars-io = { git = "https://github.com/pola-rs/polars.git", rev = "58a38af21dccaf3326514494a1db118601c8c2ca", default-features = false }
25-
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "58a38af21dccaf3326514494a1db118601c8c2ca", default-features = false }
23+
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "f298ace880b238fb5793eaf0cdeb6b418e2ba583", default-features = false }
24+
polars-io = { git = "https://github.com/pola-rs/polars.git", rev = "f298ace880b238fb5793eaf0cdeb6b418e2ba583", default-features = false }
25+
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "f298ace880b238fb5793eaf0cdeb6b418e2ba583", default-features = false }
26+
polars-ops = { git = "https://github.com/pola-rs/polars.git", rev = "f298ace880b238fb5793eaf0cdeb6b418e2ba583", default-features = false }
27+
polars-arrow = { git = "https://github.com/pola-rs/polars.git", rev = "f298ace880b238fb5793eaf0cdeb6b418e2ba583", default-features = false }
2628
thiserror = "1"
2729
smartstring = { version = "1" }
2830
serde_json = { version = "1" }
@@ -162,10 +164,10 @@ features = [
162164
"azure"
163165
]
164166
git = "https://github.com/pola-rs/polars.git"
165-
rev = "58a38af21dccaf3326514494a1db118601c8c2ca"
167+
rev = "f298ace880b238fb5793eaf0cdeb6b418e2ba583"
166168

167169
[build-dependencies]
168-
napi-build = "2.1.3"
170+
napi-build = "2.1.4"
169171

170172
[profile.release]
171173
codegen-units = 1

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,14 @@ Install the latest polars version with:
121121
```sh
122122
$ yarn add nodejs-polars # yarn
123123
$ npm i -s nodejs-polars # npm
124+
$ bun i -D nodejs-polars # Bun
124125
```
125126

126127
Releases happen quite often (weekly / every few days) at the moment, so updating polars regularly to get the latest bugfixes / features might not be a bad idea.
127128

128129
### Minimum Requirements
129130
- Node version `>=18`
130-
- Rust version `>=1.59` - *Only needed for development*
131+
- Rust version `>=1.86` - *Only needed for development*
131132

132133

133134
## Deno
@@ -142,7 +143,7 @@ With Deno 1.37, you can use the `display` function to display a `DataFrame` in t
142143

143144
```typescript
144145
import pl from "npm:nodejs-polars";
145-
import { display } from "https://deno.land/x/[email protected].1/mod.ts";
146+
import { display } from "https://deno.land/x/[email protected].2/mod.ts";
146147

147148
let response = await fetch(
148149
"https://cdn.jsdelivr.net/npm/world-atlas@1/world/110m.tsv",
@@ -171,24 +172,22 @@ ___
171172

172173
## Documentation
173174

174-
Want to know about all the features Polars supports? Read the docs!
175+
Want to know about all the features Polars supports? Read the [docs](https://docs.pola.rs)!
175176

176177
#### Python
177178

178179
- Installation guide: `$ pip3 install polars`
179180
- [Python documentation](https://pola-rs.github.io/polars/py-polars/html/reference/index.html)
180-
- [User guide](https://pola-rs.github.io/polars-book/)
181+
- [User guide](https://docs.pola.rs)
181182

182183
#### Rust
183184

184-
- [Rust documentation (master branch)](https://pola-rs.github.io/polars/polars/index.html)
185-
- [User guide](https://pola-rs.github.io/polars-book/)
185+
- [Rust documentation](https://docs.rs/polars/latest/polars/)
186186

187187
#### Node
188188

189189
* Installation guide: `$ yarn install nodejs-polars`
190190
* [Node documentation](https://pola-rs.github.io/nodejs-polars/)
191-
* [User guide](https://pola-rs.github.io/polars-book/)
192191

193192
## Contribution
194193

__tests__/dataframe.test.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("dataframe", () => {
4444
const actual = expected.clone();
4545
expect(actual).toFrameEqual(expected);
4646
});
47-
test.skip("describe", () => {
47+
test("describe", () => {
4848
const actual = pl
4949
.DataFrame({
5050
a: [1, 2, 3],
@@ -1936,30 +1936,6 @@ describe("io", () => {
19361936
fs.rmSync("./test.csv");
19371937
done();
19381938
});
1939-
test("JSON.stringify", () => {
1940-
const df = pl.DataFrame({
1941-
foo: [1],
1942-
bar: ["a"],
1943-
});
1944-
const expected = JSON.stringify({
1945-
columns: [
1946-
{
1947-
name: "foo",
1948-
datatype: "Float64",
1949-
bit_settings: "",
1950-
values: [1.0],
1951-
},
1952-
{
1953-
name: "bar",
1954-
datatype: "String",
1955-
bit_settings: "",
1956-
values: ["a"],
1957-
},
1958-
],
1959-
});
1960-
const actual = JSON.stringify(df);
1961-
expect(actual).toEqual(expected);
1962-
});
19631939
test("toRecords", () => {
19641940
const df = pl.DataFrame({
19651941
foo: [1],

__tests__/groupby.test.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ describe("groupby ops", () => {
191191
by: ["admin", "five_type", "actor"],
192192
indexColumn: "event_date",
193193
every: "1mo",
194-
start_by: "datapoint",
194+
startBy: "datapoint",
195+
label: "datapoint",
195196
})
196197
.agg(pl.col("adm1_code").unique(), pl.col("fatalities").gt(0).sum());
197198
const expected = [
@@ -220,7 +221,8 @@ describe("groupby ops", () => {
220221
indexColumn: "event_date",
221222
every: "1mo",
222223
by: ["admin", "five_type", "actor"],
223-
start_by: "datapoint",
224+
label: "datapoint",
225+
startBy: "datapoint",
224226
})
225227
.agg(pl.col("adm1_code").unique(), pl.col("fatalities").gt(0).sum());
226228
const expected = [
@@ -231,6 +233,24 @@ describe("groupby ops", () => {
231233
const actual = out.getColumn("event_date").toArray();
232234
expect(actual).toEqual(expected);
233235
});
236+
test("dynamic-int", () => {
237+
const out = pl
238+
.DataFrame({
239+
a: pl.Series("", [1, 2, 3], pl.Int64),
240+
})
241+
.groupByDynamic({
242+
indexColumn: "a",
243+
label: "right",
244+
every: "1i",
245+
period: "2i",
246+
closed: "right",
247+
startBy: "datapoint",
248+
})
249+
.agg(pl.col("a").list().alias("lst"));
250+
const actual = out.getColumn("lst").toArray();
251+
const expected = [[2, 3], [3]];
252+
expect(actual).toEqual(expected);
253+
});
234254
test("default negative every offset dynamic groupby", () => {
235255
const dates = [
236256
new Date("2023-01-01"),
@@ -243,14 +263,12 @@ describe("groupby ops", () => {
243263
dt: dates,
244264
idx: Array.from({ length: dates.length }, (_v, k) => k),
245265
})
246-
.sort("dt");
266+
.sort({ by: "dt" });
247267
const actual = df
248268
.groupByDynamic({
249269
indexColumn: "dt",
250270
every: "1mo",
251-
closed: "right",
252-
start_by: "datapoint",
253-
check_sorted: true,
271+
startBy: "datapoint",
254272
})
255273
.agg(pl.col("idx"));
256274
const expected = pl.DataFrame({

__tests__/lazyframe.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("lazyframe", () => {
4444
})
4545
.lazy();
4646
let actual = df.describeOptimizedPlan().replace(/\s+/g, " ");
47-
const expected = `DF ["foo", "bar"]; PROJECT */2 COLUMNS; SELECTION: None`;
47+
const expected = `DF ["foo", "bar"]; PROJECT */2 COLUMNS`;
4848
expect(actual).toEqual(expected);
4949
actual = df.describePlan().replace(/\s+/g, " ");
5050
expect(actual).toEqual(expected);

0 commit comments

Comments
 (0)