Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Init hatch-pin-jumpstarter hook#435

Merged
mangelajo merged 7 commits intomainfrom
version-pin
May 5, 2025
Merged

Init hatch-pin-jumpstarter hook#435
mangelajo merged 7 commits intomainfrom
version-pin

Conversation

@NickCao
Copy link
Copy Markdown
Collaborator

@NickCao NickCao commented Apr 30, 2025

Summary by CodeRabbit

  • New Features
    • Introduced a new build plugin that automatically pins certain dependencies' versions during the build process.
  • Chores
    • Added a new package for the build plugin and integrated it into the build configuration across all relevant packages.
    • Updated workspace configuration to include the new build plugin package.
    • Modified test commands to handle specific exit codes gracefully.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2025

Walkthrough

A new Hatch plugin, hatch-pin-jumpstarter, has been introduced to the workspace. This plugin provides a build hook that pins any dependency starting with "jumpstarter" to the current package version during source distribution builds. The plugin reads and modifies the pyproject.toml metadata to enforce exact version pinning for matching dependencies. It is implemented in Python and registered via the Hatch plugin system. All relevant pyproject.toml files for packages in the workspace have been updated to include hatch-pin-jumpstarter as a build dependency and to configure the new build hook. The workspace root configuration also now recognizes the new package as a workspace source.

Changes

Files / Groups Change Summary
packages/hatch-pin-jumpstarter/pyproject.toml Added new project configuration for the hatch-pin-jumpstarter plugin, including metadata, dependencies, and entrypoint.
packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py Added the PinJumpstarter build hook plugin implementing BuildHookInterface and the registration function.
packages/jumpstarter-*/pyproject.toml
(all jumpstarter packages and drivers)
Updated build system requirements to include hatch-pin-jumpstarter and added [tool.hatch.build.hooks.pin_jumpstarter] configuration.
pyproject.toml (workspace root) Added hatch-pin-jumpstarter as a workspace source in [tool.uv.sources].
Makefile Modified pkg-test-% target to allow pytest exit code 5 without failing the target.
__templates__/driver/pyproject.toml.tmpl Updated build system requirements to include hatch-pin-jumpstarter and added build hook configuration.

Sequence Diagram(s)

sequenceDiagram
    participant BuildTool as Hatch Build Tool
    participant Plugin as PinJumpstarter Plugin
    participant Package as Package Metadata

    BuildTool->>Plugin: Register build hook (on build)
    BuildTool->>Plugin: initialize(version, build_data)
    Plugin->>Package: Read pyproject.toml metadata
    Plugin->>Package: For each dependency starting with "jumpstarter", pin version to current
    Plugin->>BuildTool: Provide modified metadata file for build
    BuildTool->>Plugin: finalize(version, build_data, artifact_path)
    Plugin->>Plugin: Remove temporary modified metadata file
Loading

Suggested reviewers

  • mangelajo

Poem

In the garden of builds, a new seed is sown,
PinJumpstarter hops in, dependencies grown.
With a twitch of a nose and a clever little hook,
It pins all the jumpstarters—just take a look!
Now every package knows its place and time,
Thanks to a rabbit and some versioning rhyme.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit ccba089
🔍 Latest deploy log https://app.netlify.com/sites/jumpstarter-docs/deploys/68125bad061a820008d925e2
😎 Deploy Preview https://deploy-preview-435--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@NickCao NickCao marked this pull request as draft April 30, 2025 15:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
packages/jumpstarter-imagehash/pyproject.toml (1)

27-28: Suggest pinning plugin version for reproducible builds
Consider adding a version constraint for hatch-pin-jumpstarter in the build-system.requires to avoid future breakages when a new release is published.

Apply this diff (replace X.Y.Z with the actual plugin version):

-[build-system]
-requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter"]
+[build-system]
+requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter>=X.Y.Z"]
 build-backend = "hatchling.build"
packages/jumpstarter-driver-opendal/pyproject.toml (1)

29-30: Suggest pinning plugin version for reproducible builds
Consider adding a version constraint for hatch-pin-jumpstarter in the build-system.requires to avoid future breakages when a new release is published.

-[build-system]
-requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter"]
+[build-system]
+requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter>=X.Y.Z"]
 build-backend = "hatchling.build"
packages/jumpstarter-cli/pyproject.toml (1)

