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

[v2.5] Backport use of the black and isort formatters #4534

Merged
merged 10 commits into from
Sep 22, 2022

Conversation

LukeShu
Copy link
Contributor

@LukeShu LukeShu commented Sep 21, 2022

Description

The main changes in this PR are backporting #4313 (black) and #4315 (isort); but to support that, it also backports #4294 and a commit from #4288.

Backporting use of the Python code formatters should remove a lot of friction when copying changes between 2.x and 3.x.

Related Issues

(none)

Testing

(none)

Checklist

  • I made sure to update CHANGELOG.md. - no applicable changes

    Remember, the CHANGELOG needs to mention:

    • Any new features
    • Any changes to our included version of Envoy
    • Any non-backward-compatible changes
    • Any deprecations
  • This is unlikely to impact how Ambassador performs at scale.

    Remember, things that might have an impact at scale include:

    • Any significant changes in memory use that might require adjusting the memory limits
    • Any significant changes in CPU use that might require adjusting the CPU limits
    • Anything that might change how many replicas users should use
    • Changes that impact data-plane latency/scalability
  • My change is adequately tested.

    Remember when considering testing:

    • Your change needs to be specifically covered by tests.
      • Tests need to cover all the states where your change is relevant: for example, if you add a behavior that can be enabled or disabled, you'll need tests that cover the enabled case and tests that cover the disabled case. It's not sufficient just to test with the behavior enabled.
    • You also need to make sure that the entire area being changed has adequate test coverage.
      • If existing tests don't actually cover the entire area being changed, add tests.
      • This applies even for aspects of the area that you're not changing – check the test coverage, and improve it if needed!
    • We should lean on the bulk of code being covered by unit tests, but...
    • ... an end-to-end test should cover the integration points
  • I updated DEVELOPING.md with any any special dev tricks I had to use to work on this code efficiently.

  • The changes in this PR have been reviewed for security concerns and adherence to security best practices.

Its only about ~5 seconds on my laptop with an empty cache.  The
complexity of dmypy to speed things up isn't worth it.

Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit 9b2ddeb)
Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit 6a09797)
This is essentially so that 'black' and 'isort' in the coming commits
don't mess up its grouping.

Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit 16ade52)
Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit f51e009)
Black has been the standard Python formatter for a couple of years
now.  Use it the way we use gofmt.

Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit ab9d109)
Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit e110ebf)
isort organizes your imports.  It's the "goimports" to black's
"gofmt".

Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit cdc05e8)
Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit 00aba7d)
@LukeShu LukeShu changed the base branch from master to release/v2.5 September 21, 2022 17:47
Signed-off-by: Luke Shumaker <[email protected]>
(cherry picked from commit 98b84e3)
@LukeShu LukeShu marked this pull request as ready for review September 21, 2022 18:17
LanceEa
LanceEa previously approved these changes Sep 21, 2022
Copy link
Contributor

@LanceEa LanceEa left a comment

Choose a reason for hiding this comment

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

lgtm

@LukeShu
Copy link
Contributor Author

LukeShu commented Sep 21, 2022

Resolved a merge conflict in envoy_stats.py.

Copy link
Member

@Alice-Lilith Alice-Lilith left a comment

Choose a reason for hiding this comment

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

Thanks for backporting this! 👨‍🍳

@LukeShu LukeShu requested a review from LanceEa September 22, 2022 14:35
@LukeShu LukeShu merged commit ef6cb5f into release/v2.5 Sep 22, 2022
@LukeShu LukeShu deleted the lukeshu/v2.5-black branch September 22, 2022 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants