Skip to content

Silence type-check import lints for release action#104

Merged
leynos merged 8 commits intopython-lib-release-actionfrom
codex/revise-import-conventions-in-code
Sep 21, 2025
Merged

Silence type-check import lints for release action#104
leynos merged 8 commits intopython-lib-release-actionfrom
codex/revise-import-conventions-in-code

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Sep 21, 2025

Summary

  • adopt the repository typing alias in the release-to-pypi-uv script and helper to satisfy the ICN003 import convention
  • update the associated tests to import typing as typ and adjust annotations accordingly
  • annotate the release scripts' Path imports as runtime dependencies and move test-only Path usage under TYPE_CHECKING to silence TC003 lint

Testing

  • uvx ruff check --select TCH,UP,FA

https://chatgpt.com/codex/tasks/task_e_68cfe1f27f5483228e741d5bf1a256cb

Summary by Sourcery

Silence type-check import lints by adopting the repository typing alias and refining type-only imports across release action scripts and tests

Enhancements:

  • Adopt the typ alias for all typing imports in scripts and tests to satisfy import lint rules
  • Annotate Path imports in release scripts as runtime dependencies and guard test-only Path usage under TYPE_CHECKING
  • Update test fixtures and function signatures to import and use typ.Any consistently

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 21, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • New Features

    • No user-facing changes in this release.
  • Chores

    • Aligned internal typing usage and annotations across release tooling scripts.
    • Added lint suppressions/comments to clarify runtime type usage.
    • Minor control-flow hardening to ensure only valid files are processed.
  • Tests

    • Standardised type hints and imports across test suites.
    • Updated fixtures and helper annotations for consistency; no behavioural changes.
  • Style

    • Minor formatting and import clean-ups to improve readability.

Walkthrough

Update type annotations across scripts and tests to use typing as typ, add noqa comments for Path imports, and modify _iter_files in validate_toml_versions.py to explicitly skip non-file paths before yielding.

Changes

Cohort / File(s) Summary of changes
Release scripts: Path import lint notes
.github/actions/release-to-pypi-uv/scripts/determine_release.py, .github/actions/release-to-pypi-uv/scripts/write_summary.py
Add inline noqa comments to Path imports indicating runtime use for Typer CLI types; no runtime changes.
Validate TOML versions: iterator filtering
.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py
Import typing as typ; change _iter_files return annotation to typ.Iterable[Path]; update control flow to continue on non-files and yield only files.
Test helper: typing alias
.github/actions/release-to-pypi-uv/tests/_helpers.py
Import typing as typ; update load_script_module return type to typ.Any.
Tests: adopt typing alias (Any → typ.Any)
.github/actions/release-to-pypi-uv/tests/test_action_python_version.py, .github/actions/release-to-pypi-uv/tests/test_check_github_release.py, .github/actions/release-to-pypi-uv/tests/test_publish_release.py, .github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py, .github/actions/release-to-pypi-uv/tests/test_write_summary.py
Replace direct Any with typ.Any in imports and annotations; minor formatting tweaks; no behavioural changes. In test_check_github_release.py, adjust DummyResponse annotations and enter return type from string to concrete class.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant VT as validate_toml_versions._iter_files
  participant FS as Filesystem

  Caller->>VT: _iter_files(pattern)
  VT->>FS: glob(pattern)
  loop For each path
    alt Path is a file
      VT-->>Caller: yield Path
    else Path is not a file
      note right of VT: Skip non-file (continue)
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

Typing’s cloak drapes over Any’s glow,
A typ-ed tide where clean hints flow.
Paths get notes, their purpose clear,
Files step forward, dirs disappear.
Tests nod twice, then swiftly pass—
A tidy sweep across the grass.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.27% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed Label the title as an accurate, focused summary of the primary change: silencing type-check import lints for the release action. Confirm that it aligns with the PR edits to adopt the repository typing alias and to annotate Path imports and related test updates. Keep the title concise and unchanged unless you want to explicitly call out the accompanying test modifications.
Description Check ✅ Passed Treat the description as related and sufficient for this lenient check because it clearly states adopting the typing alias, guarding test-only Path imports under TYPE_CHECKING, updating tests, and includes the ruff check command used for validation. Keep the description as-is to inform reviewers of intent and verification steps. No additional detail is required for this check.