43-44: Suggest pinning plugin version for reproducible builds
It’s a good practice to pin hatch-pin-jumpstarter to a specific version in build-system.requires to ensure consistent builds across environments.

-[build-system]
-requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter"]
+[build-system]
+requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter>=X.Y.Z"]
 build-backend = "hatchling.build"
packages/jumpstarter-driver-sdwire/pyproject.toml (1)

31-32: Suggest pinning plugin version for reproducible builds
To prevent unexpected breakages when the plugin is updated, specify a version constraint for hatch-pin-jumpstarter in the build requirements.

-[build-system]
-requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter"]
+[build-system]
+requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter>=X.Y.Z"]
 build-backend = "hatchling.build"
packages/jumpstarter-protocol/pyproject.toml (1)

35-36: Suggest pinning plugin version for reproducible builds
Pinning hatch-pin-jumpstarter to a specific version in build-system.requires will help maintain reproducible builds as the plugin evolves.

-[build-system]
-requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter"]
+[build-system]
+requires = ["hatchling", "hatch-vcs", "hatch-pin-jumpstarter>=X.Y.Z"]
 build-backend = "hatchling.build"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a25ddd and fc47b0e.

📒 Files selected for processing (33)
  • packages/hatch-pin-jumpstarter/pyproject.toml (1 hunks)
  • packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py (1 hunks)
  • packages/jumpstarter-all/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli-admin/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli-common/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli-driver/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-can/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-composite/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-corellium/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-dutlink/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-flashers/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-http/pyproject.toml (2 hunks)
  • packages/jumpstarter-driver-network/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-opendal/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-power/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-probe-rs/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-pyserial/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-qemu/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-raspberrypi/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-sdwire/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-shell/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-snmp/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-tftp/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-uboot/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-ustreamer/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-yepkit/pyproject.toml (1 hunks)
  • packages/jumpstarter-imagehash/pyproject.toml (1 hunks)
  • packages/jumpstarter-kubernetes/pyproject.toml (1 hunks)
  • packages/jumpstarter-protocol/pyproject.toml (1 hunks)
  • packages/jumpstarter-testing/pyproject.toml (1 hunks)
  • packages/jumpstarter/pyproject.toml (1 hunks)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: e2e
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter Dockerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-utils Dockerfile.utils)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-dev .devfile/Containerfile)
🔇 Additional comments (64)
pyproject.toml (1)

34-36: Register hatch-pin-jumpstarter as a workspace source
You’ve added the new plugin under [tool.uv.sources]. Ensure that the path (packages/hatch-pin-jumpstarter) aligns with your repo layout so all workspace operations can locate the plugin.

packages/jumpstarter-driver-dutlink/pyproject.toml (2)

43-45: Include hatch-pin-jumpstarter in build-system requirements
Adding the plugin to the build-system.requires ensures it’s available at build time. Confirm compatibility with your existing Hatch versions and that the plugin is installed when invoking hatch build.


46-48: Configure the pin_jumpstarter metadata hook
The [tool.hatch.metadata.hooks.pin_jumpstarter] section correctly names the hook. Verify that the hook key matches the entry point defined in the hatch-pin-jumpstarter package so it’s invoked during metadata generation.

packages/jumpstarter-driver-flashers/pyproject.toml (2)

43-45: Add hatch-pin-jumpstarter to the flasher driver build-system
You’ve extended the build requirements to include the new plugin. Ensure that builds for this package now pick up the version-pinning behavior without regressions.


49-50: Set up the pin_jumpstarter hook configuration
This hook block matches the expected format. Double-check that the hook name is consistent across all packages to avoid any typos that could skip the pinning step.

packages/jumpstarter-driver-uboot/pyproject.toml (2)

38-40: Declare hatch-pin-jumpstarter as a build requirement
Including the plugin here ensures U-Boot driver builds will trigger dependency pinning. Please validate that the new requirement doesn’t conflict with other build plugins or backends.


41-43: Register the pin_jumpstarter hook for U-Boot driver
The hook block is correctly formatted. Confirm that your entry-point name in the plugin’s setup matches this hook identifier.

packages/jumpstarter-kubernetes/pyproject.toml (2)

33-35: Extend build-system requirements with hatch-pin-jumpstarter
This update ensures the Kubernetes package will use the new pinning logic. Verify that CI builds still pass and that no additional backends need configuration.


