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

Add pyupgrade #4369

Merged
merged 4 commits into from
Aug 12, 2022
Merged

Add pyupgrade #4369

merged 4 commits into from
Aug 12, 2022

Conversation

stinodego
Copy link
Member

@stinodego stinodego commented Aug 11, 2022

Relates to #4044

I made a PR recently where I used pyupgrade to upgrade the type hints and some other small things. Now I am adding it to the CI to make sure we stay compliant (a few 'old' language features already snuck in in the meantime...).

Changes:

  • Added pyupgrade - Makes sure to use that we're using the latest language features.
    • Added to CI
    • Added to make pre-commit command
  • Ran pyupgrade
  • Moved Expr.list to the bottom of the class definition, in order not to confuse mypy

@github-actions github-actions bot added the python Related to Python Polars label Aug 11, 2022
@stinodego stinodego marked this pull request as draft August 11, 2022 20:45
@stinodego stinodego marked this pull request as ready for review August 11, 2022 22:19
@ritchie46
Copy link
Member

Looks good to me. So that would mean we should run python 3.7 locally right?

@stinodego
Copy link
Member Author

stinodego commented Aug 12, 2022

Looks good to me. So that would mean we should run python 3.7 locally right?

No reason to run Python 3.7 locally - it's just making sure you are no longer using language features that have a better alternative in Python version 3.7 or earlier.

For example, f-strings became available in Python 3.6. If you're using an older way of formatting strings (e.g. percentage sign or .format()), it will be upgraded to an f-string. This is safe, because our package depends on Python 3.7 or higher.

I run Python 3.10 myself 😄

@ritchie46
Copy link
Member

Right.. great addition then! :)

@ritchie46 ritchie46 merged commit 891cf7b into pola-rs:master Aug 12, 2022
@stinodego stinodego deleted the pyupgrade branch August 30, 2022 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants