Compare commits

..
9 Commits
Author SHA1 Message Date
github-actions[bot]andeifinger c6bea5606c chore: update known checksums for 0.11.7 (#125)
chore: update known checksums for 0.11.7

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2025-04-27 13:01:02 +00:00
Simon Berger 400ab365db Add support for reading the ruff version from Poetry groups (#127)
Not sure if this is a desired feature since this was requested already
(https://github.com/astral-sh/ruff-action/issues/40#issuecomment-2581207691)
without any sort of response.
Unfortunately Poetry doesn't yet support PEP 735
(https://github.com/python-poetry/poetry/issues/9751) and it doesn't
make sense to add ruff as a project dependency.
2025-04-27 12:37:48 +00:00
github-actions[bot]andeifinger 719c6e52c1 chore: update known checksums for 0.11.6 (#123)
chore: update known checksums for 0.11.6

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2025-04-18 06:59:08 +00:00
github-actions[bot]andeifinger 9a7114796b chore: update known checksums for 0.11.5 (#120)
chore: update known checksums for 0.11.5

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2025-04-11 06:05:56 +00:00
github-actions[bot]andeifinger 07c64b80af chore: update known checksums for 0.11.4 (#117)
chore: update known checksums for 0.11.4

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2025-04-05 12:37:12 +02:00
github-actions[bot]andeifinger f800ba97f6 chore: update known checksums for 0.11.3 (#116)
chore: update known checksums for 0.11.3

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2025-04-04 06:06:48 +00:00
github-actions[bot]andeifinger fd7f7e1868 chore: update known checksums for 0.11.2 (#108)
chore: update known checksums for 0.11.2

Co-authored-by: eifinger <1481961+eifinger@users.noreply.github.com>
2025-03-22 07:44:41 +00:00
Kevin Stillhammer faac838a0b Add required permissions and all-tests-passed (#107) 2025-03-21 15:06:07 +01:00
Avasam 94d4d711a6 Mention the --diff flag for format --check (#104)
Just like for the action run adding annotations, the CI is the place
where you'd want extra information.

Especially information that tells you *how* to fix an issue, which is
relevant when a contributor doesn't want to / can't run the tool locally
(an edit through the GitHub UI could be more convenient, don't want to
bother installing extra tools locally, they're having issues not picking
up the right Ruff version when ran locally, etc.)

It's also easier to opt-out of copy-pasting this flag, than not knowing
about it in the first place.

Hence I think this documentation change is a positive to help anyone
integrate this action into their CI for check+formatting by looking at
the readme.
2025-03-19 13:53:29 +01:00
15 changed files with 348 additions and 69 deletions
-49
View File
@@ -1,49 +0,0 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: |
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "::error::Detected uncommitted changes after build. Run 'npm run build' and commit the changes."
git diff --text -v
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
+1
View File
@@ -12,6 +12,7 @@
name: "CodeQL" name: "CodeQL"
on: on:
workflow_dispatch:
push: push:
branches: [main] branches: [main]
pull_request: pull_request:
+4 -1
View File
@@ -3,15 +3,18 @@ name: Release Drafter
# yamllint disable-line rule:truthy # yamllint disable-line rule:truthy
on: on:
workflow_dispatch:
push: push:
branches: branches:
- main - main
workflow_dispatch:
jobs: jobs:
update_release_draft: update_release_draft:
name: ✏️ Draft release name: ✏️ Draft release
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
steps: steps:
- name: 🚀 Run Release Drafter - name: 🚀 Run Release Drafter
uses: release-drafter/release-drafter@v6.1.0 uses: release-drafter/release-drafter@v6.1.0
+49 -9
View File
@@ -1,7 +1,7 @@
name: "test" name: "test"
on: on:
pull_request:
workflow_dispatch: workflow_dispatch:
pull_request:
push: push:
branches: branches:
- main - main
@@ -118,6 +118,23 @@ jobs:
fi fi
env: env:
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }} RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
test-default-version-from-pyproject-poetry-groups:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use default version from pyproject.toml poetry group dependencies
id: ruff-action
uses: ./
with:
src: __tests__/fixtures/pyproject-dependency-poetry-project
version-file: __tests__/fixtures/pyproject-dependency-poetry-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 }}
test-default-version-from-pyproject-optional-dependencies: test-default-version-from-pyproject-optional-dependencies:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -170,16 +187,12 @@ jobs:
env: env:
RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }} RUFF_VERSION: ${{ steps.ruff-action.outputs.ruff-version }}
test-checksum: test-checksum:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.inputs.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest] inputs:
checksum: - os: ubuntu-latest
["0de731c669b9ece77e799ac3f4a160c30849752714d9775c94cc4cfaf326860c"]
exclude:
- os: macos-latest
checksum: "0de731c669b9ece77e799ac3f4a160c30849752714d9775c94cc4cfaf326860c" checksum: "0de731c669b9ece77e799ac3f4a160c30849752714d9775c94cc4cfaf326860c"
include:
- os: macos-latest - os: macos-latest
checksum: "af9583bff12afbca5d5670334e0187dd60c4d91bc71317d1b2dde70cb1200ba9" checksum: "af9583bff12afbca5d5670334e0187dd60c4d91bc71317d1b2dde70cb1200ba9"
steps: steps:
@@ -188,7 +201,7 @@ jobs:
uses: ./ uses: ./
with: with:
version: "0.7.4" version: "0.7.4"
checksum: ${{ matrix.checksum }} checksum: ${{ matrix.inputs.checksum }}
src: __tests__/fixtures/python-project src: __tests__/fixtures/python-project
test-with-explicit-token: test-with-explicit-token:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -252,3 +265,30 @@ jobs:
src: >- src: >-
__tests__/fixtures/python-project/src/python_project/__init__.py __tests__/fixtures/python-project/src/python_project/__init__.py
__tests__/fixtures/python-project/src/python_project/hello_world.py __tests__/fixtures/python-project/src/python_project/hello_world.py
all-tests-passed:
runs-on: ubuntu-latest
needs:
- lint
- test-latest-version
- test-specific-version
- test-version-from-version-file-pyproject
- test-default-version-from-pyproject
- test-default-version-from-pyproject-dev-group
- test-default-version-from-pyproject-dependency-groups
- test-default-version-from-pyproject-poetry-groups
- test-default-version-from-pyproject-optional-dependencies
- test-default-version-from-requirements
- test-semver-range
- test-checksum
- test-with-explicit-token
- test-args
- test-failure
- test-multiple-src
if: always()
steps:
- name: All tests passed
run: |
echo "All jobs passed: ${{ !contains(needs.*.result, 'failure') }}"
# shellcheck disable=SC2242
exit ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
@@ -7,6 +7,9 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
@@ -13,6 +13,8 @@ jobs:
update_major_minor_tags: update_major_minor_tags:
name: Make sure major and minor tags are up to date on a patch release name: Make sure major and minor tags are up to date on a patch release
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Update Major Minor Tags - name: Update Major Minor Tags
+1 -1
View File
@@ -85,7 +85,7 @@ you can use the `args` input to overwrite the default value (`check`):
```yaml ```yaml
- uses: astral-sh/ruff-action@v3 - uses: astral-sh/ruff-action@v3
with: with:
args: "format --check" args: "format --check --diff"
``` ```
### Install specific versions ### Install specific versions
@@ -0,0 +1,14 @@
[project]
name = "pyproject-dependency-poetry-project"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
[tool.poetry.group.dev.dependencies]
sphinx = "*"
ruff = "0.8.3"
[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,2 @@
def hello() -> str:
return "Hello from python-project!"
Generated Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+238
View File
@@ -1,5 +1,243 @@
// AUTOGENERATED_DO_NOT_EDIT // AUTOGENERATED_DO_NOT_EDIT
export const KNOWN_CHECKSUMS: { [key: string]: string } = { export const KNOWN_CHECKSUMS: { [key: string]: string } = {
"aarch64-apple-darwin-0.11.7":
"1c6cc5fb36fb001dfa7331892f9d808bc7ced1d45f0ec54b4caeaa571bc55495",
"aarch64-pc-windows-msvc-0.11.7":
"c18bc5d87b9b582f1f9da6bdf78fa4a710f9d40f409cfae330f20bf9f16ce631",
"aarch64-unknown-linux-gnu-0.11.7":
"ccc11afdc3d3d3b146f972645d54a49c819034b8379d190281962bfa80c69389",
"aarch64-unknown-linux-musl-0.11.7":
"6cf1772002cc8787f5dd24b3fa7aa86bb26ad7188854f3df40a435467ecce10b",
"arm-unknown-linux-musleabihf-0.11.7":
"54b2103852c9667eab6df2b22649f1e0b16e1f4106888e9e239ada1e263bba0e",
"armv7-unknown-linux-gnueabihf-0.11.7":
"770b301a87680d96a3400e6932028efcbd181ab22e6a8dd551a1efcc2b6df82f",
"armv7-unknown-linux-musleabihf-0.11.7":
"8401fd29776dfd02f68a2a13bc4aea04b4da202237a0ab9548f9e373edf74b8f",
"i686-pc-windows-msvc-0.11.7":
"8608f979877847e8d218c9b5bc327bb5e9ce45b39961addc8380ffd9f4833a1a",
"i686-unknown-linux-gnu-0.11.7":
"8b837237cd348d87f7a1a22341d65a2a4b082173d5f873caa40a45493d6a8117",
"i686-unknown-linux-musl-0.11.7":
"897c08c45b8fcfc90770250ea61cc7cd22badeea2b7a685d78bf5f3892ae09a6",
"powerpc64-unknown-linux-gnu-0.11.7":
"38fc8cd8a4432372974668cf5256d55de2158ad5d919b6eff55637b50b4e749a",
"powerpc64le-unknown-linux-gnu-0.11.7":
"b9a8349f934930809981bf330dfa2385bb5e8c1d3a16752710e1a66130d44a97",
"s390x-unknown-linux-gnu-0.11.7":
"3daa6fb92450347b3983913624636c26d9451487b02a27880bcb6665413b1b5d",
"x86_64-apple-darwin-0.11.7":
"2acd8b2a63749e17506cc7a4a00b2ef007a3793d365ef0b6ed2a191f77219f35",
"x86_64-pc-windows-msvc-0.11.7":
"9e319a18844da490949303ec5a60032f6ee8d673fb174bd4e70c8641b091375d",
"x86_64-unknown-linux-gnu-0.11.7":
"7f448fea7bac3320416d1465219b8bd58828bfef9a3c8398094ca6c09b71148c",
"x86_64-unknown-linux-musl-0.11.7":
"0caf32ab0c399bfba08d18b190dc1aaec8ea47368864a4bf3b3f113e36e8fd68",
"aarch64-apple-darwin-0.11.6":
"fa9a4f229431f1971c4b1d35567237706384104af464d1d34013077e75b0dff3",
"aarch64-pc-windows-msvc-0.11.6":
"a5b28d8f4eb6a46bdd000f11579fcb074ab3be1e3d9140c225b7111cd7f6708f",
"aarch64-unknown-linux-gnu-0.11.6":
"ff73176c526026b02847901b9a51a1ed395a445d3704dbf60df4bd68d06f0be7",
"aarch64-unknown-linux-musl-0.11.6":
"05e42f4293649535fd381c6af6527af98868703f6072711022b76fffefcb669f",
"arm-unknown-linux-musleabihf-0.11.6":
"f9795e7edf81afa1885409d84fe4a25f7e9f7db35cdcb7e825eb5f9adb6c9c94",
"armv7-unknown-linux-gnueabihf-0.11.6":
"1c94650fdfbc0923495fea6b9be92ac503896f55ca255df4a9c3758b59e98475",
"armv7-unknown-linux-musleabihf-0.11.6":
"e8beafa466781a59902b92979a65e1f8999609874624c8fcda30812cbad3540a",
"i686-pc-windows-msvc-0.11.6":
"268f9450c9a8fad32c84da1cbf3be34f2d4fdb56442cae8d73e64c6476437f31",
"i686-unknown-linux-gnu-0.11.6":
"00c91021cdb13e781141c7cbf3bda5429e3ec60f70a87fa71452596d48e906b6",
"i686-unknown-linux-musl-0.11.6":
"a0fe3d93befe5b9767deb9d072e0f0b140aab37be1600e51ae06c16239d8e391",
"powerpc64-unknown-linux-gnu-0.11.6":
"04a25b6c39f94d6adfba2549ad94117dc8783a097378fae21b378a7cf763ba0b",
"powerpc64le-unknown-linux-gnu-0.11.6":
"ee67e166d653011fd6d3ff7231eceeb4a46c544a8deed808933e0a50b7dfd75b",
"s390x-unknown-linux-gnu-0.11.6":
"59ac481df26bcdef791ec69c32ab43068b132f771d40f505bce6f4947773adde",
"x86_64-apple-darwin-0.11.6":
"5af295e50f2a7db9767964bfe1af1cd9b61004b4e7fcb9e29059fb7aa561ad21",
"x86_64-pc-windows-msvc-0.11.6":
"9fbe8bc77738d2f231d580e315c54bc615b1bec22a6df4201e1d9a821f842ae3",
"x86_64-unknown-linux-gnu-0.11.6":
"ccfaf04f1f912c77ff12890717a4390166ea955e51d504a6f68c2fd2bc70c39e",
"x86_64-unknown-linux-musl-0.11.6":
"e5d91ac0472fa84942fd82cc9289637c9ec5a4669b8b2e2be6f61983707c8973",
"aarch64-apple-darwin-0.11.5":
"4a5b1a44412bda817debb67d826a565f11b235744870b509f44102403a3a9e89",
"aarch64-pc-windows-msvc-0.11.5":
"b31e0b25db4810115f714669152ad953e2b0902630c730457152bddebf2ca3c2",
"aarch64-unknown-linux-gnu-0.11.5":
"49955aa67dc524dfbee37ce3749d7f9331ed2d79c3a204da1729068d2f41d667",
"aarch64-unknown-linux-musl-0.11.5":
"77c11c7a70d3bf499915bab5a7691e955f4127164c4cfb7ef4e0773892ed2509",
"arm-unknown-linux-musleabihf-0.11.5":
"e84eb046fd064e34328c9e4dc931f48553d4b15899794aee024e7f3d22fe7292",
"armv7-unknown-linux-gnueabihf-0.11.5":
"da597c4e014c59dcc7826fd088d8cc12d3a1d22cbd7da6128b399c5a364781c0",
"armv7-unknown-linux-musleabihf-0.11.5":
"9f1b0efe535b1f376b627ca91adea6bcbaf25202f4601644dbdf45329f351a0f",
"i686-pc-windows-msvc-0.11.5":
"d3333b62d4ef26d2872f6c0f3f6340da161f8e4bbc7359dd9a8eab2cb4bd2f1b",
"i686-unknown-linux-gnu-0.11.5":
"70535bc5f92315af0f738c1ef2feb3653a5f4168a360d9a305918c3c4ad13e70",
"i686-unknown-linux-musl-0.11.5":
"240a76da851374d14851d0e1a90e4cb289c9420fe502e7cfab66d1aafaf130b0",
"powerpc64-unknown-linux-gnu-0.11.5":
"38f85d692148fc2142dbc215954fb2c08bebf9cbb23c2cc24b7c92a938bdf05b",
"powerpc64le-unknown-linux-gnu-0.11.5":
"2e51789ce389d15852a39b7204ed118f26dcea989a98da513433b0849901795f",
"s390x-unknown-linux-gnu-0.11.5":
"c8908e1e157f0ea5579be71b3fdc52c86f440e87026c4894d4b232d4797f9394",
"x86_64-apple-darwin-0.11.5":
"c28725c6421d5834b2cd16c7b13c3831b3363d6d558448d7dd3e0aa695551f94",
"x86_64-pc-windows-msvc-0.11.5":
"2679f4187e5cb317c5a1af17f6114d314b0d5534147097773e1cc0fd8b512429",
"x86_64-unknown-linux-gnu-0.11.5":
"291972831e6dc576caaa393ed4a8ed0c4d82e0ff4ea08d4e849d6e5ac840a833",
"x86_64-unknown-linux-musl-0.11.5":
"067c1c6c4d6033b65fe788f5310075686110b286a102431fb19883c079e2fca1",
"aarch64-apple-darwin-0.11.4":
"55a555097986e7cf0f84ce564f1638ac1da23eddf76d4b1b47489f3922cf8ae4",
"aarch64-pc-windows-msvc-0.11.4":
"90ff70103285d09929f7b31a11c30bd2c5df752e2d3a61e540599cee06c39dc9",
"aarch64-unknown-linux-gnu-0.11.4":
"6fbc86c6668dbf910d95722e15d0504e1dc40b4ed0a0270ed1d25d43e44aea80",
"aarch64-unknown-linux-musl-0.11.4":
"c8e81e2ef126c2e033ca6e374bffcea7f21cb4c6bf8c7fff51a140e2d15bcb7f",
"arm-unknown-linux-musleabihf-0.11.4":
"c17dd23ebca317a2c3224ffa6c0617e353633a0ec7c7149f0a61dc9828cba73f",
"armv7-unknown-linux-gnueabihf-0.11.4":
"71584d500a601b77745d76aef81a11cd92b7200f42c663009a8b3bc03e68479a",
"armv7-unknown-linux-musleabihf-0.11.4":
"4cd49dbe93944fc1e9bf826d0940bdbcb171dec346db1ebb25681cc1a31e1a77",
"i686-pc-windows-msvc-0.11.4":
"2d068600be4a657b888ab4654c94b0f7f63d3246ea7fff14b734d2ab0053718c",
"i686-unknown-linux-gnu-0.11.4":
"5035f3b7d46f8b5661a0335ebfd78e1f841210bd601b98ce3793572fa8be744d",
"i686-unknown-linux-musl-0.11.4":
"8b8b48eae555dd67cd224b8f072ff745c13aa1bb1842afb9f1052bc9276a30d5",
"powerpc64-unknown-linux-gnu-0.11.4":
"a7403d043978726e2fa665e16419ef2e3836b091036c9c38426ba1872492a9ea",
"powerpc64le-unknown-linux-gnu-0.11.4":
"af9cc3230a7515b4f1359950c5a2288d0c3bcbbaa3b892e729227395cf1e80c7",
"s390x-unknown-linux-gnu-0.11.4":
"655287e21286ccfa6e203b0d7d904cc539be59f16734b3a273a2cdbd0a37deb1",
"x86_64-apple-darwin-0.11.4":
"744d62f6d3b35b8a01c5e4d08cc8a61dba28d289747f20cf38d4945e152b9b5e",
"x86_64-pc-windows-msvc-0.11.4":
"b8b64b08a371e195fd76a9a4f38d30de9ca3c0151eea776d55c53324c3de4ea4",
"x86_64-unknown-linux-gnu-0.11.4":
"69b9d9228ecadcffec970976e7d5c989064c2129ab03e606b3f96e588bcc1ffc",
"x86_64-unknown-linux-musl-0.11.4":
"116444192ecb0378e06a3665069b344e80acacb4e7071cd25e4026b70eaf3080",
"aarch64-apple-darwin-0.11.3":
"7c265ea9176ffa8310adc8e8b8e3274e77dc663f0404fd6f92fd417e159f413c",
"aarch64-pc-windows-msvc-0.11.3":
"281f3e2ce6d17409e54f5a6a883e1aa8bdfa70d86baca74efb17b617094926cf",
"aarch64-unknown-linux-gnu-0.11.3":
"a1696128279f927f67a051949edeba9359ef20366b4349c1cc1b8e690b59743c",
"aarch64-unknown-linux-musl-0.11.3":
"b98da720f726d5e42a89bafe3b7e40dce74f0493d92e675cc4254349a25a2f6a",
"arm-unknown-linux-musleabihf-0.11.3":
"35315a8a41dec64ca36a5b030ac41dbf4505de4eb4aab7e41bd07e520746e7fd",
"armv7-unknown-linux-gnueabihf-0.11.3":
"9eb3fdfd64649c20a6f2765e34585fc3a7ff5a3beb64fcafe2f8f9b2fb8df680",
"armv7-unknown-linux-musleabihf-0.11.3":
"d7d5b51c748421420903805c851d47817749d1f6c99d1ef98ec9a4e990df57a1",
"i686-pc-windows-msvc-0.11.3":
"e4a3ad502c4ebcb50e54acc2643aecb2c3adc16ed00d2bdac8ab08898f508431",
"i686-unknown-linux-gnu-0.11.3":
"4dac993bf409508831a0060ae46993615dac5da670ef2958a6202d9a878e36be",
"i686-unknown-linux-musl-0.11.3":
"c3d654428a9aece53d684ec94bb5b93ac530b801167e193de4973a93b1f5cef0",
"powerpc64-unknown-linux-gnu-0.11.3":
"32f9fb6f641d8dc68c429bd82bd551184fe8d60b8b1278fbedb9cf08bf3c5a14",
"powerpc64le-unknown-linux-gnu-0.11.3":
"1f10bb8de6808f07e95ab75736401189980d3737b969c99eb390586e16a818be",
"s390x-unknown-linux-gnu-0.11.3":
"0c92a5798cb2e1955500f159535258983358546cb07c292b2f3398c0a8e935aa",
"x86_64-apple-darwin-0.11.3":
"b209590d1f856c9db5817ad8f5143b1a772c16e1429aa19cce2e299507e1898b",
"x86_64-pc-windows-msvc-0.11.3":
"d5649ba04579aa66aa876862fa58d28ebe327513e7b4d89f087f04992ec69f4c",
"x86_64-unknown-linux-gnu-0.11.3":
"62568251d4dba83d5430ff0a9abf165bc8b7fb0372650fa7d5565634f6b4248e",
"x86_64-unknown-linux-musl-0.11.3":
"a2e4cfab3eb83f0cf6717e88da734a4c783c0545f1be402026d1376e5de3323c",
"aarch64-apple-darwin-0.11.2":
"9961fffc17d3a8f6ce8bb92f0b2a90fda80f0ea2d0c1346d6117bb4e18f34913",
"aarch64-pc-windows-msvc-0.11.2":
"a41f4e8822701ef3391831365de8adf3b1cc976726a93a54216de00cc34dea93",
"aarch64-unknown-linux-gnu-0.11.2":
"7f35af7323a7ceeec1d83e64ae669f87d38162a8267af88fff9a3f9b2c89a2f2",
"aarch64-unknown-linux-musl-0.11.2":
"51dc675fa09661f49cf8accbb0e1c115a5e3e00454c4619a63ba10e7f90a5852",
"arm-unknown-linux-musleabihf-0.11.2":
"5e6d9531cbb4387d8d7c652bba4d8161f305b98459496b650149872dac0ca1df",
"armv7-unknown-linux-gnueabihf-0.11.2":
"afcbb4e46d6ed3d5970a36863c3c6233e58c20bb7c762c78c68cf1d3d4a38f93",
"armv7-unknown-linux-musleabihf-0.11.2":
"5b7fa555836ca342950ecf9a6ef5ffdcb917f2b89d663580b327f0f0b0f5ac0c",
"i686-pc-windows-msvc-0.11.2":
"17d350f5a0a517ef535bfba1420b68189c0a445a3a0e19bb06cf9c3aeb8a03c6",
"i686-unknown-linux-gnu-0.11.2":
"8b27e39d4585964477f46abb6fbaa1804b6c35dfc86111d2d64e98632e49f0bf",
"i686-unknown-linux-musl-0.11.2":
"68129ce67cf5a606035ebefcb7f5ddd9235c57e54aed079b0df932a4c2a319ed",
"powerpc64-unknown-linux-gnu-0.11.2":
"67b89d962667af4700392d21fd78d7ace6c32f04085f3a5272ffa54f39a38b59",
"powerpc64le-unknown-linux-gnu-0.11.2":
"b384803d8b25c1980dd54987e2adad895953d97a950115738d4faf8c0f115f05",
"s390x-unknown-linux-gnu-0.11.2":
"a630420ecebc3a1a94ceb7131703342d4f4a70a29f5d7e69c96d21d98556bf23",
"x86_64-apple-darwin-0.11.2":
"acfc4c703112ff58319ad4b30382b88531414473daad4776066ed22fb86351e1",
"x86_64-pc-windows-msvc-0.11.2":
"88feff8d7b746b9226e4370e6563d12bf40e58e3233c18cd0c41f26c415e963b",
"x86_64-unknown-linux-gnu-0.11.2":
"cc5ebc29bc0493a2f42654f757573d062d0984ce91bd796a41109ab643ef4e3f",
"x86_64-unknown-linux-musl-0.11.2":
"b09844718d52aa72e914bc0eb806d2ea01ceea006378bc515170e4eae8632ed8",
"aarch64-apple-darwin-0.11.1":
"d41de7663c80b83ec3987a89d30f9bc64d49487bcf45078483944a80581e1a61",
"aarch64-pc-windows-msvc-0.11.1":
"ee7211b59f05be0e5c5fd24d5dc05591644fac4c15f4f013e5975511b27b9402",
"aarch64-unknown-linux-gnu-0.11.1":
"15b1fa9f855c62951d93d429af1a33f082e3a7192e4a1f1e7108d9b574921796",
"aarch64-unknown-linux-musl-0.11.1":
"c20e9c96e49d7e85c9bc32ad2a139016a39bb63df6db214de539125bda1f3d5d",
"arm-unknown-linux-musleabihf-0.11.1":
"b3281686a846322df070772efc6fc359480ae04bac0ca61a3cfb14f0c6b53c24",
"armv7-unknown-linux-gnueabihf-0.11.1":
"820eedda2fbe8cf66e8fd3abbaf2519b338ad5712c53ae493cb75f12dfad4651",
"armv7-unknown-linux-musleabihf-0.11.1":
"0ae6426c7cdc8649464350f64c4f07065199b38477257326bf5547a409c3d224",
"i686-pc-windows-msvc-0.11.1":
"0a3931aee2ce36a9604109b9edb0e02e2a07401957fa2da125f4fa2199a836de",
"i686-unknown-linux-gnu-0.11.1":
"15bef7202e0f82b8cb6dd9eaa3101e090ee1067d379c249d447337eb016bba2d",
"i686-unknown-linux-musl-0.11.1":
"f7c69e12e319b6b9a89ce4533d3a0aa35b6006d40eba1cfd79dc19cf44002373",
"powerpc64-unknown-linux-gnu-0.11.1":
"8bfa85a3f3b0e127c8141e7cddd7f6b0cf5fa2935afb34236ee8c2e2b7d5201d",
"powerpc64le-unknown-linux-gnu-0.11.1":
"0a4b4724d97e820d74a036e984b92a4027e506723d4ac6adacd3d6bcbc97d586",
"s390x-unknown-linux-gnu-0.11.1":
"a31163314be04affd81186d052087333f71744c38d7142e7169c2cf92f2c3ebb",
"x86_64-apple-darwin-0.11.1":
"db8cb26297357754b034c043b600f648162ca3b4c3d6b80aab36fac9b30be21e",
"x86_64-pc-windows-msvc-0.11.1":
"ea0371400228fcccd81c4d6884caa4c80d694cf73a20b6e9a685b0fac76c2455",
"x86_64-unknown-linux-gnu-0.11.1":
"2eb2238227e232a7b6e2da71586e8d7999782a0b2d9ddab7d3a6354a13d2589c",
"x86_64-unknown-linux-musl-0.11.1":
"a57ab099cdada4265eb7558f63c724799121daf542e1103ab95f1be86f5d70a5",
"aarch64-apple-darwin-0.11.0": "aarch64-apple-darwin-0.11.0":
"09ea313f2aab3844432b46c6c5e3e066b26ae4953f4bac1e545176e5dea22306", "09ea313f2aab3844432b46c6c5e3e066b26ae4953f4bac1e545176e5dea22306",
"aarch64-pc-windows-msvc-0.11.0": "aarch64-pc-windows-msvc-0.11.0":
+33 -9
View File
@@ -23,14 +23,21 @@ function getRuffVersionFromAllDependencies(
return undefined; return undefined;
} }
function parsePyproject(pyprojectContent: string): string | undefined { interface Pyproject {
const pyproject: { project?: {
project?: { dependencies?: string[];
dependencies?: string[]; "optional-dependencies"?: Record<string, string[]>;
"optional-dependencies"?: Map<string, string[]>; };
"dependency-groups"?: Record<string, Array<string | object>>;
tool?: {
poetry?: {
group?: Record<string, { dependencies: Record<string, string | object> }>;
}; };
"dependency-groups"?: Map<string, Array<string | object>>; };
} = toml.parse(pyprojectContent); }
function parsePyproject(pyprojectContent: string): string | undefined {
const pyproject: Pyproject = toml.parse(pyprojectContent);
const dependencies: string[] = pyproject?.project?.dependencies || []; const dependencies: string[] = pyproject?.project?.dependencies || [];
const optionalDependencies: string[] = Object.values( const optionalDependencies: string[] = Object.values(
pyproject?.project?.["optional-dependencies"] || {}, pyproject?.project?.["optional-dependencies"] || {},
@@ -40,11 +47,28 @@ function parsePyproject(pyprojectContent: string): string | undefined {
) )
.flat() .flat()
.filter((item: string | object) => typeof item === "string"); .filter((item: string | object) => typeof item === "string");
return getRuffVersionFromAllDependencies( return (
dependencies.concat(optionalDependencies, devDependencies), getRuffVersionFromAllDependencies(
dependencies.concat(optionalDependencies, devDependencies),
) || getRuffVersionFromPoetryGroups(pyproject)
); );
} }
function getRuffVersionFromPoetryGroups(
pyproject: Pyproject,
): string | undefined {
// Special handling for Poetry until it supports PEP 735
// See: <https://github.com/python-poetry/poetry/issues/9751>
const poetryGroups = Object.values(pyproject?.tool?.poetry?.group || {});
return poetryGroups
.flatMap((group) => Object.entries(group.dependencies))
.map(([name, spec]) => {
if (name === "ruff" && typeof spec === "string") return spec;
return undefined;
})
.find((version) => version !== undefined);
}
export function getRuffVersionFromRequirementsFile( export function getRuffVersionFromRequirementsFile(
filePath: string, filePath: string,
): string | undefined { ): string | undefined {