36-38: Add the pin_jumpstarter metadata hook
The hook section aligns with the plugin’s contract. Please ensure the hook ordering in pyproject.toml does not interfere with other Hatch hooks you may have.

packages/jumpstarter-driver-raspberrypi/pyproject.toml (2)

31-32: Build-system hook dependency added as expected.

The new hatch-pin-jumpstarter plugin has been correctly included alongside hatchling and hatch-vcs. This ensures the pinning hook will be available during the build.


34-36: Metadata hook configuration is correct.

The [tool.hatch.metadata.hooks.pin_jumpstarter] section properly names the hook as pin_jumpstarter, matching the plugin’s entry point. No issues found.

packages/jumpstarter-driver-yepkit/pyproject.toml (2)

36-37: Build-system hook dependency added as expected.

hatch-pin-jumpstarter is now declared alongside the existing build requirements, ensuring the hook is installed in the Yepkit driver package.


42-43: Metadata hook configuration is correct.

The new [tool.hatch.metadata.hooks.pin_jumpstarter] block correctly defines the hook name. Configuration aligns with the other Jumpstarter packages.

packages/jumpstarter-cli-driver/pyproject.toml (2)

38-39: Build-system hook dependency added as expected.

The hatch-pin-jumpstarter plugin is now included in the build-system requirements. This matches the pattern established for other drivers.


41-42: Metadata hook configuration is correct.

The [tool.hatch.metadata.hooks.pin_jumpstarter] section is properly set up with the hook name pin_jumpstarter. All good.

packages/jumpstarter-driver-network/pyproject.toml (2)

52-53: Build-system hook dependency added as expected.

Including hatch-pin-jumpstarter in the build-system requirements ensures the metadata hook is available for the Network driver package.


55-57: Metadata hook configuration is correct.

The pin_jumpstarter metadata hook is configured consistently with the plugin’s entry point. No further changes needed.

packages/jumpstarter-driver-tftp/pyproject.toml (2)

41-42: Build-system hook dependency added as expected.

The hatch-pin-jumpstarter plugin is declared alongside the existing build tools, aligning this package with the new workspace-wide hook.


44-46: Metadata hook configuration is correct.

The [tool.hatch.metadata.hooks.pin_jumpstarter] section is properly defined. The hook name matches the plugin's registration.

packages/jumpstarter-driver-shell/pyproject.toml (2)

33-34: Verify inclusion of the new build dependency
The [build-system] block now includes "hatch-pin-jumpstarter" alongside hatchling and hatch-vcs. This correctly ensures the plugin is available during the build.


36-37: Ensure metadata hook name matches plugin registration
The [tool.hatch.metadata.hooks.pin_jumpstarter] section declares name = "pin_jumpstarter". Please confirm that the plugin’s entry point registers this exact hook name so Hatch will load it as intended.

packages/jumpstarter-driver-probe-rs/pyproject.toml (2)

31-32: Verify inclusion of the new build dependency
The [build-system] block now includes "hatch-pin-jumpstarter" alongside hatchling and hatch-vcs. This correctly ensures the plugin is available during the build.


37-38: Ensure metadata hook name matches plugin registration
The [tool.hatch.metadata.hooks.pin_jumpstarter] section declares name = "pin_jumpstarter". Please confirm that the plugin’s entry point registers this exact hook name so Hatch will load it as intended.

packages/jumpstarter-cli-common/pyproject.toml (2)

39-40: Verify inclusion of the new build dependency
The [build-system] block now includes "hatch-pin-jumpstarter" alongside hatchling and hatch-vcs. This correctly ensures the plugin is available during the build.


42-43: Ensure metadata hook name matches plugin registration
The [tool.hatch.metadata.hooks.pin_jumpstarter] section declares name = "pin_jumpstarter". Please confirm that the plugin’s entry point registers this exact hook name so Hatch will load it as intended.

packages/jumpstarter-driver-power/pyproject.toml (2)

29-30: Verify inclusion of the new build dependency
The [build-system] block now includes "hatch-pin-jumpstarter" alongside hatchling and hatch-vcs. This correctly ensures the plugin is available during the build.


32-33: Ensure metadata hook name matches plugin registration
The [tool.hatch.metadata.hooks.pin_jumpstarter] section declares name = "pin_jumpstarter". Please confirm that the plugin’s entry point registers this exact hook name so Hatch will load it as intended.

packages/jumpstarter-cli-admin/pyproject.toml (2)

34-35: Verify inclusion of the new build dependency
The [build-system] block now includes "hatch-pin-jumpstarter" alongside hatchling and hatch-vcs. This correctly ensures the plugin is available during the build.


37-38: Ensure metadata hook name matches plugin registration
The [tool.hatch.metadata.hooks.pin_jumpstarter] section declares name = "pin_jumpstarter". Please confirm that the plugin’s entry point registers this exact hook name so Hatch will load it as intended.

packages/jumpstarter-imagehash/pyproject.toml (1)

30-31: Approve metadata hook configuration
The new [tool.hatch.metadata.hooks.pin_jumpstarter] section correctly registers the pin_jumpstarter hook, matching the plugin’s entry point.

packages/jumpstarter-driver-opendal/pyproject.toml (1)

32-33: Approve metadata hook configuration
The [tool.hatch.metadata.hooks.pin_jumpstarter] block is correctly set up and matches the plugin’s hook name.

packages/jumpstarter-cli/pyproject.toml (1)

46-47: Approve metadata hook configuration
The new metadata hook declaration properly references pin_jumpstarter, aligning with the plugin’s registration.

packages/jumpstarter-driver-sdwire/pyproject.toml (1)

34-35: Approve metadata hook configuration
The [tool.hatch.metadata.hooks.pin_jumpstarter] section is correctly added and uses the expected hook name.

packages/jumpstarter-protocol/pyproject.toml (1)

38-39: Approve metadata hook configuration
The hook registration under [tool.hatch.metadata.hooks.pin_jumpstarter] is set up correctly and matches the plugin’s entry point.

packages/jumpstarter/pyproject.toml (2)

47-49: Add hatch-pin-jumpstarter to build-system requires
The new build dependency for the pin_jumpstarter plugin is correctly included in build-system.requires. This ensures the metadata hook will be available during package builds.


50-52: Configure the pin_jumpstarter metadata hook
The [tool.hatch.metadata.hooks.pin_jumpstarter] section is properly declared with the expected hook name. No further changes are needed here.

packages/jumpstarter-all/pyproject.toml (2)

53-55: Add hatch-pin-jumpstarter to build-system requires
Including hatch-pin-jumpstarter in the build requirements is correct and aligns with the new plugin integration in this meta-package.


56-58: Declare the pin_jumpstarter metadata hook
The metadata hook configuration for pin_jumpstarter is properly specified. This will enable dependency pinning during builds.

packages/jumpstarter-driver-corellium/pyproject.toml (2)

33-35: Add hatch-pin-jumpstarter to build-system requires
The plugin dependency has been correctly added to the build system requirements, ensuring that corellium driver builds will pin jumpstarter-* dependencies as intended.


36-38: Configure the pin_jumpstarter metadata hook
The pin_jumpstarter hook is declared under [tool.hatch.metadata.hooks.pin_jumpstarter] with the correct name. This matches the plugin’s entry point.

packages/jumpstarter-driver-http/pyproject.toml (2)

31-33: Add hatch-pin-jumpstarter to build-system requires
The new build-system requirement is correctly added alongside existing Hatch backends. This will enable pinning for HTTP driver builds.


42-44: Declare the pin_jumpstarter metadata hook
The metadata hook block is correctly configured to use pin_jumpstarter. No further updates are necessary here.

packages/jumpstarter-testing/pyproject.toml (2)

29-31: Add hatch-pin-jumpstarter to build-system requires
The plugin dependency has been added correctly, ensuring that test package builds will pin the jumpstarter-* dependencies.


32-34: Configure the pin_jumpstarter metadata hook
The hook configuration is properly declared; this integration will apply the version pinning as expected during testing package builds.

packages/jumpstarter-driver-snmp/pyproject.toml (2)

38-38: Build dependency correctly added
The new plugin hatch-pin-jumpstarter is appropriately included in build-system.requires, ensuring the metadata hook will be available during the package build process.


40-41:

Details

✅ Verification successful

Verify hook configuration matches plugin entry point
Please confirm that the hook identifier pin_jumpstarter aligns with the entry-point defined in the hatch-pin-jumpstarter plugin implementation.

