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

refactor(python): Remove re-export of data type groups #17073

Merged
merged 7 commits into from
Jun 20, 2024
Merged

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Jun 19, 2024

Changes

  • Move the data type groups to their own module.
  • Remove the re-export data type groups INTEGER_DTYPES, FLOAT_DTYPES, etc. from the top-level and datatypes module
    • These are not really necessary anymore since we have selectors now (e.g. use cs.integer() instead of pl.col(pl.INTEGER_DTYPES)).
    • These were not documented in the API reference so they were not officially public, but we did reference them in a few docstrings. So I added a deprecation warning - which can't really hurt.
  • Define similar groups in the test suite for parametrizing tests. The existing groups are sets and so they are not suitable for parametrizing (unpredictable ordering).
  • Update references to the groups.

@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars labels Jun 19, 2024
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 3 lines in your changes missing coverage. Please review.

Project coverage is 80.86%. Comparing base (235ebee) to head (e734da8).
Report is 1 commits behind head on main.

Files Patch % Lines
py-polars/polars/datatypes/group.py 88.46% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17073      +/-   ##
==========================================
- Coverage   80.86%   80.86%   -0.01%     
==========================================
  Files        1455     1456       +1     
  Lines      191086   191108      +22     
  Branches     2723     2725       +2     
==========================================
+ Hits       154519   154530      +11     
- Misses      36063    36074      +11     
  Partials      504      504              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 8a6bf4b into main Jun 20, 2024
16 checks passed
@ritchie46 ritchie46 deleted the reexports branch June 20, 2024 11:51
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
@s-banach
Copy link
Contributor

So I can still do from polars.datatypes.group import NUMERIC_DTYPES?

@stinodego
Copy link
Member Author

stinodego commented Jun 24, 2024

So I can still do from polars.datatypes.group import NUMERIC_DTYPES?

You can, but don't count on it. These are not meant to be public, and in fact they never really were (not documented in the API reference).

@ion-elgreco
Copy link
Contributor

ion-elgreco commented Jun 24, 2024

Ah this breaks patito on import error :P @stinodego

@c-peters c-peters added the accepted Ready for implementation label Jun 24, 2024
@stinodego
Copy link
Member Author

stinodego commented Jun 24, 2024

Ah this breaks patito on import error :P @stinodego

They were importing directly from the polars.datatypes module then? Perhaps I can also nicely deprecate that path..

As a temporary workaround, they can import from polars.datatypes.group. But really they should update their code to not rely on our data type group definition.

It's expected that some downstream packages will break on a major release. Let's hope everyone manages to upgrade quickly and their code is better for it.

@ion-elgreco
Copy link
Contributor

@stinodego for now indeed it's migrated to .group, see here: JakobGM/patito#74

I understand! Just wanted to make you aware 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation internal An internal refactor or improvement python Related to Python Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants