astral-sh / ruff-action

A GitHub Action to run Ruff
Apache License 2.0
35 stars 2 forks source link

Feature request: Default to Ruff version from project setup #9

Open cknowles opened 2 weeks ago

cknowles commented 2 weeks ago

At the moment the action defaults to the latest version of Ruff. In order to match local behaviour, it would be good if the action defaulted to the version matching that inside pyproject.toml / poetry.lock.

Avasam commented 5 days ago

There's some issues and hidden complexity with that:

It'd be nice, but I don't think you should hold your breath on this, and instead just find the version string yourself with an easy string search srcipt. Here's an example with powershell: https://github.com/Avasam/typed-D3DShot/blob/24954b8122448926b9afddc1c245796b5e9165a0/.github/workflows/checks.yml#L24-L34 Here's one with Bash: https://github.com/Toufool/AutoSplit/blob/bd6cf54fdd3569c769e5c9d4ef9aab64344fca84/.github/workflows/lint-and-build.yml#L81-L94

Note that you'll have to extract an exact version (see #11)

pjonsson commented 5 days ago

My guess is that some mechanism that attempts to pick the Ruff version from the project setup, and fail with an error message if the version can't be determined automatically would satisfy most people. The few projects that have complex setups that use different versions of Ruff for different platform/systems can then set the version in the action instead.

Here's how the black action does it: https://github.com/psf/black/pull/4294. It would be nice if the Ruff action just works without having to add some other action to get Python 3.11 configured first.