Run the following script to verify the entry point registration:


🏁 Script executed:

#!/bin/bash
# Verify plugin entry-point for the metadata hook
rg -n "pin_jumpstarter" -n packages/hatch-pin-jumpstarter

Length of output: 255


Hook configuration validated
The pin_jumpstarter hook identifier in packages/jumpstarter-driver-snmp/pyproject.toml matches the entry-point in packages/hatch-pin-jumpstarter (both the pyproject.toml entry and PLUGIN_NAME in __init__.py). No changes required.

packages/jumpstarter-driver-pyserial/pyproject.toml (2)

37-37: Build dependency correctly added
The hatch-pin-jumpstarter plugin has been added to the build-system.requires list as intended, making the pinning hook available at build time.


40-41:

Details

✅ Verification successful

Verify hook configuration matches plugin entry point
Double-check that the [tool.hatch.metadata.hooks.pin_jumpstarter] section and its name = "pin_jumpstarter" value correspond exactly to the hook declared by the plugin.

You can run:


🏁 Script executed:

#!/bin/bash
# Search for the hook registration in the plugin package
rg -n "pin_jumpstarter" -n packages/hatch-pin-jumpstarter

Length of output: 255


Hook configuration is correct

The pin_jumpstarter hook in packages/jumpstarter-driver-pyserial/pyproject.toml matches the plugin’s entry point:

  • In packages/hatch-pin-jumpstarter/pyproject.toml:
    pin_jumpstarter = "hatch_pin_jumpstarter"
  • In packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py:
    PLUGIN_NAME = "pin_jumpstarter"

No changes required.

packages/jumpstarter-driver-composite/pyproject.toml (2)

30-30: Build dependency correctly added
Including hatch-pin-jumpstarter in build-system.requires is correct and consistent with other drivers, ensuring the hook is present during builds.


32-34:

Details

✅ Verification successful

Verify hook configuration matches plugin entry point
Ensure the metadata hook section [tool.hatch.metadata.hooks.pin_jumpstarter] uses the exact hook name that the plugin exposes.

Run this to confirm:


🏁 Script executed:

#!/bin/bash
# Validate hook identifier in plugin
rg -n "pin_jumpstarter" -n packages/hatch-pin-jumpstarter

Length of output: 255


Hook configuration is correct
The hook name pin_jumpstarter in packages/jumpstarter-driver-composite/pyproject.toml matches the PLUGIN_NAME = "pin_jumpstarter" defined in packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py, so no changes are needed.

packages/jumpstarter-driver-qemu/pyproject.toml (2)

43-43: Build dependency correctly added
The new hatch-pin-jumpstarter plugin is correctly declared in build-system.requires, aligning this driver with the pinning workflow.


45-47:

Details

✅ Verification successful

Verify hook configuration matches plugin entry point
Please verify that the hook name pin_jumpstarter in this TOML matches the hook registration in the plugin package.

Suggested check:


🏁 Script executed:

#!/bin/bash
# Search for hook registration in hatch-pin-jumpstarter
rg -n "pin_jumpstarter" -n packages/hatch-pin-jumpstarter

Length of output: 255


Hook name pin_jumpstarter is correctly configured
Verified that the hook name in packages/jumpstarter-driver-qemu/pyproject.toml matches the plugin entry point:

  • packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/init.py:
    ‑ PLUGIN_NAME = "pin_jumpstarter"
  • packages/hatch-pin-jumpstarter/pyproject.toml (line 20):
    ‑ pin_jumpstarter = "hatch_pin_jumpstarter"

No changes required.

packages/jumpstarter-driver-ustreamer/pyproject.toml (2)

27-27: Build dependency correctly added
The addition of hatch-pin-jumpstarter to build-system.requires is appropriate and ensures this driver participates in the pinning hook.


29-31:

Details

✅ Verification successful

Verify hook configuration matches plugin entry point
Confirm that the [tool.hatch.metadata.hooks.pin_jumpstarter] section and name = "pin_jumpstarter" setting correspond exactly to the hook defined by the plugin.

Run the following:


🏁 Script executed:

#!/bin/bash
# Validate hook identifier in the plugin package
rg -n "pin_jumpstarter" -n packages/hatch-pin-jumpstarter

Length of output: 255


