Skip to content

Conversation

@jjjermiah
Copy link
Contributor

@jjjermiah jjjermiah commented Mar 14, 2025

Summary by CodeRabbit

  • Chores
    • Improved version control settings to better handle specific file types during merging and syntax highlighting.
    • Streamlined continuous integration workflows by consolidating quality checks and updating testing processes.
    • Updated ignore rules to automatically exclude additional development artifacts from version control.
    • Enhanced documentation within the codebase for better clarity and maintainability.
    • Improved type annotations and assertions for better code clarity.
    • Renamed and restructured the publish job for PyPI to utilize Pixi for dependency management and publishing.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

📝 Walkthrough

Walkthrough

The changes update project configuration and workflows. In the repository’s attributes, a new entry marks pixi.lock as a binary file with YAML syntax highlighting. The GitHub Actions workflow has been restructured to merge formatting and linting into a single quality-control job, replacing Poetry with Pixi for dependency management, and updating the checkout version. Additional ignore entries have been added in .gitignore, and minor refactorings were applied to the assertion statements in two Snakemake interface modules without altering their functionality.

Changes

File(s) Change Summary
.gitattributes Added an entry for pixi.lock to treat it as a binary file during merges, specify YAML syntax highlighting, and mark it as generated.
.github/workflows/test.yml Restructured workflow jobs by merging formatting and linting into a single quality-control job, replaced Poetry commands with Pixi commands, and updated actions/checkout from v3 to v4.
.gitignore Added new entries to ignore .pixi and *.egg-info files.
snakemake_interface_storage_plugins/
storage_object.py
Updated type annotations and assertions in the StorageObjectBase class, including changes to the _overwrite_local_path attribute and is_valid_query method return value.
snakemake_interface_storage_plugins/
tests.py
Consolidated multi-line assertion statements into single lines in the _test_storage method, maintaining the original logic.
snakemake_interface_storage_plugins/
storage_provider.py
Enhanced documentation, restructured StorageProviderBase as a data class, added new classes, and updated error handling and type annotations.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant Checkout as Checkout Step (v4)
    participant Pixi as Pixi Installation
    participant Ruff as Ruff Check
    participant Mypy as Mypy Check
    participant QC as Quality Control Summary

    GH->>Checkout: Trigger checkout (v4)
    Checkout->>Pixi: Install Pixi tool
    Pixi->>Ruff: Run Ruff for formatting & linting
    Ruff->>Mypy: Execute Mypy for type checking
    Mypy->>QC: Gather results
    QC-->>GH: Echo success if checks pass
Loading
sequenceDiagram
    participant GH as GitHub Actions
    participant Checkout as Checkout Step (v4)
    participant Pixi as Pixi Installation
    participant Test as Test Execution

    GH->>Checkout: Trigger checkout (v4)
    Checkout->>Pixi: Install Pixi tool
    Pixi->>Test: Execute tests via Pixi commands
    Test-->>GH: Return test results
Loading

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f64577 and 6e33e09.

📒 Files selected for processing (1)
  • .github/workflows/release-please.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release-please.yml

🪧 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 (3)
.gitignore (1)

162-166: Clarify the lock file strategy for dependency management.
The new entries for Pixi-related files (.pixi and *.egg-info) are correctly added. However, seeing that poetry.lock is now explicitly listed (instead of being commented out as before), please confirm that including it in version control is intentional given the switch to Pixi for dependency management.

.github/workflows/test.yml (2)

16-29: Streamlined quality-control job using Pixi.
The consolidated quality-control job now leverages Pixi for dependency setup and running quality checks (formatting, lint, type-check) in a clear and organized manner. The updated checkout action (actions/checkout@v4) and Pixi setup (with specific environment and version parameters) are well configured. One point to note: using continue-on-error: true for formatting and linting might hide issues if strict enforcement is desired. Please double-check if this behavior is intentional.


60-61: Remove trailing spaces.
Static analysis flagged trailing spaces (e.g., at line 61). Removing these trailing spaces will help maintain conformity with YAML lint rules.

-          cache: true
-      
+          cache: true
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 61-61: trailing spaces

