geopandas / pyogrio

Vectorized vector I/O using OGR
https://pyogrio.readthedocs.io
MIT License
258 stars 22 forks source link

MNT: Switch from flake8 to ruff for linting #342

Closed brendan-ward closed 5 months ago

brendan-ward commented 5 months ago

Resolves #341

Similar to changes in GeoPandas #2921 but without needing to configure additional rules.

brendan-ward commented 5 months ago

Switched to ruff-format and removed unnecessary # noqa statements.

theroggy commented 5 months ago

Maybe add ruff as dependency in environment-dev.yml?

jorisvandenbossche commented 5 months ago

Maybe add ruff as dependency in environment-dev.yml?

pre-commit is included, and then the idea is that you install the pre-commit, which will handle getting ruff (that's also how it went for black and flake8, which aren't included in the yml)

Of course if you don't use pre-commit and want to run ruff manually, you also need it in your env.

theroggy commented 5 months ago

Maybe add ruff as dependency in environment-dev.yml?

pre-commit is included, and then the idea is that you install the pre-commit, which will handle getting ruff (that's also how it went for black and flake8, which aren't included in the yml)

Of course if you don't use pre-commit and want to run ruff manually, you also need it in your env.

I personally use visual studio code and then it is convenient that formatter and linter are installed so the formatting is automatically applied and linting errors are shown in the UI. Once you commit pre-commit will check this as well... but this is later in the process.

But, if this is rather typical for my workflow, no problem not to include it... not problem to install it myself...

brendan-ward commented 5 months ago

Given that we had black in the environment-dev.yml (and I removed here), I have no issues with adding ruff as a development dependency. For vscode, I've been using the ruff extension, which I believe ships with its own install of ruff that would be used to highlight things in the vscode UI.

jorisvandenbossche commented 5 months ago

I don't mind ruff being there in the dev env file (I don't use that anyway, I have a "geo-dev" env that I use for geopandas etc as well), but just a note for those using it: you might have to take care in ensuring the same ruff version is used as in the pre-commit, otherwise you might still get lint failures on CI.