Hook configuration validated
The name = "pin_jumpstarter" in packages/jumpstarter-driver-ustreamer/pyproject.toml matches the plugin’s PLUGIN_NAME = "pin_jumpstarter" (and its entry in packages/hatch-pin-jumpstarter/pyproject.toml). No changes needed.

packages/jumpstarter-driver-can/pyproject.toml (2)

32-33: Build dependency addition looks good.

The addition of "hatch-pin-jumpstarter" to the build system requirements is appropriate and aligns with the PR objective to enable the new metadata hook.


35-36: Metadata hook configuration is correctly set up.

The new metadata hook section with name = "pin_jumpstarter" properly configures the hook to pin dependencies starting with "jumpstarter" to the current package version during build.

packages/hatch-pin-jumpstarter/pyproject.toml (5)

1-8: Project metadata looks good.

The project metadata is well-defined with appropriate name, version, description, and author information.


9-9: Consider the Python version requirement.

The Python requirement of >=3.12 is quite high and might limit compatibility with environments that haven't upgraded to Python 3.12 yet. Check if this is intentional or if a lower version would be sufficient.


10-13: Dependencies look appropriate.

The dependencies on hatchling and packaging with minimum version requirements are well-specified for the functionality being implemented.


15-17: Build system configuration is correct.

Using hatchling as the build backend is appropriate for this Hatch plugin.


19-20: Entry point registration is correct.

The entry point for the Hatch plugin system is properly defined, mapping "pin_jumpstarter" to the "hatch_pin_jumpstarter" module.

packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py (3)

1-5: Imports are appropriate.

The necessary imports from hatchling and packaging modules are correctly included for the plugin implementation.


7-9: Class definition looks good.

The PinJumpstarter class correctly implements the MetadataHookInterface with the appropriate PLUGIN_NAME.


21-23: Hook registration looks good.

The hook registration function is correctly decorated with @hookimpl and returns the PinJumpstarter class.

Comment thread packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py Outdated
@NickCao NickCao marked this pull request as ready for review April 30, 2025 17:20
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py (2)

16-24: 🛠️ Refactor suggestion

Add minimal docstrings and defensive parsing for robustness
initialize performs non-trivial I/O and metadata mutation but is undocumented and assumes all dependency strings are parse-able. A short docstring plus a try/except RequirementParseError (or generic Exception) would make the hook easier to maintain and prevent a single malformed requirement from aborting the build.


25-30: ⚠️ Potential issue

Replacing specifiers instead of intersecting avoids contradictory pins
req.specifier &= SpecifierSet(f"=={self.metadata.version}") intersects the existing specifiers with an exact pin.
If a package already requires, e.g., >=1.2, the intersection becomes >=1.2,==1.3.0 which is unsatisfiable and will break downstream installs.
Use assignment to overwrite existing specifiers:

-                    req.specifier &= SpecifierSet(f"=={self.metadata.version}")
+                    # Overwrite any existing range with an exact pin
+                    req.specifier = SpecifierSet(f"=={self.metadata.version}")
🧹 Nitpick comments (3)
packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py (1)

32-37: Prefer a context-managed temp-file to guarantee close on exceptions

-        f = NamedTemporaryFile(delete=False)
-        tomli_w.dump(metadata, f)
-        f.close()
+        with NamedTemporaryFile(delete=False) as f:
+            tomli_w.dump(metadata, f)

This shortens the code and prevents a leaked file descriptor if tomli_w.dump raises.

__templates__/driver/pyproject.toml.tmpl (1)

32-37: Consider version-capping build dependencies for deterministic builds
hatch-pin-jumpstarter is added without a version specifier. If a future major release introduces breaking changes, template-generated packages may fail to build.
Example:

requires = ["hatchling>=1.24,<2", "hatch-vcs>=0.5,<1", "hatch-pin-jumpstarter>=0.1,<1"]
Makefile (1)

27-28: Use test builtin for clarity & portability
The current construct works, but a slightly clearer/shorter idiom is:

	uv run --isolated --directory $< pytest || test $$? -eq 5

