ion-elgreco / polars-hash

Polars plugin for stable hashing functionality
MIT License
51 stars 4 forks source link

raises with latest Polars due to private import #19

Closed MarcoGorelli closed 6 months ago

MarcoGorelli commented 6 months ago
import polars
import polars_hash as plh

df = pl.DataFrame({
    "foo":["hello_world"]
})

result = df.select(plh.col('foo').chash.sha256())

print(result)
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 2
      1 import polars
----> 2 import polars_hash as plh
      4 df = pl.DataFrame({
      5     "foo":["hello_world"]
      6 })
      8 result = df.select(plh.col('foo').chash.sha256())

File ~/scratch/.venv/lib/python3.11/site-packages/polars_hash/__init__.py:8
      6 import polars as pl
      7 from polars.type_aliases import IntoExpr, PolarsDataType
----> 8 from polars.utils._parse_expr_input import parse_as_expression
      9 from polars.utils._wrap import wrap_expr
     10 from polars.utils.udfs import _get_shared_lib_location

ModuleNotFoundError: No module named 'polars.utils._parse_expr_input'
MarcoGorelli commented 6 months ago

I'd suggest just copying parse_into_expr from https://github.com/MarcoGorelli/cookiecutter-polars-plugins/blob/main/%7B%7B%20cookiecutter.project_slug%20%7D%7D/%7B%7B%20cookiecutter.project_slug%20%7D%7D/utils.py into a utils.py file, which only uses public methods and so hopefully should stay stable

ion-elgreco commented 6 months ago

From which version did this happen?

I'll try to see if I can find some time tonight to put in a fix

MarcoGorelli commented 6 months ago

since 0.20.14

I can make a PR later today - I'm using this in a project so I can justify a little time to fix up a required dependency

ion-elgreco commented 6 months ago

@MarcoGorelli that would be nice :)