Skip to content
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

ENH: enable more ruff rules + make appropriate changes #415

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

theroggy
Copy link
Member

@theroggy theroggy commented May 13, 2024

Same rules as applied in geopandas + pyupgrade (python 3.8) + pydocstyle

@theroggy theroggy marked this pull request as ready for review May 13, 2024 23:11
Copy link
Member

@brendan-ward brendan-ward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup @theroggy , just a few minor comments.

pyogrio/core.py Outdated Show resolved Hide resolved
pyogrio/raw.py Outdated Show resolved Hide resolved
pyogrio/util.py Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
Comment on lines -37 to +36
datetime_kwargs = dict(format="ISO8601")
datetime_kwargs = {"format": "ISO8601"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I am not going to disagree merging this PR for this ;), but this is a change I dislike. When specifically creating keyword arguments, I like that dict(..) is closer in syntax to directly passing those to the function

Copy link
Member Author

@theroggy theroggy May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I remember the same remark being made in geopandas when this change was applied there :-):
geopandas/geopandas#2921 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it seems I somewhat consistent in my preference ;)
It's also just adding one additional rule to the ignore list if we wouldn't want this change (C408, https://docs.astral.sh/ruff/rules/unnecessary-collection-call/)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to @jorisvandenbossche ; I don't personally have a strong opinion on this. Given that it looks like this was accepted on the GeoPandas side more for tests, and this isn't strictly for tests here, it seems like ignoring C408 might be the better option here.

Copy link
Member Author

@theroggy theroggy May 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have an opinion on the syntax being used. Just a very mild opinion on the principle of using an oppiniated linter to avoid this kind of dicussions and then still have them :-), but I avoid having principles in general, so no problem at all to ignore C408 ;-).

I don't know what the basis of the remark in the geopandas comment was that it would only be relevant for tests in geopandas. That is not the case: ruff runs on the entire geopandas codebase and the PR linked to also changed this in the rest of the code base.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was referring to this comment via the above GeoPandas link from @jorisvandenbossche re: tests:

(now, I am fine here for our tests to just follow ruff, I just wouldn't like that for my personal scripts ;))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know, but the PR in geopandas isn't only targetting the tests.... Obviously it didn't change @jorisvandenbossche s personal scripts though ;-)

Comment on lines +118 to +123
# controversial
"B006",
# controversial
"B007",
# controversial
"B008",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to keep this consistent with geopandas, but I think those could probably all be removed (they don't seem that controversial, and I also doubt we have occurrences of them)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that they sound like useful checks, and some af them can even avoid weird situations that are hard to debug.

Maybe activate them in geopandas as well, then it is consistent between geopandas and pyogrio?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants