Skip to content

Commit

Permalink
Add support for polars 0.19 (#22)
Browse files Browse the repository at this point in the history
* Add support for polars 0.19

* bump version

* fix tests for 0.19

* update readme
  • Loading branch information
pavelzw authored Aug 31, 2023
1 parent 6cf7109 commit 9d052df
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.16' }
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.17' }
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.18' }
- { PYTHON_VERSION: 'python=3.9', POLARS_VERSION: 'polars=0.19' }
- { PYTHON_VERSION: 'python=3.10', POLARS_VERSION: '' }
- { PYTHON_VERSION: 'python=3.11', POLARS_VERSION: '' }
steps:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,17 @@ To get a more detailed understanding of what's happening under the hood, check o
### conda

```bash
$ conda install -c conda-forge polarify
conda install -c conda-forge polarify
# or micromamba
$ micromamba install -c conda-forge polarify
micromamba install -c conda-forge polarify
# or pixi
$ pixi add polarify
pixi add polarify
```

### pip

```bash
$ pip install polarify
pip install polarify
```

## ⚠️ Limitations
Expand Down Expand Up @@ -211,8 +211,8 @@ TODO: Add some benchmarks

## 📥 Development installation

```
$ pixi install
$ pixi run postinstall
$ pixi run test
```bash
pixi install
pixi run postinstall
pixi run test
```
4 changes: 2 additions & 2 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/prefix-dev/pixi/issues/79
[project]
name = "polarify"
version = "0.1.2"
version = "0.1.3"
description = "Simplifying conditional Polars Expressions with Python 🐍 🐻‍❄️"
authors = ["Bela Stoyan <[email protected]>", "Pavel Zwerschke <[email protected]>"]
channels = ["conda-forge"]
Expand All @@ -16,7 +16,7 @@ lint = "pre-commit run --all"
[dependencies]
python = ">=3.9"
pip = "*"
polars = ">=0.14.24,<0.19"
polars = ">=0.14.24,<0.20"
# build
hatchling = "*"
# test
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "polarify"
description = "Simplifying conditional Polars Expressions with Python 🐍 🐻‍❄️"
version = "0.1.2"
version = "0.1.3"
readme = "README.md"
license = "MIT"
requires-python = ">=3.9"
Expand All @@ -20,7 +20,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"polars >=0.14.24,<0.19",
"polars >=0.14.24,<0.20",
]

[project.urls]
Expand Down
12 changes: 10 additions & 2 deletions tests/test_parse_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ def test_funcs(request):
def test_transform_function(df: polars.DataFrame, test_funcs):
x = polars.col("x")
transformed_func, original_func = test_funcs

if pl_version < Version("0.19.0"):
df_with_transformed_func = df.select(transformed_func(x).alias("apply"))
df_with_applied_func = df.apply(lambda r: original_func(r[0]))
else:
df_with_transformed_func = df.select(transformed_func(x).alias("map"))
df_with_applied_func = df.map_rows(lambda r: original_func(r[0]))

assert_frame_equal(
df.select(transformed_func(x).alias("apply")),
df.apply(lambda r: original_func(r[0])),
df_with_transformed_func,
df_with_applied_func,
check_dtype=False,
)

0 comments on commit 9d052df

Please sign in to comment.