Comment @coderabbitai help to get the list of available commands and usage tips.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Sep 21, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 21, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Sep 21, 2025

Reviewer's Guide

This PR adopts the repository typing alias and refactors type imports and annotations across the release action scripts and tests—migrating all typing references to typing as typ, updating annotations to use typ.Any/typ.Iterable, and wrapping type-only Path imports in TYPE_CHECKING guards to satisfy import lint rules.

File-Level Changes

Change Details Files
Unified typing alias usage and annotation updates
  • Replaced from typing import Any with import typing as typ
  • Updated all function and fixture signatures to use typ.Any
  • Changed collection annotations to typ.Iterable[Path] where applicable
  • Refactored multiline test function definitions to group typ annotations
.github/actions/release-to-pypi-uv/tests/test_check_github_release.py
.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py
.github/actions/release-to-pypi-uv/tests/test_publish_release.py
.github/actions/release-to-pypi-uv/tests/test_write_summary.py
.github/actions/release-to-pypi-uv/tests/_helpers.py
.github/actions/release-to-pypi-uv/tests/test_action_python_version.py
.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py
Isolated type-only Path imports under TYPE_CHECKING
  • Moved from pathlib import Path into a if typ.TYPE_CHECKING: block with no-cover pragma
  • Ensured runtime imports only include dependencies used at execution time