(trailing-spaces)

📜 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 76d3225.

⛔ 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/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/tests.py
  • snakemake_interface_storage_plugins/storage_object.py
🪛 GitHub Actions: CI
snakemake_interface_storage_plugins/tests.py

[error] 20-20: Skipping analyzing 'snakemake.io': module is installed, but missing library stubs or py.typed marker [import-untyped]

snakemake_interface_storage_plugins/storage_object.py

[error] 12-12: Skipping analyzing 'wrapt': module is installed, but missing library stubs or py.typed marker [import-untyped]


[error] 13-13: Skipping analyzing 'reretry': module is installed, but missing library stubs or py.typed marker [import-untyped]


[error] 16-16: Skipping analyzing 'snakemake_interface_common.exceptions': module is installed, but missing library stubs or py.typed marker [import-untyped]


[error] 17-17: Skipping analyzing 'snakemake_interface_common.logging': module is installed, but missing library stubs or py.typed marker [import-untyped]


[error] 80-80: Incompatible types in assignment (expression has type 'Path', variable has type 'None') [assignment]


[error] 84-84: Incompatible return value type (got 'StorageQueryValidationResult', expected 'bool') [return-value]

🪛 YAMLlint (1.35.1)
.github/workflows/test.yml

[error] 61-61: trailing spaces

(trailing-spaces)

🔇 Additional comments (5)
.gitattributes (1)

1-2: Appropriate configuration for Pixi lock file.
The entry for pixi.lock correctly prevents 3-way merges by marking the file as binary and sets YAML syntax highlighting. This aligns well with the repository’s new dependency management approach.

snakemake_interface_storage_plugins/tests.py (1)

59-61: Enhanced assertion clarity for storage flags.
The consolidated assertion

assert not (self.store_only and self.retrieve_only), (
    "store_only and retrieve_only may not be True at the same time"
)

readably ensures that both flags are not simultaneously set. This concise format improves clarity while retaining the intended functionality.

snakemake_interface_storage_plugins/storage_object.py (1)

95-97: Improved assertion formatting in cache_key.
The change to a multi-line assertion for checking that _overwrite_local_path is None improves readability without altering the logic. The error message is clear and directly attached to the assertion.

.github/workflows/test.yml (2)

10-15: Defined minimal permissions for the workflow.
The new permissions block effectively grants only the necessary rights (e.g., contents: read, checks: write) to the workflow steps. This adheres to the principle of least privilege.


50-64: Updated testing job aligned with Pixi integration.
The testing job is now consistent with the new dependency management approach. The use of actions/checkout@v4 and Pixi for installing dependencies and executing tests (pixi run --environment dev test --show-capture=all -s -vv) is clear and well integrated.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 61-61: trailing spaces

(trailing-spaces)

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: 3

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

55-56: Nitpick: Remove Trailing Whitespace

Static analysis detected trailing spaces on line 56. Please remove any extraneous whitespace to comply with YAML lint guidelines.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 56-56: trailing spaces

(trailing-spaces)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 76d3225 and 78463b9.

📒 Files selected for processing (1)
  • .github/workflows/test.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/test.yml

[error] 56-56: trailing spaces

(trailing-spaces)

🔇 Additional comments (4)
.github/workflows/test.yml (4)

10-15: Permissions Block Configuration: Validate Principle of Least Privilege

The new permissions block specifies read access for contents and write access for checks, issues, and pull-requests. Please verify that these permissions are the minimal ones required for your CI tasks.


16-29: Quality-Control Job Setup: Approved Installation Steps

The restructuring of the quality-control job—with the updated checkout (using actions/checkout@v4) and the "Install Pixi" step (using prefix-dev/[email protected] with proper environment settings and caching enabled)—aligns well with the PR objectives. No issues observed here.


42-44: Quality-Control Summary Step: Clear and Simple

The "Collect QC" step simply echoes a success message. This approach is clear for a pass scenario. If necessary, consider adding more context or output logging for failed runs if that fits your operational needs.


45-59: Testing Job Verification: Consistent Pixi Setup & Test Execution

The testing job now also uses actions/checkout@v4 and installs Pixi with matching configuration (environment dev, version v0.42.1, and caching enabled). The test command:

pixi run --environment dev test --show-capture=all -s -vv

is appropriately set up. Everything here matches the updated quality control approach.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 56-56: trailing spaces

(trailing-spaces)

@jjjermiah jjjermiah linked an issue Mar 14, 2025 that may be closed by this pull request
@jjjermiah
Copy link
Contributor Author

Only 2 mypy errors are left:

$ pixi run type-check
✨ Pixi task (type-check in dev): mypy snakemake_interface_storage_plugins/
snakemake_interface_storage_plugins/storage_provider.py:214: error: Module "snakemake_interface_storage_plugins.storage_object" has no attribute "StorageObjectReadWrite"; maybe "StorageObjectWrite" or "StorageObjectRead"?  [attr-defined]
snakemake_interface_storage_plugins/storage_provider.py:218: error: "StorageProviderBase" has no attribute "storage_object_cls"; maybe "get_storage_object_cls"?  [attr-defined]
Found 2 errors in 1 file (checked 9 source files)

Looks like these mightve been older features

Comment on lines +118 to -77
# Class attributes with type hints
local_prefix: Path
settings: Optional[StorageProviderSettingsBase] = None
keep_local: bool = False
retrieve: bool = True
is_default: bool = False
_rate_limiters: Dict[Any, Throttler] = field(default_factory=dict, init=False)

def __post_init__(self):
"""Hook for subclasses to perform additional initialization.

Subclasses may override this method to perform additional setup
after the base class has been initialized and then call the base
class implementation using `super().__post_init__()`.
"""
try:
local_prefix.mkdir(parents=True, exist_ok=True)
self.local_prefix.mkdir(parents=True, exist_ok=True)
except OSError as e:
raise WorkflowError(
f"Failed to create local storage prefix {local_prefix}", e
f"Failed to create local storage prefix {self.local_prefix}", e
)
self.local_prefix = local_prefix
self.settings = settings
self.keep_local = keep_local
self.retrieve = retrieve
self.is_default = is_default
self._rate_limiters = dict()
self.__post_init__()
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember now why I chose to use init instead of a dataclass. This way, plugins that implement this class can start from scratch with post_init and they cannot accidenally overwrite anything that is done in the post_init of this base class.
I guess you should be able to achieve the same type annotations as with a dataclass by adding the types to the attributes that are defined in init.

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 04a420e and 7f64577.

⛔ Files ignored due to path filters (2)
  • pixi.lock is excluded by !**/*.lock
  • pyproject.toml is excluded by !pyproject.toml
📒 Files selected for processing (1)
  • .github/workflows/release-please.yml (1 hunks)
🔇 Additional comments (5)
.github/workflows/release-please.yml (5)

20-25: Job Renaming and Sequencing Validation.
The renaming of the job to publish-pypi now clearly reflects its purpose. The dependency on release-please via needs: release-please coupled with the conditional check (if: ${{ needs.release-please.outputs.release_created }}) ensures that the publishing job runs only when a release is created. This logic appears solid; just verify that the downstream steps handle the expected artifacts appropriately.


27-28: Checkout Action Upgrade.
Upgrading to actions/checkout@v4 is a sensible update. This change should bring improved performance and security features provided by the newer version.


29-33: Setting Up Pixi for Dependency Management.
The new step to install Pixi using prefix-dev/[email protected] with the parameters environments: publish and pixi-version: v0.42.1 correctly replaces the old Poetry-based approach. This update aligns with the project’s move toward Pixi for dependency management and release tasks.


35-38: Build and Check Command Update.
The build step now runs pixi run --environment publish check-build to generate source and wheel distributions, along with a build check. This new command should be tested to confirm it produces the expected artifacts in the dist/ directory.


40-44: Validate PyPI Publishing Step.
Using pypa/gh-action-pypi-publish@release/v1 for publishing to PyPI is correct. Confirm that the secrets management for PYPI_PASSWORD (using ${{ secrets.PYPI_TOKEN }}) is appropriately configured to secure your credentials.

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

mypy type errors

2 participants