-
Notifications
You must be signed in to change notification settings - Fork 3
Replace black with ruff and fix import declarations and f string #54
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
base: master
Are you sure you want to change the base?
Conversation
surister
left a comment
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.
Hey @Dvdandrades, Thank you for the PR, I approved the CI run and as you can see the command uv run ruff check trips the CI because of the new lint errors.
Now that ruff is up and running, you can run uv run format to fix most 'fixable' errors, then manually fix anything if it cannot do it automatically, if you need any further advice let me know 👌
pyproject.toml
Outdated
| "django-stubs>=5.1.3", | ||
| "pytest-cratedb>=0.4.0", | ||
| "requests>=2.32.3", | ||
| "ruff>=0.14.10", |
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 for this patch. Writing down the dependency for ruff is better like this, to not cause any behaviour drift, due to new formatting rules, and deprecations of older ones, coming from future releases.
| "ruff>=0.14.10", | |
| "ruff<0.15", |
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.
Thank you for the clarification. I was checking other repositories and didn't understand this at first when I saw it. Now I understand why it's done this way.
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.
Dependabot also understands this paradigm, and will submit corresponding patches, so maintainers can either merge without ado (if nothing changes), or accompany the PR with required adjustments about code formatting rules coming from a newer minor version of ruff.
uv.lock
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.
The Django adapter should also be treated as a library, because it is usually not installed standalone, but pulled in as a dependency. In this spirit, the lock file can be removed. Package consumers can't use it anyway.
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 for the information. So, from what I understand, in cases where the project is a library, it's good practice to include the lock file in the .gitignore file or simply remove it, right?
|
I believe all the changes have been made correctly. I've updated the branch so that ruff could fix the missing error. I've updated the ruff dependency and added the .lock file to the .gitignore to ensure consistency with other repositories. |
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.
tests/test_base.py
Outdated
| opts["OPTIONS"] = {"verify_ssl_cert": False} | ||
| c = DatabaseWrapper(opts).get_connection_params() | ||
| assert c["verify_ssl_cert"] == False | ||
| assert not c["verify_ssl_cert"] |
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.
Nit: Just in case you want to be explicitly checking for False. In this case, an identity match is applicable, contrary to the typical equality match.
| assert not c["verify_ssl_cert"] | |
| assert c["verify_ssl_cert"] is False |
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.
Suggested change done. Thank you so much for the explanations. I've learned a lot.
Summary of the changes / Why this is an improvement
Add Ruff to dev dependencies
Remove black from dev dependencies
Update GitHub Actions CI lint job to run Ruff instead of black
Update DEVELOPMENT.md
Run Ruff and fix imports declarations and f string
Add Ruff config in pyproject.toml with just the line-lenght. It can be improved with more rules
Checklist