.github/actions/release-to-pypi-uv/tests/test_validate_toml_versions.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and found some issues that need to be addressed.

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py:38` </location>
<code_context>


-def _iter_files(pattern: str) -> Iterable[Path]:
+def _iter_files(pattern: str) -> typ.Iterable[Path]:
     candidates = [Path(p) for p in glob.glob(pattern, recursive=True)]
     for path in candidates:
</code_context>

<issue_to_address>
**issue (review_instructions):** Import 'typ' is used without being defined or imported, which breaks DRY and readability.

You must import 'typ' or use the correct module (likely 'typing') for 'Iterable'. This is necessary for code readability and correctness.

<details>
<summary>Review instructions:</summary>

**Path patterns:** `**/*`

**Instructions:**
Keep code DRY, but readable. Use refactoring approaches best suited for the language in question. Context managers and generators for Python; RAII and macros for Rust.

</details>
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@leynos leynos force-pushed the codex/revise-import-conventions-in-code branch from f09622f to 61d72e6 Compare September 21, 2025 14:02
leynos and others added 8 commits September 21, 2025 15:03
* Address review feedback for shellstub imports

* Fix MSYS2 install comments breaking pacman (#89)

* Fix MSYS2 install comments breaking pacman

* Fix Windows llvm-mingw metadata export

* Handle runtime detection timeouts
* Fix rust host detection timeout and Windows bin path

* Add timeout coverage for rust host detection

* Unify runtime probe timeout configuration

* test: capture rustc probe kwargs in timeout test
* Remove inline MSYS2 install comments

* Skip nfpm steps on Windows builds

* Handle nfpm packaging only for Linux
Ignores files generated by the Crush AI agent to prevent them from being tracked in version control.

Adds a symlink to AGENTS.md for discovery by Crush
💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>
…ply resulting fixes

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>
@leynos leynos force-pushed the codex/revise-import-conventions-in-code branch from 61d72e6 to 4006782 Compare September 21, 2025 14:09
@leynos leynos merged commit c334c54 into python-lib-release-action Sep 21, 2025
4 of 7 checks passed
@leynos leynos deleted the codex/revise-import-conventions-in-code branch September 21, 2025 14:10
leynos added a commit that referenced this pull request Sep 21, 2025
* Add toolchain-specific cargo cache key and clean shellstub imports (#88)

* Address review feedback for shellstub imports

* Fix MSYS2 install comments breaking pacman (#89)

* Fix MSYS2 install comments breaking pacman

* Fix Windows llvm-mingw metadata export

* Handle runtime detection timeouts

* Fix rust host detection timeout and Windows bin path (#91)

* Fix rust host detection timeout and Windows bin path

* Add timeout coverage for rust host detection

* Unify runtime probe timeout configuration

* test: capture rustc probe kwargs in timeout test

* Remove inline comments from Windows GNU MSYS2 package list (#99)

* Remove inline MSYS2 install comments

* Skip nfpm steps on Windows builds

* Handle nfpm packaging only for Linux

* Fix Windows invocation of rust-build-release (#102)

* Silence type-check import lints for release action

* Adds ignore rule for Crush agent artifacts

Ignores files generated by the Crush AI agent to prevent them from being tracked in version control.

Adds a symlink to AGENTS.md for discovery by Crush

* Format code after rebase validation to satisfy repo style checks.

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

* fmt: extend fmt target to run ruff check --select D202,I001 --fix; apply resulting fixes

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: Crush <crush@charm.land>
leynos added a commit that referenced this pull request Sep 22, 2025
* Add toolchain-specific cargo cache key and clean shellstub imports (#88)

* Address review feedback for shellstub imports

* Fix MSYS2 install comments breaking pacman (#89)

* Fix MSYS2 install comments breaking pacman

* Fix Windows llvm-mingw metadata export

* Handle runtime detection timeouts

* Fix rust host detection timeout and Windows bin path (#91)

* Fix rust host detection timeout and Windows bin path

* Add timeout coverage for rust host detection

* Unify runtime probe timeout configuration

* test: capture rustc probe kwargs in timeout test

* Remove inline comments from Windows GNU MSYS2 package list (#99)

* Remove inline MSYS2 install comments

* Skip nfpm steps on Windows builds

* Handle nfpm packaging only for Linux

* Fix Windows invocation of rust-build-release (#102)

* Silence type-check import lints for release action

* Adds ignore rule for Crush agent artifacts

Ignores files generated by the Crush AI agent to prevent them from being tracked in version control.

Adds a symlink to AGENTS.md for discovery by Crush

* Format code after rebase validation to satisfy repo style checks.

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

* fmt: extend fmt target to run ruff check --select D202,I001 --fix; apply resulting fixes

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: Crush <crush@charm.land>
leynos added a commit that referenced this pull request Sep 23, 2025
* Add toolchain-specific cargo cache key and clean shellstub imports (#88)

* Address review feedback for shellstub imports

* Fix MSYS2 install comments breaking pacman (#89)

* Fix MSYS2 install comments breaking pacman

* Fix Windows llvm-mingw metadata export

* Handle runtime detection timeouts

* Fix rust host detection timeout and Windows bin path (#91)

* Fix rust host detection timeout and Windows bin path

* Add timeout coverage for rust host detection

* Unify runtime probe timeout configuration

* test: capture rustc probe kwargs in timeout test

* Remove inline comments from Windows GNU MSYS2 package list (#99)

* Remove inline MSYS2 install comments

* Skip nfpm steps on Windows builds

* Handle nfpm packaging only for Linux

* Fix Windows invocation of rust-build-release (#102)

* Silence type-check import lints for release action

* Adds ignore rule for Crush agent artifacts

Ignores files generated by the Crush AI agent to prevent them from being tracked in version control.

Adds a symlink to AGENTS.md for discovery by Crush

* Format code after rebase validation to satisfy repo style checks.

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

* fmt: extend fmt target to run ruff check --select D202,I001 --fix; apply resulting fixes

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: Crush <crush@charm.land>
leynos added a commit that referenced this pull request Sep 24, 2025
* Add toolchain-specific cargo cache key and clean shellstub imports (#88)

* Address review feedback for shellstub imports

* Fix MSYS2 install comments breaking pacman (#89)

* Fix MSYS2 install comments breaking pacman

* Fix Windows llvm-mingw metadata export

* Handle runtime detection timeouts

* Fix rust host detection timeout and Windows bin path (#91)

* Fix rust host detection timeout and Windows bin path

* Add timeout coverage for rust host detection

* Unify runtime probe timeout configuration

* test: capture rustc probe kwargs in timeout test

* Remove inline comments from Windows GNU MSYS2 package list (#99)

* Remove inline MSYS2 install comments

* Skip nfpm steps on Windows builds

* Handle nfpm packaging only for Linux

* Fix Windows invocation of rust-build-release (#102)

* Silence type-check import lints for release action

* Adds ignore rule for Crush agent artifacts

Ignores files generated by the Crush AI agent to prevent them from being tracked in version control.

Adds a symlink to AGENTS.md for discovery by Crush

* Format code after rebase validation to satisfy repo style checks.

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

* fmt: extend fmt target to run ruff check --select D202,I001 --fix; apply resulting fixes

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: Crush <crush@charm.land>
leynos added a commit that referenced this pull request Sep 24, 2025
* Add release-to-pypi-uv composite action

* Document trusted publishing permissions

* Clarify GH_TOKEN handling in README

* Fix local usage example

* Improve GitHub release error handling

* Fix cmd_utils discovery in publish script

* Skip more build caches

* Fail fast on TOML parse errors

* Format release summary output

* Add no-tag error test

* Test TOML parse failures

* Make uv python version configurable

* Document concurrency guard in usage

* Address review feedback with retries and tests

* Improve TOML version validation and test strategy

Extends boolean parsing to support more truthy values when validating dynamic version flags in TOML files. Refactors tests to run in-process with better coverage of various flag values and scenarios, replacing subprocess-based tests for efficiency and detail. Updates action to simplify Python version handling with uv and improves path detection for testing.

These changes make validation logic more robust and enhance test reliability.

* Add cmd-mox users guide

* Use cmd-mox to stub rust build command tests (#92)

* Use cmd-mox for rust build command tests

* Guard cmd-mox integration on Windows

* Refactor cmd-mox helpers into shared conftest

* Apply cmd-mox fake which simplification

* Mark Windows smoke tests as xfail (#94)

* Mark Windows smoke tests as xfail

* Tighten Windows smoke test expectations

* Address reviewer feedback for release-to-pypi-uv action (#98)

* Address review comments for release to PyPI action

* Add tests and docs for python-version handling

* Fix cmd_mox fixture usage and expose dev extra (#101)

* Fix cmd_mox fixture usage and expose dev extras

* Remove pyproject optional dev extra

* Remove Pyright configuration

* Add missing docstrings to release-to-pypi-uv modules (#103)

* Silence type-check import lints for release action (#104)

* Add toolchain-specific cargo cache key and clean shellstub imports (#88)

* Address review feedback for shellstub imports

* Fix MSYS2 install comments breaking pacman (#89)

* Fix MSYS2 install comments breaking pacman

* Fix Windows llvm-mingw metadata export

* Handle runtime detection timeouts

* Fix rust host detection timeout and Windows bin path (#91)

* Fix rust host detection timeout and Windows bin path

* Add timeout coverage for rust host detection

* Unify runtime probe timeout configuration

* test: capture rustc probe kwargs in timeout test

* Remove inline comments from Windows GNU MSYS2 package list (#99)

* Remove inline MSYS2 install comments

* Skip nfpm steps on Windows builds

* Handle nfpm packaging only for Linux

* Fix Windows invocation of rust-build-release (#102)

* Silence type-check import lints for release action

* Adds ignore rule for Crush agent artifacts

Ignores files generated by the Crush AI agent to prevent them from being tracked in version control.

Adds a symlink to AGENTS.md for discovery by Crush

* Format code after rebase validation to satisfy repo style checks.

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

* fmt: extend fmt target to run ruff check --select D202,I001 --fix; apply resulting fixes

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: Crush <crush@charm.land>

* Narrow module fixtures to ModuleType (#105)

* Add docstrings for release-to-pypi-uv tests and helpers (#106)

* Add missing docstrings for release-to-pypi-uv tests

* Simplify cmd-mox typing and streamline docstrings

* Apply formatting

* chore: remove unused imports across scripts and tests

* style(_helpers): alphabetise __all__ tuple

* tests: drop superfluous parentheses from @pytest.fixture usage

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>

* Scope type-checking imports (#111)

* Scope type-checking imports

* Fix lint warnings across release scripts

* Clarify cargo stream capture error

* ci: add lint and format checks

* Install action-validator in CI lint workflow

* Install bun validator packages in CI

* Test full success message for matching versions (#113)

* Address review comments (#116)

* Address review feedback for release-to-pypi-uv actions (#112)

* Address review feedback

* Add CLI coverage for publish and validate scripts

* Add deterministic validation tests and bunx validator checks

* Update ci.yml remove unneeded step

* Fix formatting

* Fix Windows xfail marker removal for pytest 8 (#120)

* Fix Windows xfail marker removal for pytest 8

* Tighten Windows xfail marker filtering

* Handle runtime probe timeouts and expand release tests (#119)

* Handle runtime probe timeouts and expand release tests

* Add _probe_runtime coverage and assert timeout warnings

* Expand TOML skip directories for release validation (#122)

* Expand pyproject skip list handling

* Strengthen TOML and runtime timeout tests

* Assert cargo fallback logs podman failure

* Parameterize skip-directory regression

* Reinforce regression coverage for release tooling (#130)

* Refine skip directory regression parameterization

* Document skip directories and DRY timeout assertions

* Parametrize publish index test

* Refactor runtime timeout tests

* Rebase onto origin/python-lib-release-action and resolve conflicts

- Resolve merge in validate_toml_versions tests by standardizing module loading
- Register dynamically loaded scripts in sys.modules to support reload semantics
- Make toolchain triple test robust to host arch by selecting matching target
- Run formatting, lint, typecheck, and tests to validate integration

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Crush <crush@charm.land>

* Harden release-to-pypi-uv workflow and regression coverage (#134)

* Improve release validation jitter handling

* Adjust runtime fallback host triples per platform

* Make release validation deterministic and configurable

* Rebase python-lib-release-action onto origin/main; resolve conflicts preserving branch intent; drop uv.lock in favor of main; fix tests and typing/lint issues; all tests pass and linters clean

* Close cargo pipes when coverage stream missing (#137)

* Close cargo pipes when missing

* Ensure cargo pipes close on all paths

* Ensure guard closes cargo pipes before exiting

* Handle release script auth failure and multiline outputs (#136)

* Handle release script auth failure and multiline outputs

* Harden windows toolchain setup and extend runtime tests

* Handle release auth errors and tweak toolchain retries

* Fix cross install warning expectation (#139)

* Fix cross install warning assertion

* Harden cross install harness checks

* Sanitize runtime probe timeout and guard actions

* Refine runtime probe helpers and add timeout tests

* Fix runtime probe lint findings

* Share echo recorder fixture across runtime tests

* Update fmt target description (#140)

* Resolve rebase conflicts and align runtime tests with platform/timeouts from main while preserving branch improvements; ensure formatting passes and all tests/linters are green.

💘 Generated with Crush
Co-Authored-By: Crush <crush@charm.land>

---------

Co-authored-by: Payton McIntosh <pmcintosh@df12.net>
Co-authored-by: Crush <crush@charm.land>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant