Skip to content

Add support for reading the ruff version from Poetry groups#127

Merged
eifinger merged 5 commits intoastral-sh:mainfrom
inomotech-foss:main
Apr 27, 2025
Merged

Add support for reading the ruff version from Poetry groups#127
eifinger merged 5 commits intoastral-sh:mainfrom
inomotech-foss:main

Conversation

@scootermon
Copy link
Contributor

@scootermon scootermon commented Apr 26, 2025

Not sure if this is a desired feature since this was requested already (#40 (comment)) without any sort of response.
Unfortunately Poetry doesn't yet support PEP 735 (python-poetry/poetry#9751) and it doesn't make sense to add ruff as a project dependency.

@scootermon scootermon requested a review from eifinger as a code owner April 26, 2025 15:35
Copy link
Collaborator

@eifinger eifinger left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Looks good!

Can you please add a test like

test-default-version-from-pyproject-dev-group:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use default version from pyproject.toml dev group
id: ruff-action
uses: ./
with:
src: __tests__/fixtures/pyproject-dependency-dev-project
version-file: __tests__/fixtures/pyproject-dependency-dev-project/pyproject.toml
- name: Correct version gets installed
run: |
if [ "$RUFF_VERSION" != "0.8.3" ]; then
exit 1
fi
env:
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}

@scootermon
Copy link
Contributor Author

Thank you for your contribution. Looks good!

Can you please add a test like

My bad, I messed up my rebase before creating the PR and ended up not including the tests. Compared to the version you saw before I also had to slightly change the approach, since the poetry dependency specification doesn't match the format expected by getRuffVersionFromAllDependencies.

@scootermon scootermon requested a review from eifinger April 26, 2025 17:35
Copy link
Collaborator

@eifinger eifinger left a comment

Choose a reason for hiding this comment

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

It looks like poetry groups are the same as the others, just with one extra layer. We should be able to use the existing approach and keep one function collecting all "dependencies" and the other filtering out the correct ones.

Have I missed stomething?

fi
env:
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
test-default-version-from-pyproject-poetry-groups:
Copy link
Collaborator

Choose a reason for hiding this comment

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

One more thing I forgot. Can you please add this test to the needs section of the all-tests-passed jobs around line 280?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Really should've noticed that one myself 😅

Copy link
Collaborator

@eifinger eifinger left a comment

Choose a reason for hiding this comment

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

Awesome!

@eifinger eifinger enabled auto-merge (squash) April 27, 2025 12:36
@eifinger eifinger merged commit 400ab36 into astral-sh:main Apr 27, 2025
28 checks passed
@eifinger eifinger added the enhancement New feature or request label Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants