From 68074de7c68a9029c5a4bd039e79ebe40bbed520 Mon Sep 17 00:00:00 2001 From: Alexandre Boucaud Date: Fri, 8 May 2026 10:43:16 +0200 Subject: [PATCH] fix(ci): add dedicated lint workflow and fix pre-existing mypy errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linting now runs in its own workflow (lint.yml) on a single Python version in parallel with the test matrix, rather than being mixed into tests. Also fixes the mypy errors that would have caused the new workflow to fail on its first run: - Split rocrate.* and astra.* mypy overrides; follow_untyped_imports only on astra.* (applying it to rocrate.* caused no-untyped-call cascades) - Add ignore_missing_imports for daytona_sdk and dotenv (eval-only deps not installed in the dev group) - commands.py: type: ignore[misc] on astra_init.callback() — Click types callback as Optional[Callable] but it is always set at decoration time - eval/build.py: rename result -> dirty to fix CompletedProcess[bytes] vs CompletedProcess[str] type mismatch Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/lint.yml | 33 +++++++++++++++++++++++++++++++++ pyproject.toml | 11 ++++++++++- src/lightcone/cli/commands.py | 2 +- src/lightcone/eval/build.py | 4 ++-- 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..6439a153 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +name: Lint + +on: + push: + branches: [main] + pull_request: + +jobs: + lint: + if: github.event_name == 'push' || github.event.pull_request.draft == false + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up uv + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.13" + enable-cache: true + activate-environment: true + + - name: Configure git credentials for private ASTRA repo + run: git config --global url."https://x-access-token:${{ secrets.ASP_TOKEN }}@github.com/".insteadOf "https://github.com/" + + - name: Install dependencies + run: uv sync --group dev + + - name: Ruff + run: ruff check src/ tests/ + + - name: Mypy + run: mypy src/ diff --git a/pyproject.toml b/pyproject.toml index 4f5f1212..93265ef8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,7 +89,16 @@ ignore_missing_imports = true follow_untyped_imports = true [[tool.mypy.overrides]] -module = ["rocrate.*", "astra.*"] +module = ["rocrate.*"] +ignore_missing_imports = true + +[[tool.mypy.overrides]] +module = ["astra.*"] +ignore_missing_imports = true +follow_untyped_imports = true + +[[tool.mypy.overrides]] +module = ["daytona_sdk", "daytona_sdk.*", "dotenv", "dotenv.*"] ignore_missing_imports = true [tool.pytest.ini_options] diff --git a/src/lightcone/cli/commands.py b/src/lightcone/cli/commands.py index 79471ff1..1f8effbd 100644 --- a/src/lightcone/cli/commands.py +++ b/src/lightcone/cli/commands.py @@ -172,7 +172,7 @@ def init( # src/. We hold off on git init until our own files are in place so # the initial commit captures the full project state. try: - astra_init.callback(directory=directory, no_git=True) + astra_init.callback(directory=directory, no_git=True) # type: ignore[misc] except SystemExit as e: raise click.ClickException( f"astra init failed (exit code {e.code})." diff --git a/src/lightcone/eval/build.py b/src/lightcone/eval/build.py index 499e959f..92ace88a 100644 --- a/src/lightcone/eval/build.py +++ b/src/lightcone/eval/build.py @@ -45,11 +45,11 @@ def _get_git_info(repo_root: Path) -> VersionInfo: pass try: - result = subprocess.run( + dirty = subprocess.run( ["git", "diff", "--quiet", "HEAD"], capture_output=True, cwd=repo_root, ) - info.lightcone_dirty = result.returncode != 0 + info.lightcone_dirty = dirty.returncode != 0 except subprocess.CalledProcessError: info.lightcone_dirty = True