-
Notifications
You must be signed in to change notification settings - Fork 242
Format Python code with ruff format #790
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
Conversation
.github/workflows/main.yml
Outdated
python3 -m pip install pycodestyle | ||
export PATH=$PATH:$HOME/.local/bin | ||
pycodestyle examples/* | ||
pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with 100.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for 88 (not 100) was explained in that URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I used to be strongly in favor of 80 but it does make it awkward when you want to have variable names that actually explain what they are instead of acronyms or abbreviations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the simple examples, I'm just going to leave it at the default pycodestyle 79 for now.
.github/workflows/main.yml
Outdated
python3 -m pip install pycodestyle | ||
export PATH=$PATH:$HOME/.local/bin | ||
pycodestyle examples/* | ||
pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with 100.
class OrbitYawBehavior(Enum): | ||
""" | ||
Yaw behaviour during orbit flight. | ||
Yaw behaviour during orbit flight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-generated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please read the commit message.
ruff format
should be added to code generation processes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, feel free to do that. It's right here:
https://github.com/mavlink/MAVSDK-Python/blob/main/other/tools/run_protoc.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
d747918
to
dcde9cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, let me get this in and add in the other PRs on top of it.
.github/workflows/main.yml
Outdated
python3 -m pip install pycodestyle | ||
export PATH=$PATH:$HOME/.local/bin | ||
pycodestyle examples/* | ||
pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I used to be strongly in favor of 80 but it does make it awkward when you want to have variable names that actually explain what they are instead of acronyms or abbreviations.
other/tools/run_protoc.sh
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add the dependency to https://github.com/mavlink/MAVSDK-Python/blob/main/requirements-dev.txt. I'll add a commit.
.github/workflows/main.yml
Outdated
python3 -m pip install pycodestyle | ||
export PATH=$PATH:$HOME/.local/bin | ||
pycodestyle examples/* | ||
pycodestyle --max-line-length=88 examples/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the simple examples, I'm just going to leave it at the default pycodestyle 79 for now.
class OrbitYawBehavior(Enum): | ||
""" | ||
Yaw behaviour during orbit flight. | ||
Yaw behaviour during orbit flight. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
%
ruff format
# https://docs.astral.sh/ruff/formatterImprove readability while removing 2,961 unnecessary lines.
ruff format
should be added to code generation processes.