From 65461aedfa2c3cd41d5fbf2ff5b3455845118d4f Mon Sep 17 00:00:00 2001 From: Rinaldo Rex Date: Mon, 2 Jun 2025 17:57:16 +0530 Subject: [PATCH 1/4] feat(ruff): upgrade linting via ruff and uv --- python-lint/action.yml | 51 ++++++++++++------------------------------ python-test/action.yml | 37 +++++++++++++----------------- 2 files changed, 29 insertions(+), 59 deletions(-) diff --git a/python-lint/action.yml b/python-lint/action.yml index 2918e78..22805e5 100644 --- a/python-lint/action.yml +++ b/python-lint/action.yml @@ -1,15 +1,11 @@ name: "Linting and Type Checking" -description: "Run linting and type-checking tools like Black, Flake8, isort, and mypy using Poetry" +description: "Run linting(ruff) and type-checking(mypy) tools via uv" inputs: python-version: description: "The version of Python to use" required: true - poetry-version: - description: "The version of Poetry to use" - required: true - runs: using: "composite" @@ -17,46 +13,27 @@ runs: - name: Checkout repository uses: actions/checkout@v4 + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.7.8" + enable-cache: true + - name: Setup Python uses: actions/setup-python@v5 with: python-version: ${{ inputs.python-version }} - - name: Install pipx - run: | - python -m pip install --upgrade pip - python -m pip install pipx - python -m pipx ensurepath - continue-on-error: true + - name: Install the project + run: uv sync --locked --all-extras --dev - shell: bash - - - name: Install Poetry with pipx - run: pipx install poetry==${{ inputs.poetry-version }} - continue-on-error: true - shell: bash + - name: Run Ruff format + run: uv run ruff format --check . - - name: Install dependencies - run: poetry install - continue-on-error: true - shell: bash - - - name: Run Black - run: poetry run black --check . - continue-on-error: true #Added so to provide lineance while lint - shell: bash - - - name: Run Flake8 - run: poetry run flake8 . - continue-on-error: true #Added so to provide lineance while lint - shell: bash - - - name: Run isort - run: poetry run isort --check . - continue-on-error: true #Added so to provide lineance while lint - shell: bash + - name: Sort imports + run: uv run ruff check --select I --diff . - name: Run mypy - run: poetry run mypy . + run: uv run mypy . continue-on-error: true #Added so to provide lineance while lint shell: bash diff --git a/python-test/action.yml b/python-test/action.yml index 229e3d5..96736c8 100644 --- a/python-test/action.yml +++ b/python-test/action.yml @@ -5,9 +5,6 @@ inputs: python-version: description: "The version of Python used" required: true - poetry-version: - description: "The version of Poetry to install" - required: true runs: using: "composite" @@ -20,18 +17,16 @@ runs: with: python-version: ${{ inputs.python-version }} - - name: Install pipx - run: | - python -m pip install --upgrade pip - python -m pip install pipx - python -m pipx ensurepath - continue-on-error: true - shell: bash + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + version: "0.7.8" + enable-cache: true - - name: Install Poetry with pipx - run: pipx install poetry==${{ inputs.poetry-version }} - continue-on-error: true - shell: bash + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} - name: Update pyproject.toml to fix NumPy path run: | @@ -39,12 +34,10 @@ runs: cat pyproject.toml # Optionally, verify the change shell: bash - - name: Install dependencies - run: poetry install - continue-on-error: true - shell: bash + - name: Install the project + run: uv sync --locked --all-extras --dev - - name: Run Test - run: poetry run pytest - continue-on-error: true - shell: bash + - name: Run tests + run: uv run pytest + continue-on-error: false + shell: bash \ No newline at end of file From 340bf478cde3f7e4136e7bf9a1e7cd0cdf669271 Mon Sep 17 00:00:00 2001 From: Rinaldo Rex Date: Mon, 2 Jun 2025 19:37:52 +0530 Subject: [PATCH 2/4] fix(python-lint): add shell property --- python-lint/action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python-lint/action.yml b/python-lint/action.yml index 22805e5..9e38357 100644 --- a/python-lint/action.yml +++ b/python-lint/action.yml @@ -26,12 +26,15 @@ runs: - name: Install the project run: uv sync --locked --all-extras --dev + shell: bash - name: Run Ruff format run: uv run ruff format --check . + shell: bash - name: Sort imports run: uv run ruff check --select I --diff . + shell: bash - name: Run mypy run: uv run mypy . From 7b603be951cad653429fac3490855bf5e2f555a0 Mon Sep 17 00:00:00 2001 From: Rinaldo Rex Date: Mon, 2 Jun 2025 19:38:59 +0530 Subject: [PATCH 3/4] fix(python-test): add shell property --- python-test/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/python-test/action.yml b/python-test/action.yml index 96736c8..2dc2584 100644 --- a/python-test/action.yml +++ b/python-test/action.yml @@ -36,6 +36,7 @@ runs: - name: Install the project run: uv sync --locked --all-extras --dev + shell: bash - name: Run tests run: uv run pytest From 04f156cb6e003ea1a1d0d6071df932ab3f401d06 Mon Sep 17 00:00:00 2001 From: Rinaldo Rex Date: Mon, 2 Jun 2025 19:41:53 +0530 Subject: [PATCH 4/4] minor: enable continue-on-error for linting --- python-lint/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python-lint/action.yml b/python-lint/action.yml index 9e38357..a47b0a6 100644 --- a/python-lint/action.yml +++ b/python-lint/action.yml @@ -30,13 +30,15 @@ runs: - name: Run Ruff format run: uv run ruff format --check . + continue-on-error: true # Added so to provide lenience while linting shell: bash - name: Sort imports run: uv run ruff check --select I --diff . + continue-on-error: true # Added so to provide lenience while linting shell: bash - name: Run mypy run: uv run mypy . - continue-on-error: true #Added so to provide lineance while lint + continue-on-error: true # Added so to provide lenience while linting shell: bash