Skip to content

feat: Integrate Pixi for improved CI/CD and update project configuration #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 20, 2025

Conversation

jjjermiah
Copy link
Contributor

@jjjermiah jjjermiah commented Mar 16, 2025

similar to snakemake/snakemake-interface-common#58

closed #62 in favor of smaller, more focussed PRs to ensure no breaking changes

This PR: Setup pixi and workspace for now.

Future PRs: Iterate over type issues after the the interface-common mypy issues are addressed

  • the type-check step in the GHA will be uncommented once the type errors are fixed

Note: the two modified python files are just formatting

Summary by CodeRabbit

  • Chores
    • Refined the package publishing process with corrected package naming and enhanced build, check, and distribution steps.
    • Consolidated continuous integration tasks by merging formatting, linting, and testing into a unified quality-control workflow.
    • Updated version control settings to automatically manage generated and environment-specific files.

Copy link
Contributor

coderabbitai bot commented Mar 16, 2025

📝 Walkthrough

Walkthrough

The changes update repository configuration, CI workflows, and code formatting. The configuration files now include entries to treat certain generated files appropriately. Both release and test GitHub workflows have been refactored to replace Poetry commands with Pixi commands, update job names and checkout actions, and adjust steps for building and publishing distributions to PyPI. Minor code changes also refactor assertion statements into a concise, single-line format without altering functionality.

Changes

File(s) Change Summary
.gitattributes, .gitignore Added a new entry in .gitattributes for pixi.lock (set as binary with YAML syntax and generated) and new ignore rules in .gitignore for .pixi and *.egg-info.
.github/workflows/...release-please.yml, .github/workflows/...test.yml Updated job names (e.g., renaming publish to publish-pypi and consolidating formatting into quality-control), updated checkout action from v3 to v4, replaced Poetry steps with Pixi commands (installation, build, testing), corrected package name, and added permissions in the test workflow.
snakemake_interface_storage_plugins/... Refactored assertion statements in both storage_object.py and tests.py to a single-line format while preserving their original logic.

Sequence Diagram(s)

Release Workflow

sequenceDiagram
    participant CI as CI System
    participant Repo as Repository
    participant Pixi as Pixi Tool
    participant PyPI as PyPI Registry

    CI->>Repo: Checkout repository (actions/checkout@v4)
    CI->>Pixi: Install Pixi (prefix-dev/[email protected])
    CI->>Pixi: Run build command ("pixi run --environment publish check-build")
    CI->>PyPI: Publish distribution (pypa/gh-action-pypi-publish@release/v1)
Loading

Test Workflow

sequenceDiagram
    participant CI as CI System
    participant Repo as Repository
    participant Pixi as Pixi Tool

    %% Quality-Control Job
    CI->>Repo: Checkout repository (actions/checkout@v4)
    CI->>Pixi: Install Pixi
    CI->>Pixi: Run formatting and linting commands ("pixi run" commands)
    
    %% Testing Job
    CI->>Repo: Checkout repository (actions/checkout@v4)
    CI->>Pixi: Install Pixi
    CI->>Pixi: Execute test suite ("pixi run" command)
Loading

Assessment against linked issues

Objective Addressed Explanation
Improved version control settings for specific file types (62)
Streamlined CI workflows by consolidating quality checks (62)
Updated ignore rules to exclude additional development artifacts (62)
Enhanced documentation within the codebase (62) No documentation changes were observed.
Improved type annotations and assertions for better code clarity (62) Only formatting changes to assertions were made.

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

🪧 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 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.

Copy link
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

🧹 Nitpick comments (1)
.gitignore (1)

162-165: Review Pixi-Related Ignore Entries

The addition of the new entries to ignore .pixi directories and *.egg-info files is appropriate for the move to Pixi. One point to verify is whether keeping a poetry.lock entry here is still necessary given the intended migration; if not, consider removing it or documenting its role.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9e83fea and c5dbcc1.

⛔ Files ignored due to path filters (2)
  • pixi.lock is excluded by !**/*.lock
  • pyproject.toml is excluded by !pyproject.toml
📒 Files selected for processing (6)
  • .gitattributes (1 hunks)
  • .github/workflows/release-please.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • snakemake_interface_storage_plugins/storage_object.py (1 hunks)
  • snakemake_interface_storage_plugins/tests.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest ...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • snakemake_interface_storage_plugins/storage_object.py
  • snakemake_interface_storage_plugins/tests.py
🔇 Additional comments (14)
.gitattributes (1)

1-2: Validate pixi.lock Configuration

The new entry for pixi.lock is well configured—marking it as a binary file, assigning YAML syntax highlighting, and indicating that it is generated. This setup should help avoid merge conflicts and unexpected diffs in CI/CD contexts.

snakemake_interface_storage_plugins/tests.py (1)

59-61: Refined Assertion Statement

The updated assertion for checking that store_only and retrieve_only are not both set simultaneously is clear and concise. Ensure that the test suite includes cases to trigger this assertion when misconfiguration occurs.

snakemake_interface_storage_plugins/storage_object.py (1)

95-97: Optimized Assertion in cache_key Method

The reformatting of the assertion in the cache_key method improves readability without altering functionality. The concise structure makes it easier to confirm that no cache key is generated when a custom local path is set.

.github/workflows/test.yml (5)

10-15: CI Permissions Setup

The newly added permissions for contents, checks, issues, and pull-requests ensure that the workflow has the appropriate access rights. This setup is clear and aligns well with the requirements for integrated CI/CD.


16-29: Streamlined Quality-Control Job with Pixi Integration

The quality-control job now uses checkout@v4 and installs Pixi with the specified version and environment. Switching from Poetry commands to Pixi for formatting and linting is well executed and simplifies the overall CI configuration.


30-43: Efficient Quality-Control Steps

The steps for running Ruff format and linter via Pixi (with the proper environment flag) are a good example of streamlining the CI process. This update removes redundancy and aligns with the pixi-driven workflow paradigm.


44-46: Concise Quality-Control Reporting

The final step that echoes a success message ("All quality control checks passed") provides a clear, simple indicator of job success without unnecessary complexity.


47-61: Updated Testing Job Using Pixi

The testing job mirrors the quality-control job by installing Pixi and executing tests with the new Pixi command (pixi run --environment dev test --show-capture=all -s -vv). This consistency helps maintain a unified CI/CD approach. Make sure that any dependencies or environment-specific settings needed by the tests are covered by the Pixi installation step.

.github/workflows/release-please.yml (6)

18-18: Update Package Name to Correct Typo
The package name has been corrected from the misspelled version "snakemake-interface-stroage-plugins" to "snakemake-interface-storage-plugins". This ensures that the downstream publishing process targets the correct package.


20-24: Introduce New Job "publish-pypi" with Conditional Execution
A new job named publish-pypi has been added. It is configured to run on ubuntu-latest, depends on the release-please job, and conditionally executes only when a release is created. This aligns well with the updated CI/CD flow.


26-27: Upgrade Checkout Action to v4
The checkout step now uses actions/checkout@v4 instead of v3. This update should provide improved performance and additional features. Ensure that this version is stable for your project’s workflows.


28-32: Integrate Pixi Installation Step
The new step installs Pixi using prefix-dev/[email protected] with the parameters environments: publish and pixi-version: v0.42.1. This configuration correctly sets up the environment for subsequent build and check tasks in the CI/CD pipeline.


34-37: Refactor Build Step to Use Pixi Command
The build step has been updated to "Build source and wheel distribution + check build" by replacing the Poetry command with pixi run --environment publish check-build. This refactor aligns with the migration away from Poetry and streamlines the distribution build process.


39-43: Adopt PyPI Publish Action for Secure Distribution Release
The final step now employs the pypa/gh-action-pypi-publish@release/v1 action to publish the distribution to PyPI. This method is secure and leverages the GitHub Action ecosystem to automate the publishing process.

@jjjermiah jjjermiah moved this to In review in Roadmap Mar 17, 2025
@jjjermiah jjjermiah self-assigned this Mar 17, 2025
Copy link
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

🧹 Nitpick comments (2)
.github/workflows/test.yml (2)

38-42: Mypy Step Commented Out: Reminder

The mypy type-checking step is currently commented out. As noted in the PR description, this is temporary until the mypy issues are resolved in the interface-common repository. Remember to re-enable this step once type-check fixes are in place to maintain comprehensive CI coverage.


43-45: Collect QC Step: Optional Logging Consideration

The “Collect QC” step simply echoes a success message. While this can improve clarity in logs, consider whether this step is necessary if success is otherwise determined by the Pixi commands’ exit statuses. It might be redundant if logging isn’t critical.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c5dbcc1 and 7a66ef6.

⛔ Files ignored due to path filters (1)
  • pyproject.toml is excluded by !pyproject.toml
📒 Files selected for processing (4)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • snakemake_interface_storage_plugins/storage_object.py (1 hunks)
  • snakemake_interface_storage_plugins/tests.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • snakemake_interface_storage_plugins/tests.py
  • snakemake_interface_storage_plugins/storage_object.py
  • .gitignore
🔇 Additional comments (7)
.github/workflows/test.yml (7)

10-15: Permissions Block Verification

The newly added permissions block grants explicit access (contents: read, checks: write, issues: write, pull-requests: write) for the workflow. Please verify that these permission levels meet the minimum required for the Pixi integration and do not exceed your project's security policies.


16-28: Quality-Control Job: Pixi Setup

The quality-control job now uses the updated checkout action (v4) and installs Pixi (via prefix-dev/[email protected]) with the specified environment and version parameters. This setup appears consistent with your CI/CD modernization effort. Please confirm that the Pixi version (v0.42.1) and the environment setting align with your project requirements.


29-33: Ruff Format Step: Formatting Check

The “Ruff Format” step now uses pixi run --environment dev format --check to validate formatting. The use of if: always() ensures this check is executed regardless of earlier steps, which can be beneficial for continuous feedback. Ensure that the command wraps up the intended formatter settings.


34-38: Ruff Lint Step: Linting Check

The “Ruff lint” step leverages Pixi to run linting with the --diff flag, enabling a clear identification of code issues. Confirm that this diff output aligns with your review process and that the linting configuration meets your project’s standards.


46-50: Testing Job: Checkout Consistency

In the testing job, the checkout step uses actions/checkout@v4, matching the quality-control job’s version. This consistency is good for reproducibility. Just verify that the updated version does not introduce unexpected behaviors.


51-56: Testing Job: Pixi Installation

The testing job again installs Pixi using the same action and parameters as in the quality-control job. This ensures consistency across CI tasks. Confirm that these settings satisfy both quality and testing requirements.


57-59: Run Tests Step: Command Flags Verification

The “Run tests” step uses pixi run --environment dev test --show-capture=all -s -vv to execute tests with comprehensive output. Check that these flags provide the necessary verbosity for debugging, and that they do not lead to overly verbose logs or performance overhead during CI runs.

@jjjermiah jjjermiah merged commit ff1120a into snakemake:main Mar 20, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Roadmap Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants