Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Replace deprecated zero_copy_only argument with allow_copy #222

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

khrapovs
Copy link
Contributor

@khrapovs khrapovs commented Jun 6, 2024

What does this implement/fix? Explain your changes.

Replace deprecated zero_copy_only argument with allow_copy (https://docs.pola.rs/py-polars/html/reference/series/api/polars.Series.to_numpy.html). For example, I get this warning:

DeprecationWarning: The `zero_copy_only` parameter for `Series.to_numpy` is deprecated. Use the `allow_copy` parameter instead, which is the inverse of `zero_copy_only`.
fft = np.fft.rfft(x.to_numpy(zero_copy_only=True))

Copy link

vercel bot commented Jun 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
functime-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 7, 2024 7:21am

@baggiponte
Copy link
Collaborator

Ciao @khrapovs, thank you for this PR! 😊

I noticed GH says there are conflicts with the main branch: would you mind reviewing them?

Also, I could not keep up with Polars versioning and API changes, so for the moment we are stuck with essentially >=20.0.7 (if not == 😥). What Polars version are you using?

…-zero_copy_only

# Conflicts:
#	functime/feature_extractors.py
@khrapovs
Copy link
Contributor Author

khrapovs commented Jun 7, 2024

I noticed GH says there are conflicts with the main branch: would you mind reviewing them?

Apologies, clicked the wrong button. The branch is now up-to-date.

Also, I could not keep up with Polars versioning and API changes, so for the moment we are stuck with essentially >=20.0.7 (if not == 😥). What Polars version are you using?

In my own project polars==0.20.31.

@baggiponte
Copy link
Collaborator

I noticed GH says there are conflicts with the main branch: would you mind reviewing them?

Apologies, clicked the wrong button. The branch is now up-to-date.

Thanks!

Also, I could not keep up with Polars versioning and API changes, so for the moment we are stuck with essentially >=20.0.7 (if not == 😥). What Polars version are you using?

In my own project polars==0.20.31.

Uh that's what I was suspecting. Unfortunately, we can't just merge this immediately (and have some parts of the codebase supporting Polars>=0.20.31 and some other >=0.20.7).

I'm working on conformal predictions right now but of course supporting the latest Polars is my goal. I'll keep this PR when we are working on this (pretty substantial) effort (which is going to happen very soon).

Issue is #159. Anyone is free to add a checklist of stuff to do!

@baggiponte baggiponte added the build Build system and dependencies label Jun 9, 2024
@baggiponte baggiponte added this to the 0.10 milestone Jun 9, 2024
@khrapovs
Copy link
Contributor Author

This problem can be solved by something along these lines:

if polars.version < X:
  ...to_numpy(zero_copy_only=True)...
else:
  ...to_numpy(allow_copy=False)...

But would anyone tolerate this ugliness in the codebase? Even if it is temporary until the lower requirement for polars is risen until X?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build system and dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants