Skip to content

Conversation

@adhami3310
Copy link
Member

No description provided.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 22, 2025

CodSpeed Performance Report

Merging #6063 will not alter performance

Comparing move-pyi-generation-to-initialize-and-add-asserts-on-pyi-contents-to-publish-step (16a73be) with main (b1b450a)

Summary

✅ 8 untouched

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 22, 2025

Greptile Summary

This PR fixes a critical build issue where .pyi stub files were not being included in the published wheel distribution. The fix moves the .pyi file generation from the finalize build hook (which runs after packaging) to the initialize hook (which runs before packaging), ensuring the generated files are present when Hatchling creates the wheel.

Key changes:

  • Moved .pyi generation from finalize to initialize in scripts/hatch_build.py
  • Added verification step in publish workflow to confirm .pyi files exist in the wheel before publishing
  • Updated docstring to reflect the new hook function

The workflow verification will catch any future regressions where .pyi files fail to be included in the distribution.

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • The changes are well-designed and address a clear build system issue. Moving .pyi generation to the initialize hook is the correct approach per Hatchling's build process, and the added verification step provides a safety net against future regressions. The implementation is minimal, focused, and doesn't introduce any logical errors or edge cases.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/publish.yml Added verification step to ensure .pyi files are present in the wheel before publishing
scripts/hatch_build.py Moved .pyi generation from finalize to initialize hook to ensure files exist before packaging

Sequence Diagram

sequenceDiagram
    participant GH as GitHub Actions
    participant UV as UV Build Tool
    participant HB as Hatch Build Hook
    participant HL as Hatchling
    participant PYI as PYI Generator
    
    GH->>UV: uv build
    UV->>HL: Start build process
    HL->>HB: Call initialize() hook
    HB->>HB: Check marker file exists
    alt Marker exists
        HB-->>HL: Skip generation
    else Marker doesn't exist
        HB->>HB: Delete existing .pyi files
        HB->>PYI: Generate .pyi files
        PYI-->>HB: .pyi files created
        HB->>HB: Touch marker file
        HB-->>HL: Ready to build
    end
    HL->>HL: Package wheel with .pyi artifacts
    HL-->>UV: Wheel created
    UV-->>GH: Build complete
    GH->>GH: Verify .pyi files in wheel
    alt .pyi files found
        GH->>GH: Verification passed
        GH->>UV: uv publish
        UV-->>GH: Published to PyPI
    else .pyi files missing
        GH->>GH: Exit with error
    end
Loading

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 22, 2025

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

@adhami3310 adhami3310 merged commit f4561ec into main Dec 22, 2025
48 checks passed
@adhami3310 adhami3310 deleted the move-pyi-generation-to-initialize-and-add-asserts-on-pyi-contents-to-publish-step branch December 22, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants