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

Use PyUpgrade to use Python 3.6 features #11447

Merged
merged 2 commits into from
Nov 3, 2020

Conversation

kaxil
Copy link
Member

@kaxil kaxil commented Oct 11, 2020

Use features like f-strings instead of format across the code-base.

More details: https://github.com/asottile/pyupgrade

Features:

  • Set literals
  • Dictionary comprehensions
  • printf-style string formatting
  • Unicode literals
  • Invalid escape sequences
  • .encode() to bytes literals
  • super() calls
  • "new style" classes
  • # coding: ... comment
  • Remove unnecessary py3-compat imports
  • rewrite mock imports
  • if PY2 blocks
  • remove six compatibility code
  • open alias
  • OSError aliases
  • typing.NamedTuple / typing.TypedDict py36+ syntax
  • remove parentheses from @functools.lru_cache()
  • f-strings

^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@kaxil kaxil requested a review from turbaszek October 11, 2020 22:11
@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:CLI area:dev-tools area:Scheduler including HA (high availability) scheduler area:webserver Webserver related Issues k8s labels Oct 11, 2020
@kaxil
Copy link
Member Author

kaxil commented Oct 11, 2020

@turbaszek Since backport packages are Python 3.6+ too, so upgrading them is fine too, right?

@turbaszek
Copy link
Member

@turbaszek Since backport packages are Python 3.6+ too, so upgrading them is fine too, right?

Yes, but I'm afraid this change may cause a lot of merge conflict with currently open PRs. I think we should wait with it for 2.0-alpha, probably apply it at the same moment as black

@kaxil
Copy link
Member Author

kaxil commented Oct 11, 2020

@turbaszek Since backport packages are Python 3.6+ too, so upgrading them is fine too, right?

Yes, but I'm afraid this change may cause a lot of merge conflict with currently open PRs. I think we should wait with it for 2.0-alpha, probably apply it at the same moment as black

Yup, this PR can wait :)

@kaxil
Copy link
Member Author

kaxil commented Oct 30, 2020

Rebased, so that we can merge it before beta1

@github-actions
Copy link

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@kaxil kaxil added the full tests needed We need to run full set of tests for this PR to merge label Oct 30, 2020
@github-actions
Copy link

github-actions bot commented Nov 3, 2020

The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.

@kaxil
Copy link
Member Author

kaxil commented Nov 3, 2020

@turbaszek @XD-DENG This is ready for review, as soon as this is merged. I will quickly rebase and make #9550 pass the test too

@kaxil kaxil requested a review from ashb November 3, 2020 20:47
@@ -177,6 +177,11 @@ repos:
- id: fix-encoding-pragma
args:
- --remove
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

A minor question: shall we use the latest v2.7.3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, will update

Use features like `f-strings` instead of format across the code-base.

More details: https://github.com/asottile/pyupgrade
@kaxil kaxil merged commit 8c42cf1 into apache:master Nov 3, 2020
@kaxil kaxil deleted the pyupgrade-py36 branch November 3, 2020 21:54
potiuk added a commit that referenced this pull request Nov 15, 2020
Use features like `f-strings` instead of format across the code-base.
More details: https://github.com/asottile/pyupgrade
 (cherry-picked from commit 8c42cf1)
potiuk added a commit that referenced this pull request Nov 16, 2020
Use features like `f-strings` instead of format across the code-base.
More details: https://github.com/asottile/pyupgrade
 (cherry-picked from commit 8c42cf1)
potiuk added a commit that referenced this pull request Nov 16, 2020
Use features like `f-strings` instead of format across the code-base.
More details: https://github.com/asottile/pyupgrade
 (cherry-picked from commit 8c42cf1)
@kaxil kaxil removed this from the Airflow 1.10.13 milestone Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:CLI area:dev-tools area:Scheduler including HA (high availability) scheduler area:webserver Webserver related Issues full tests needed We need to run full set of tests for this PR to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants