feat: setup pixi, move to src layout, run ruff format once#58
feat: setup pixi, move to src layout, run ruff format once#58jjjermiah merged 6 commits intosnakemake:mainfrom
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the 📝 WalkthroughWalkthroughThis PR introduces modifications in configuration and source files. The updates include a new entry in Changes
Sequence Diagram(s)Release WorkflowsequenceDiagram
participant Repo as Repository
participant GA as GitHub Actions Runner
participant Pixi as Pixi Environment
participant Publish as PyPI Publish Action
Repo->>GA: Checkout repository (actions/checkout@v4)
GA->>Pixi: Set up Pixi (prefix-dev/setup-pixi@v0.8.3)
GA->>Pixi: Build package (pixi run --environment publish check-build)
GA->>Publish: Publish package (pypa/gh-action-pypi-publish@release/v1)
Test WorkflowsequenceDiagram
participant Repo as Repository
participant GA as GitHub Actions Runner
participant Pixi as Pixi Environment
participant QC as Quality Control Steps
participant Test as Test Runner
Repo->>GA: Checkout repository (actions/checkout@v4)
GA->>Pixi: Install Pixi for quality control
GA->>QC: Run quality checks (Ruff Format & Ruff lint)
QC->>GA: Return QC results (Collect QC)
GA->>Pixi: Install Pixi for testing
GA->>Test: Execute tests using Pixi
Possibly related issues
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
pixi.lockis excluded by!**/*.lockpyproject.tomlis excluded by!pyproject.toml
📒 Files selected for processing (9)
.gitattributes(1 hunks).github/workflows/release-please.yml(1 hunks).github/workflows/test.yml(1 hunks).gitignore(1 hunks)src/snakemake_interface_common/exceptions.py(1 hunks)src/snakemake_interface_common/plugin_registry/__init__.py(1 hunks)src/snakemake_interface_common/plugin_registry/plugin.py(1 hunks)src/snakemake_interface_common/plugin_registry/tests.py(2 hunks)src/snakemake_interface_common/rules.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 theselfargument of methods.
Do not suggest type annotation of theclsargument of classmethods.
Do not suggest return type annotation if a function or method does not contain areturnstatement.
src/snakemake_interface_common/exceptions.pysrc/snakemake_interface_common/plugin_registry/__init__.pysrc/snakemake_interface_common/plugin_registry/tests.pysrc/snakemake_interface_common/plugin_registry/plugin.pysrc/snakemake_interface_common/rules.py
🔇 Additional comments (15)
.gitattributes (1)
1-2: LGTM: Appropriate Git attributes for pixi.lock fileThis configuration correctly sets up Git attributes for the
pixi.lockfile, marking it as a binary file for merge purposes, setting YAML syntax highlighting, and indicating it's a generated file. This aligns with the PR objective of setting up pixi for dependency management..gitignore (1)
162-165: LGTM: Proper ignores for pixi environment filesAdding ignores for
.pixidirectory and*.egg-infofiles is appropriate for the transition to pixi and the new src layout. These entries ensure that environment-specific and build-related files are properly excluded from version control.src/snakemake_interface_common/exceptions.py (1)
31-34: LGTM: Improved formatting of the conditional statementThe reformatting of the
isinstanceparameters improves readability while maintaining the same functionality. This change aligns with the PR objective of running ruff formatter on the codebase.src/snakemake_interface_common/plugin_registry/__init__.py (1)
130-131:Details
✅ Verification successful
Verify function call sites for API compatibility
Similarly, the
expected_attributesmethod has been changed from an abstract property to a standard abstract method with inline ellipsis. Verify that all call sites have been updated accordingly.
🏁 Script executed:
#!/bin/bash # Search for usages of expected_attributes as a property vs method echo "Searching for usages of expected_attributes as a property..." rg "\.expected_attributes\b(?!\()" -t py echo -e "\nSearching for usages of expected_attributes as a method..." rg "\.expected_attributes\(" -t pyLength of output: 715
API Call-Site Verification for
expected_attributesAfter reviewing the usage across the codebase, the update is verified. The abstract method is now correctly being invoked—with the call site in
src/snakemake_interface_common/plugin_registry/__init__.pyusingself.expected_attributes(). No legacy property-style accesses were detected.Please ensure any additional modules or future call sites also invoke it as a method.
src/snakemake_interface_common/plugin_registry/plugin.py (1)
64-64: LGTM! Style improvements aligned with formatting standardization.The changes to abstract method declarations make the code more concise by moving the ellipsis to the same line as the method signature. This is consistent with modern Python style and aligns with the PR's objective to run ruff format.
Also applies to: 68-68, 72-72
src/snakemake_interface_common/rules.py (1)
8-8: LGTM! Consistent style improvements across the codebase.These changes follow the same pattern as in other files, moving the ellipsis to the same line as the method signature for abstract methods. This creates a more concise code style while maintaining type annotations.
Also applies to: 12-12, 16-16
.github/workflows/release-please.yml (1)
25-28: LGTM! Successfully migrated from Poetry to Pixi for the release workflow.The changes to the release workflow appropriately implement Pixi for dependency management and build processes:
- Updated checkout action to v4 with full history (fetch-depth: 0)
- Added Pixi installation with the specific environment and version
- Updated build and publish steps to use Pixi commands
- Used the latest PyPI publish action
These changes align with the PR's objective to set up Pixi and modernize the workflow.
Also applies to: 29-34, 35-38, 39-43
.github/workflows/test.yml (6)
10-14: LGTM! Good security practice adding explicit permissions.Adding explicit permissions follows GitHub Actions best practices and improves the security posture of the workflow. The permissions granted are appropriate for a CI workflow.
17-17: LGTM! More descriptive job name.Renaming from "formatting" to "quality-control" better reflects the expanded scope of the job, which now includes formatting, linting, and potentially type checking.
21-29: LGTM! Successfully migrated to Pixi for the testing workflow.The changes appropriately set up Pixi with the development environment and caching enabled, which should improve workflow performance. Using the latest checkout action (v4) is also a good practice.
30-43: LGTM! Comprehensive quality control setup with Ruff.The implementation of Ruff for both formatting and linting is well-structured:
- Using
if: always()ensures all checks run regardless of previous failures- The commented-out Mypy step aligns with the PR's goal to enforce type annotations
- These checks provide a solid foundation for code quality
44-45: LGTM! Good practice to add a collection step.Adding a final step to verify all quality control checks have passed provides clear feedback on the overall status of the code quality checks.
50-60: LGTM! Streamlined testing setup with Pixi.The testing job has been updated to use Pixi consistently with the rest of the workflow:
- Using the latest checkout action
- Installing Pixi with caching enabled
- Running tests with verbose output for better debugging
This approach centralizes dependency management in Pixi, making the workflow more maintainable.
src/snakemake_interface_common/plugin_registry/tests.py (2)
17-17: Consistent formatting for abstract methods looks good.The abstract method declarations have been updated to use a more concise single-line ellipsis format rather than multiline placeholders. This change improves code readability while maintaining the same functionality and proper type annotations.
Also applies to: 20-20, 23-23, 26-26, 29-29
43-45: Assertion formatting change looks good.The multi-line formatting of the assertion statement helps improve readability while preserving the original functionality.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/test.yml (1)
38-42: Commented-Out Mypy Step – Consider Cleanup
The block for the Mypy type-check step is commented out. If type-checking via Mypy is no longer part of the routine (or will be handled separately), consider removing these commented lines to reduce clutter. Otherwise, add a clarifying comment to explain why they are retained.Suggested cleanup diff:
- # - name: Mypy - # if: always() - # run: | - # pixi run --environment dev type-check
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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: Permissions Block Added
The new permissions block assigns minimal required permissions (contents: read, checks: write, issues: write, pull-requests: write). This appears correct and helps enforce least privilege for the workflow.
17-18: Job Renaming to Quality-Control
The job previously named “formatting” has been renamed to “quality-control,” reflecting the expanded scope of quality checks. This improves clarity regarding the job’s responsibilities.
20-22: Checkout Step Updated
The “Check out the code” step now usesactions/checkout@v4, which is an improvement over the previous version. Ensure that this version meets the project’s needs.
23-28: Pixi Installation in Quality-Control Job
The new “Install Pixi” step correctly usesprefix-dev/setup-pixi@v0.8.3with the specified environment (dev) and Pixi version (v0.42.1). This aligns with the PR objectives of shifting dependency management from Poetry to Pixi.
29-33: Ruff Format Step Added
The “Ruff Format” step leverages Pixi to run formatting checks (pixi run --environment dev format --check). This change appears well integrated and ensures code formatting is validated.
34-38: Ruff Lint Step Added
The addition of the “Ruff lint” step, executingpixi run --environment dev lint --diff, is appropriate for enforcing linting standards in the codebase.
43-45: Collect QC Step Looks Good
The “Collect QC” step simply echoes a confirmation message that quality control checks have passed. This step is straightforward and serves its purpose.
49-50: Testing Job – Checkout Step
The testing job includes a checkout step usingactions/checkout@v4, ensuring consistency with the quality-control job.
51-56: Testing Job – Pixi Installation
The testing job mirrors the quality-control job by installing Pixi with the same configuration (prefix-dev/setup-pixi@v0.8.3, environment: dev, pixi-version: v0.42.1), which maintains consistency across the workflow.
57-59: Run Tests Command Configured Correctly
The “Run tests” step executespixi run --environment dev test --show-capture=all -s -vv, enabling verbose output and capturing test details. This configuration should aid in debugging test failures.
…g ignore_missing_imports
🤖 I have created a release *beep* *boop* --- ## [1.18.0](v1.17.4...v1.18.0) (2025-03-27) ### Features * setup pixi, move to src layout, run ruff format once ([#58](#58)) ([95d1d8d](95d1d8d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
NOTE: This PR depends on #58 to be merged first This PR fixes all the mypy complaints **within the repo** This allows future PRs to start addressing any discrepencies between the types annotated so far and all the concrete implementations throughout the `interface` plugins <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Enhanced the automation pipeline with a new type-checking step for improved quality control. - **Refactor** - Improved type safety and clarity across various components, including error handling, logging, and plugin management. - **Documentation** - Added detailed documentation and utility methods to the `SettingsEnumBase` class for better clarity. These behind-the-scenes improvements help ensure a smoother, more dependable experience for our users. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
This is the first iteration of PRs to start enforcing type annotations.
The move to the src layout also helps with the finicky nature of pytest-cov
While mypy type-checking is possible, there are currently ~50 issues to be addressed
mypy output
I've also realized that there are some inconsistencies between some of the abstract classes and their concrete implementations in the
snakemake-interface-*-pluginsrepos which need to be addressed.I will begin addressing these in a set of separate PRs and iterate over them.
Summary by CodeRabbit
Chores
Refactor
Tests