-
Notifications
You must be signed in to change notification settings - Fork 117
style: replace black, isort, flake8 and autoflake with ruff #456
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
style: replace black, isort, flake8 and autoflake with ruff #456
Conversation
|
✅ DCO Check Passed Thanks @schwarbf, all your commits are properly signed off. 🎉 |
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 Require two reviewer for test updatesWonderful, this rule succeeded.When test data is updated, we require two reviewers
|
black and isort by ruff| part_name: str | None = Field(default=None) | ||
| docstring: str | None = Field(default=None) | ||
| sha256: int | None = Field(default=None) | ||
| start_line: int | None = Field(default=None) | ||
| end_line: int | None = Field(default=None) | ||
| end_line_signature: int | None = Field(default=None) |
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.
Was this suggested by Ruff?
We still support 3.9 (it may change at some point) and the | syntax is only valid from 3.10. We should therefore keep typing.Optional
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.
Okay I see. It's weird since I had actually set :
[tool.ruff]
target-version = "py39"Anyways, I will revert this part.
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! However, I've seen that the syntax is still in other places, like in test/test_page_chunker.py
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.
Can you please check again? I found 2 remaining spots, where the syntax dtype | None was used instead of Optional[dtype]. The respective rule UP045 is also in the ignore list such that no errors are raised in the future.
4c618ea to
85a1889
Compare
|
@ceberam PR should be ready. Let me know if you want me to rebase or merge with |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
@schwarbf sorry for the late reply. Would you mind rebasing to the latest |
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
…aises fewer issues Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
…ff (i.e. no separate [tool.flake8] section Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
…= 120 equals now what was set for the .flake8 settings Signed-off-by: Florian Schwarb <[email protected]>
… one linting check would fail Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
Signed-off-by: Florian Schwarb <[email protected]>
7b6da2d to
b60b5c3
Compare
|
@schwarbf I have rebased and force-pushed your commits. I'll add a couple of them to fix some small details and apply a couple of additional style rules. |
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
Signed-off-by: Cesar Berrospi Ramis <[email protected]>
d4b6f87 to
a73490d
Compare
@ceberam That's fine thanks. I was going to do it tonight. Seems like we're ready to merge apart from the |
All good @schwarbf , thanks for your contribution! |
This PR aims to close the open issue 453.
I tried to do as little code changes as possible. I did the following:
doclingrepositoryblack,isort,autoflakeandflake8ruff format(formatted approx. 30 files) andruff check --fix(fixed approx. 50 warnings)test/datafrom ruffignorelist that would have affected > 3 changes. Feel free to remove any again to see possible changes.120inpyproject.toml(was120in.flake8file, but88inpyproject.toml)FYI: When checking which commit added
ruffto docling, you can see that 5458a88also changed a significant number of files and added some rules to the
ignorelist.