[ … ] is a synonym for test; the latter avoids the additional brackets.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc47b0e and ccba089.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (34)
  • Makefile (1 hunks)
  • __templates__/driver/pyproject.toml.tmpl (1 hunks)
  • packages/hatch-pin-jumpstarter/pyproject.toml (1 hunks)
  • packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py (1 hunks)
  • packages/jumpstarter-all/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli-admin/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli-common/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli-driver/pyproject.toml (1 hunks)
  • packages/jumpstarter-cli/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-can/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-composite/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-corellium/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-dutlink/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-flashers/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-http/pyproject.toml (2 hunks)
  • packages/jumpstarter-driver-network/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-opendal/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-power/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-probe-rs/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-pyserial/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-qemu/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-raspberrypi/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-sdwire/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-shell/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-snmp/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-tftp/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-uboot/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-ustreamer/pyproject.toml (1 hunks)
  • packages/jumpstarter-driver-yepkit/pyproject.toml (1 hunks)
  • packages/jumpstarter-imagehash/pyproject.toml (1 hunks)
  • packages/jumpstarter-kubernetes/pyproject.toml (1 hunks)
  • packages/jumpstarter-protocol/pyproject.toml (1 hunks)
  • packages/jumpstarter-testing/pyproject.toml (1 hunks)
  • packages/jumpstarter/pyproject.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (31)
  • packages/jumpstarter-driver-yepkit/pyproject.toml
  • packages/jumpstarter-driver-network/pyproject.toml
  • packages/jumpstarter-driver-raspberrypi/pyproject.toml
  • packages/jumpstarter-driver-flashers/pyproject.toml
  • packages/jumpstarter-driver-tftp/pyproject.toml
  • packages/jumpstarter-cli/pyproject.toml
  • packages/jumpstarter-driver-dutlink/pyproject.toml
  • packages/jumpstarter-driver-qemu/pyproject.toml
  • packages/jumpstarter-driver-uboot/pyproject.toml
  • packages/jumpstarter-driver-probe-rs/pyproject.toml
  • packages/jumpstarter-driver-shell/pyproject.toml
  • packages/jumpstarter-cli-common/pyproject.toml
  • packages/jumpstarter-driver-can/pyproject.toml
  • packages/jumpstarter-imagehash/pyproject.toml
  • packages/jumpstarter-driver-power/pyproject.toml
  • packages/jumpstarter-all/pyproject.toml
  • packages/jumpstarter/pyproject.toml
  • packages/jumpstarter-driver-snmp/pyproject.toml
  • packages/jumpstarter-driver-pyserial/pyproject.toml
  • packages/jumpstarter-kubernetes/pyproject.toml
  • packages/jumpstarter-testing/pyproject.toml
  • packages/jumpstarter-cli-admin/pyproject.toml
  • packages/jumpstarter-driver-composite/pyproject.toml
  • packages/jumpstarter-driver-sdwire/pyproject.toml
  • packages/jumpstarter-driver-opendal/pyproject.toml
  • packages/jumpstarter-driver-http/pyproject.toml
  • packages/jumpstarter-driver-corellium/pyproject.toml
  • packages/jumpstarter-driver-ustreamer/pyproject.toml
  • packages/jumpstarter-cli-driver/pyproject.toml
  • packages/hatch-pin-jumpstarter/pyproject.toml
  • packages/jumpstarter-protocol/pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: e2e
  • GitHub Check: pytest-matrix (3.13)
  • GitHub Check: pytest-matrix (3.11)
  • GitHub Check: pytest-matrix (3.12)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-utils Dockerfile.utils)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter Dockerfile)
🔇 Additional comments (1)
packages/hatch-pin-jumpstarter/src/hatch_pin_jumpstarter/__init__.py (1)

43-44: Guard against missing key to avoid KeyError in finalize
If an exception is raised before build_data["__hatch_pin_jumpstarter_tempfile"] is set, finalize will crash.

f = build_data.get("__hatch_pin_jumpstarter_tempfile")
if f:
    os.unlink(f.name)

Comment thread Makefile
for i, dep in enumerate(metadata["project"]["dependencies"]):
req = Requirement(dep)
if req.name.startswith("jumpstarter"):
req.specifier &= SpecifierSet(f"=={self.metadata.version}")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice!

Comment thread Makefile
@mangelajo mangelajo merged commit 09ab82f into main May 5, 2025
19 checks passed
@mangelajo mangelajo added the backport release-0.6 Backport PR to release-0.6 branch label May 5, 2025
@jumpstarter-backport-bot
Copy link
Copy Markdown

Successfully created backport PR for release-0.6:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport release-0.6 Backport PR to release-0.6 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants