Skip to content

chore: use Pixi for improved CI/CD and update project configuration #82

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 7 commits into from
Mar 26, 2025

Conversation

jjjermiah
Copy link
Contributor

@jjjermiah jjjermiah commented Mar 16, 2025

similar to snakemake/snakemake-interface-common#58

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 modified base.py file is just format

Summary by CodeRabbit

  • Chores

    • Updated repository settings to ensure proper handling and exclusion of generated assets.
    • Refined the automated release process for building and publishing distributions.
    • Added new entries to the .gitignore file to exclude Pixi-related files and directories.
  • Tests

    • Enhanced the quality control and testing workflows with updated validation steps to improve overall checks, including the transition to using Pixi for dependency management and testing.

Copy link
Contributor

coderabbitai bot commented Mar 16, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pyproject.toml is excluded by !pyproject.toml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

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

📝 Walkthrough

Walkthrough

This pull request updates repository configuration and CI workflows. A new entry in the .gitattributes file now treats the pixi.lock file as binary with YAML syntax highlighting and flags it as generated. GitHub Actions workflows for release and testing have been overhauled: jobs are renamed, the checkout action is upgraded (v3 → v4), and steps previously using Poetry are replaced by Pixi actions for installation, building, quality control, and testing. Additionally, the .gitignore file now ignores .pixi and *.egg-info files, and a condition in a Snakemake executor method has been reordered for clarity.

Changes

File(s) Change Summary
.gitattributes Added entry: pixi.lock merge=binary linguist-language=YAML linguist-generated=true to treat pixi.lock as a generated binary file with YAML highlighting.
.github/workflows/release-please.yml
.github/workflows/test.yml
Updated workflows by renaming jobs (e.g., publishpublish-pypi, formattingquality-control), upgrading checkout from v3 to v4, removing Poetry steps, and adding Pixi installation runs and commands for building, testing, and quality control.
.gitignore Added new ignore rules for .pixi and *.egg-info entries.
snakemake_interface_executor_plugins/.../base.py Reordered conditions in the get_resource_declarations_dict method for improved clarity without altering functionality.

Sequence Diagram(s)

sequenceDiagram
    participant Repo as Repository
    participant CI as GitHub Actions (Release)
    participant PyPI as PyPI Service

    Repo->>CI: Trigger Release Event
    CI->>CI: Checkout Code (v4)
    CI->>CI: Install Pixi (prefix-dev/[email protected])
    CI->>CI: Build source and wheel distribution
    CI->>CI: Check build with Pixi (pixi run --environment publish check-build)
    CI->>PyPI: Publish distribution (pypa/gh-action-pypi-publish)
    Note over CI,PyPI: Publish flow completed.
Loading
sequenceDiagram
    participant Repo as Repository
    participant QC as GitHub Actions (Quality-Control)

    Repo->>QC: Trigger Quality Control Event
    QC->>QC: Checkout Code (v4)
    QC->>QC: Install Pixi
    QC->>QC: Run Ruff Format & Ruff Lint checks
    QC->>QC: Collect QC status message
    Note over QC: Quality control job completed.
Loading
sequenceDiagram
    participant Repo as Repository
    participant Test as GitHub Actions (Testing)

    Repo->>Test: Trigger Test Event
    Test->>Test: Checkout Code (v4)
    Test->>Test: Install Pixi
    Test->>Test: Run tests (pixi run tests)
    Note over Test: Testing job completed.
Loading

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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 (3)
.github/workflows/test.yml (3)

10-15: Review Permissions Block: Verify Least Privilege

The newly added permissions section explicitly grants write access to checks, issues, and pull-requests along with read rights for contents. Please confirm that these permissions are strictly required for your workflow. If not, consider tightening them to adhere to the least-privilege principle.


40-43: Commented Mypy Checks: Future Re-instatement

The mypy type-checking step has been commented out. It would be helpful to include a comment referencing the related PR (e.g., PR 59) or a TODO note so that the rationale and future plan are clear to anyone revisiting this workflow.


44-46: Collect QC Step: Placeholder or Final Intent?

The "Collect QC" step currently echoes a generic message. If this is intended merely as a placeholder, it would be useful to add a TODO or further documentation. Alternatively, consider capturing and summarizing actual QC artifacts if that fits your CI/CD goals.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bb22a21 and dc7d34b.

⛔ Files ignored due to path filters (2)
  • pixi.lock is excluded by !**/*.lock
  • pyproject.toml is excluded by !pyproject.toml
📒 Files selected for processing (5)
  • .gitattributes (1 hunks)
  • .github/workflows/release-please.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • snakemake_interface_executor_plugins/executors/base.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_executor_plugins/executors/base.py
🔇 Additional comments (15)
.gitignore (1)

162-165: Nice additions to support Pixi integration

These changes appropriately extend the gitignore file to handle Pixi environments and Python package metadata, which aligns well with the PR objective of setting up Pixi for improved CI/CD.

snakemake_interface_executor_plugins/executors/base.py (1)

49-50: Clean formatting improvement

The conditional has been split across multiple lines, improving readability without changing functionality. This aligns with the PR description mentioning that changes to base.py are solely formatting changes.

.gitattributes (1)

1-2: Good configuration for Pixi lock file

This is a well-configured Git attributes entry that follows best practices for lock files:

  • Treating it as binary prevents merge conflicts
  • Setting language to YAML ensures proper syntax highlighting
  • Marking it as generated excludes it from language statistics and diffs

This supports the Pixi integration objective of the PR.

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

20-20: More descriptive job name

Renaming from "publish" to "publish-pypi" makes the job's purpose more specific and clear.


25-27: Good practice to update checkout action

Updating from v3 to v4 ensures you're using the latest features and security fixes.


28-32: Clean Pixi setup implementation

Using the official Pixi setup action with specific environment and version is a good approach for CI reliability.


34-37: Good migration from Poetry to Pixi for build step

The build command has been appropriately updated to use Pixi, supporting the overall migration objective.


39-40: Improved approach for PyPI publishing

Using the official PyPA GitHub Action for publishing is an improvement over direct Poetry commands - it's purpose-built for this task and maintained by the Python Packaging Authority.

.github/workflows/test.yml (7)

20-22: Checkout Action Upgrade: Confirm Compatibility

The workflow now uses actions/checkout@v4, which is a good update and aligns with modern practices. Please verify that this upgrade is compatible with the rest of your workflow steps (especially caching if applicable).


23-29: Pixi Installation Step: Configuration Check

This step installs Pixi using the prefix-dev/[email protected] action with environment set to dev, pixi-version v0.42.1, and caching enabled. Ensure that these parameters correctly reflect your desired environment and versioning.


30-34: Ruff Format Step: Consistency with Pixi Usage

The formatting check now invokes pixi run --environment dev format --check with an unconditional execution (if: always()). This aligns well with the switch from Poetry. Please confirm that this command reliably fails the workflow if formatting issues are present.


35-39: Ruff Lint Step: Linting via Pixi

Updating this step to use pixi run --environment dev lint --diff is a good move. Verify that linting output is clear and that any issues cause the job to fail as expected.


50-51: Testing Job – Checkout Step: Consistency Check

The testing job also uses actions/checkout@v4, which maintains consistency across jobs. Ensure that any repository state needed for tests is properly captured after checkout.


52-58: Testing Job – Install Pixi: Consistent Environment Setup

This step mirrors the Pixi installation in the quality-control job, ensuring the test environment is identical. Confirm that the same parameters (environment dev, version v0.42.1, and caching) are suitable for test execution as well.


59-61: Run Tests Command: Verify Verbosity and Outcome

The final testing step now runs pixi run --environment dev test --show-capture=all -s -vv. Ensure that these flags provide the intended level of verbosity and capture, and that the test runner integrates smoothly with your reporting mechanism.

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)
.github/workflows/test.yml (1)

43-44: Quality Control Summary Step
The "Collect QC" step simply echoes that all quality control checks have passed. Consider adding conditional logic to display this message only if all previous steps have succeeded, to more accurately reflect the state of the workflow.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc7d34b and bc4a9c5.

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

10-15: Explicit Permissions Configuration Added
The new permissions block explicitly defines access scopes for contents, checks, issues, and pull-requests. This improves security by enforcing least privilege. Please double-check that these permissions align with your overall project and security policies.


17-17: Renamed Job Improves Clarity
Renaming the job from a previous identifier (likely "formatting") to "quality-control" clearly communicates its role in the workflow. Ensure that any downstream dependencies or documentation are updated accordingly.


20-21: Updated Checkout Action Version
Using actions/checkout@v4 ensures the workflow benefits from the latest fixes and features. Confirm that this version is compatible with other workflow steps and tools used in the project.


23-28: Integrate Pixi Installation Step
The newly added step installs Pixi using prefix-dev/[email protected] with the specified version (v0.42.1) and environment (dev). This change replaces previous Poetry-based dependency management. Verify that these settings fulfill your CI/CD requirements and match the target environment expectations.


29-32: Ruff Format Check Using Pixi
Transitioning the formatting check to use Pixi (with pixi run --environment dev format --check) is a good modernization step. The if: always() directive ensures this check runs regardless of previous step outcomes.


34-37: Ruff Lint Step Updated
The linting command is now executed via Pixi with the command pixi run --environment dev lint --diff and the appropriate condition. This aligns with the overall move from Poetry to Pixi.


38-42: Mypy Type-Check Temporarily Commented Out
Commenting out the Mypy step is appropriate given the referenced pending type issues (as noted in PR #59). Remember to revisit and re-enable this step after type errors have been resolved.


49-50: Consistent Checkout in Testing Job
The testing job also utilises actions/checkout@v4, ensuring consistency between CI jobs. This is a good practice for aligning workspace setup steps.


51-56: Replicated Pixi Installation in Testing Job
Re-adding the Pixi installation step in the testing job ensures that both quality control and testing environments are set up identically. Confirm that the parameters match those used in the quality control job to avoid environment discrepancies.


57-58: Updated Test Runner Command
The testing step now executes tests using Pixi with enhanced verbosity and output capture (--show-capture=all -s -vv). Verify that these flags provide the desired level of detail for debugging and that they are documented for team members.

@jjjermiah jjjermiah self-assigned this Mar 17, 2025
@jjjermiah jjjermiah moved this to In review in Roadmap Mar 17, 2025
@johanneskoester johanneskoester changed the title feat: Integrate Pixi for improved CI/CD and update project configuration chore: use Pixi for improved CI/CD and update project configuration Mar 26, 2025
@johanneskoester johanneskoester merged commit b1aff28 into snakemake:main Mar 26, 2025
4 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Roadmap Mar 26, 2025
@johanneskoester
Copy link
Contributor

Thanks a lot!

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