-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add ruff #3
base: main
Are you sure you want to change the base?
Conversation
@@ -103,7 +103,9 @@ jobs: | |||
- name: Install Python dependencies | |||
run: | | |||
python -m pip install --upgrade pip | |||
pip install -r requirements.txt | |||
mkdir _static |
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.
Do we want this here to avoid the warning:
WARNING: html_static_path entry '_static' does not exist
.github/workflows/build.yml
Outdated
pip install -r requirements.txt | ||
pip install .[test] | ||
pip install .[mysql,knx,dmx,midi,mqtt,pulse,telegram,file_persistence] | ||
pip uninstall python-rtmidi -y |
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.
This is a workaround so some midi tests are skipped as in the main branch of the core repo. See PR description for details.
pyproject.toml
Outdated
[tool.ruff.lint] | ||
# Enable checks for Pycodestyle, Pyflakes, Bugbear, Docstrings and Import sorting | ||
select = ["E", "F", "B", "D", "I"] | ||
ignore = [ # FIXME: TBD what we want to ignore, some are easy to auto-fix |
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.
TBD all these errors occur, currently disabled so we could merge the current state.
We should discuss which ones what we want to ignore, some are easy to auto-fix. We can do ti step by step.
pyproject.toml
Outdated
|
||
[tool.ruff.format] | ||
# Like Black, use double quotes for strings. | ||
# quote-style = "double" # FIXME: do we want this now? |
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 me it's fine to always have quotes. But we can discuss it once we address formatting in the 2nd stage.
Replace all the original project setup, linting, etc. with ruff.
Still WIP. Need to adjust docs.
Taking it step by step. We could have a PR for each step to simplify code reading and discussions.
Ruff: Introduce ruff.
We disable all linting errors that we get so we can focus on the project setup 1st.
Formatting: We agree on some parameters, see
[tool.ruff.format]
inpyproject.toml
. Then we reformat the code (replacesblack
):ruff format .
Then we can also add a format check to build workflow.
Linting: We agree on which parameter we want to enable and which we want to ignore in future, see
[tool.ruff.lint]
inpyproject.toml
, e.g.;invoke like this:
ruff check --fix .
Setuptools
toHatchling
further down the road. Provides for some more advanced environment management and other nice features.BTW I think there was a bug in your previous setup.cfg:
I fixed it in the
pyproject.toml
. If it was intentional we need to change it back.There is another issue in the main repo: the midi module seems to be missing for the unittest. Thus 3 tests in
test_midi.py
are skipped. I did the same in mybuild.yml
as otherwise they would fail. So if we want them to be run in the workflow need to fix them there first. This is from the main repo (e.g. here https://github.com/mhthies/smarthomeconnect/actions/runs/12109227223/job/33758107287?pr=99):