-
Notifications
You must be signed in to change notification settings - Fork 7
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
Replace black, flake8 and isort with ruff #95
Conversation
pyproject.toml
Outdated
@@ -56,6 +54,18 @@ mkdocs-gen-files = "^0.4.0" | |||
mkdocs-literate-nav = "^0.5.0" | |||
mkdocs-section-index = "^0.3.4" | |||
|
|||
[tool.ruff] | |||
target-version = "py312" |
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 are meant to support from python 3.9, so target version should be that one. Otherwise, there will be functionality that is not backwards compatible.
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.
Yep, sorry, overlooked that one
@@ -96,11 +98,11 @@ def read_metadata( | |||
|
|||
|
|||
def read_to_array( | |||
filename: Union[Path, str], | |||
filename: Path | str, |
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.
In theory, this syntax is not valid for Python 3.9. See https://www.slingacademy.com/article/union-type-in-python-the-complete-guide/#:~:text=Introduced%20in%20Python%203.10%20as%20part%20of%20PEP
I think this might be running the ruff
pre-commit with the wrong python version. Could you add a default python version in the pre-commit-congig.yml
file? See https://pre-commit.com/#top_level-default_language_version
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.
So in readers.py you've got from __future__ import annotations
, so the |
operator should be valid. Not sure why it's not complaining in writers.py though!
That said, when I run ruff check --target-version py39
it doesn't complain - weird!
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 forgot about the __futures__
stuff. Yeah, with that all of that should work. But I agree it should fail if not imported.
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.
Let's go ahead with it. The code looks good, so we will see if it fails later on and fix accordingly.
@all-contributors please add @dc2917 for infra and code |
I've put up a pull request to add @dc2917! 🎉 |
This PR removes development dependencies
black
,flake8
andisort
, and replaces them withruff
. The associated pre-commit hooks have also been replaced withruff
's.Satisfying ruff required adding quite a few docstrings, so it's probably worth checking the docstrings I've added make sense!
Closes #73