Skip to content

Commit 9d052df

Browse files
authored
Add support for polars 0.19 (#22)
* Add support for polars 0.19 * bump version * fix tests for 0.19 * update readme
1 parent 6cf7109 commit 9d052df

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.16' }
2727
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.17' }
2828
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.18' }
29+
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.19' }
2930
- { PYTHON_VERSION: 'python=3.10', POLARS_VERSION: '' }
3031
- { PYTHON_VERSION: 'python=3.11', POLARS_VERSION: '' }
3132
steps:

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,17 @@ To get a more detailed understanding of what's happening under the hood, check o
170170
### conda
171171

172172
```bash
173-
$ conda install -c conda-forge polarify
173+
conda install -c conda-forge polarify
174174
# or micromamba
175-
$ micromamba install -c conda-forge polarify
175+
micromamba install -c conda-forge polarify
176176
# or pixi
177-
$ pixi add polarify
177+
pixi add polarify
178178
```
179179

180180
### pip
181181

182182
```bash
183-
$ pip install polarify
183+
pip install polarify
184184
```
185185

186186
## ⚠️ Limitations
@@ -211,8 +211,8 @@ TODO: Add some benchmarks
211211

212212
## 📥 Development installation
213213

214-
```
215-
$ pixi install
216-
$ pixi run postinstall
217-
$ pixi run test
214+
```bash
215+
pixi install
216+
pixi run postinstall
217+
pixi run test
218218
```

pixi.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/prefix-dev/pixi/issues/79
33
[project]
44
name = "polarify"
5-
version = "0.1.2"
5+
version = "0.1.3"
66
description = "Simplifying conditional Polars Expressions with Python 🐍 🐻‍❄️"
77
authors = ["Bela Stoyan <[email protected]>", "Pavel Zwerschke <[email protected]>"]
88
channels = ["conda-forge"]
@@ -16,7 +16,7 @@ lint = "pre-commit run --all"
1616
[dependencies]
1717
python = ">=3.9"
1818
pip = "*"
19-
polars = ">=0.14.24,<0.19"
19+
polars = ">=0.14.24,<0.20"
2020
# build
2121
hatchling = "*"
2222
# test

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
55
[project]
66
name = "polarify"
77
description = "Simplifying conditional Polars Expressions with Python 🐍 🐻‍❄️"
8-
version = "0.1.2"
8+
version = "0.1.3"
99
readme = "README.md"
1010
license = "MIT"
1111
requires-python = ">=3.9"
@@ -20,7 +20,7 @@ classifiers = [
2020
"Programming Language :: Python :: 3.11",
2121
]
2222
dependencies = [
23-
"polars >=0.14.24,<0.19",
23+
"polars >=0.14.24,<0.20",
2424
]
2525

2626
[project.urls]

tests/test_parse_body.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,16 @@ def test_funcs(request):
5050
def test_transform_function(df: polars.DataFrame, test_funcs):
5151
x = polars.col("x")
5252
transformed_func, original_func = test_funcs
53+
54+
if pl_version < Version("0.19.0"):
55+
df_with_transformed_func = df.select(transformed_func(x).alias("apply"))
56+
df_with_applied_func = df.apply(lambda r: original_func(r[0]))
57+
else:
58+
df_with_transformed_func = df.select(transformed_func(x).alias("map"))
59+
df_with_applied_func = df.map_rows(lambda r: original_func(r[0]))
60+
5361
assert_frame_equal(
54-
df.select(transformed_func(x).alias("apply")),
55-
df.apply(lambda r: original_func(r[0])),
62+
df_with_transformed_func,
63+
df_with_applied_func,
5664
check_dtype=False,
5765
)

0 commit comments

Comments
 (0)