Hello. Have you thought about using linter and tests for python? For example flake8 and pytest. Right now some modules of the project are very hard to read, ran flake8 to look and got hundreds of errors. The more the project grows, the harder it will be to implement linter and tests. You could also use Tox to test on different versions of python. I am willing to help with this issue.
I don’t exactly understand your post. I have no clue, what “Python linter” is, but it sounds interesting.
I did a quick www check and have the impression it is a Microsoft thing.
I think the
is koconnor (main developer)
and I think he uses Linux.
linter helps to detect errors, make code readable, adhere to PEP8 rules. it can be implemented in Actions, so that all code is checked for the same style. there are plugins for IDEs that help, e.g. for VSCode there is ms-python.flake8 plugin (Flake8 - Visual Studio Marketplace).
Are you coding under Linux or Microsoft?
The issue is, being open source it’s written by a bunch of different people with different styles. It’s hard to force “style guidelines” on people who are programming on their own time for free.
That being said, I agree that some of the code is hard to read.
That’s a problem with all software development, what’s “clear” to one person is never clear to others.
Relevant section though:
https://www.klipper3d.org/CONTRIBUTING.html
Klipper does not implement a strict “coding style guide”, but modifications to existing code should follow the high-level code flow, code indentation style, and format of that existing code. Submissions of new modules and systems have more flexibility in coding style, but it is preferable for that new code to follow an internally consistent style and to generally follow industry wide coding norms.
Kevin would be the final word on that, he maintains the actual codebase
I am a python developer. I write code for Linux and Windows.
Totally agree with you, but PEP8 is considered a foundation for python at least for contributors to add blank lines for readability between functions. Basically, if no one objects to this on commits by sticking to linter, that’s fine.
I’m also interested in adding tests when adding code so I can test regression in the future. If I do a PR and make tests, would that be ok?
These are all questions for Kevin, who regularly checks the discussions here.
Kevin is the owner of the core code and the decision maker for any changes that affect it.
I agree that a minimal style guide would be good, PEP8 or whatever but for some consistency and readability yes please.
As for tests I have thought about this but a lot of stuff is hard to actually test even more so if code sometimes is not written with unit tests in mind.
As for python versions sure, as an example current requirements miss a dependency for Python 3.12, setuptools is no longer installed on venv by default and that breaks with CAN. (I have a PR submitted but not merged and I wonder if it ever will)