Skip to content

[WIP] styles: Update style guide - #15507

Closed
phlax wants to merge 2 commits into
envoyproxy:mainfrom
phlax:py-style-guide
Closed

phlax wants to merge 2 commits into
envoyproxy:mainfrom
phlax:py-style-guide

Conversation

@phlax

@phlax phlax commented Mar 16, 2021 •

Copy link
Copy Markdown
Member

Signed-off-by: Ryan Northey [email protected]

Commit Message: styles: Update style guide
Additional Description:

i have changed the focus of this as we will also need to update info for:

  • yaml
  • general linting
  • rst - including embedded in protos etc

Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue] Partial fix for #15403 , ref #15479
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Ryan Northey <[email protected]>
@htuch htuch self-assigned this Mar 16, 2021
Comment thread STYLE.md

## linting

All python code is linted using flake8

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

add some instructions with/out bazel pointing to config file

@phlax

phlax commented Mar 16, 2021 •

Copy link
Copy Markdown
Member Author

im thinking about other possible style hints we might want - prefer f"{strings}" is one that comes to mind

@phlax

phlax commented Mar 16, 2021

Copy link
Copy Markdown
Member Author

re mypy the biggest issue that it introduces is py version.

we are currently pegged to >=3.8

more recent versions of python - esp 3.9 have increasingly better lang-level support for some of the type hinting

older versions of python require use of the typing lib

Comment thread STYLE.md

```

In this example the line split occurs before the `and` and `or` which are placed at the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will this be lintable? I'd like this not to be a subject of code reviews :) FWIW this is the kind of thing that clang-format does well at.

Comment thread STYLE.md

## pep8

All python code should meet the pep8/pycodestyle standard.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add links.

@htuch

htuch commented Mar 17, 2021

Copy link
Copy Markdown
Member

@phlax I like the idea of preferring f-strings (and other Python 3+ isms).

@phlax
phlax marked this pull request as draft March 31, 2021 09:33
@phlax phlax changed the title [WIP] python: Update python style guide [WIP] styles: Update style guide Mar 31, 2021
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions Bot added the stale stalebot believes this issue/PR has not been touched recently label Apr 30, 2021
@phlax phlax added no stalebot Disables stalebot from closing an issue and removed stale stalebot believes this issue/PR has not been touched recently labels Apr 30, 2021
@alyssawilk alyssawilk closed this Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no stalebot Disables stalebot from closing an issue waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants