Skip to content

Conversation

johanneskoester
Copy link
Contributor

@johanneskoester johanneskoester commented Sep 30, 2025

Summary by CodeRabbit

  • New Features

    • CLI help now groups plugin settings by plugin type (e.g., “ plugin settings”), making options easier to find when multiple plugins are installed.
  • Refactor

    • Updated plugin registration to pass plugin type into CLI setup for clearer labeling.
  • Chores

    • Minor internal improvements to support plugin-type detection.
  • Note

    • Third-party plugins may need to update their CLI integration to remain compatible with this release.

Copy link

coderabbitai bot commented Sep 30, 2025

📝 Walkthrough

Walkthrough

Adds plugin type derivation in PluginRegistryBase, validates package names (stubbed), and propagates plugin_type into plugin CLI registration. Updates PluginBase.register_cli_args to accept plugin_type and adjust the argument group label. Registry now computes plugin_type via regex on its class name and passes it to each plugin during CLI arg registration.

Changes

Cohort / File(s) Summary
Registry core
src/snakemake_interface_common/plugin_registry/__init__.py
Added import of re. Added PluginRegistryBase.get_plugin_type() using regex on registry class name; raises ValueError if unmatched. Added is_valid_plugin_package_name(name) returning True. In register_cli_args, compute plugin_type and pass to plugins’ register_cli_args(argparser, plugin_type).
Plugin base
src/snakemake_interface_common/plugin_registry/plugin.py
Changed PluginBase.register_cli_args signature to include plugin_type: str. Updated argument group label to include plugin_type. No other logic changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User as User
  participant CLI as CLI (ArgumentParser)
  participant Registry as PluginRegistryBase
  participant Plugin as PluginBase

  User->>CLI: Invoke CLI
  CLI->>Registry: register_cli_args(argparser)
  rect rgba(230,240,255,0.5)
    note right of Registry: New: derive plugin_type via regex from registry class name
    Registry->>Registry: plugin_type = get_plugin_type()
  end
  loop For each plugin
    Registry->>Plugin: register_cli_args(argparser, plugin_type)
    note over Plugin: Uses plugin_type in group label<br/>"<plugin> <plugin_type> plugin settings"
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “feat: extend API for plugin type validation” concisely conveys that the pull request adds a new feature to the API related to plugin validation, reflecting the introduction of methods for deriving plugin types and validating plugin names; it uses clear, specific phrasing without unnecessary detail and aligns with the core objective of extending the API’s validation capabilities.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/get-plugin-type

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
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@johanneskoester johanneskoester changed the title feat: extend API in order to allow checking whether a plugin name is valid feat: extend API for plugin type validation Sep 30, 2025
@johanneskoester johanneskoester changed the title feat: extend API for plugin type validation feat: extend API for plugin type validation and retrieval Sep 30, 2025
Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d716954 and 48301df.

⛔ Files ignored due to path filters (1)
  • pyproject.toml is excluded by !pyproject.toml
📒 Files selected for processing (2)
  • src/snakemake_interface_common/plugin_registry/__init__.py (3 hunks)
  • src/snakemake_interface_common/plugin_registry/plugin.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

⚙️ CodeRabbit configuration file

**/*.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.

Files:

  • src/snakemake_interface_common/plugin_registry/plugin.py
  • src/snakemake_interface_common/plugin_registry/__init__.py
🧬 Code graph analysis (2)
src/snakemake_interface_common/plugin_registry/plugin.py (1)
src/snakemake_interface_common/plugin_registry/__init__.py (1)
  • register_cli_args (65-70)
src/snakemake_interface_common/plugin_registry/__init__.py (1)
src/snakemake_interface_common/plugin_registry/plugin.py (2)
  • register_cli_args (133-192)
  • name (84-84)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: quality-control
🔇 Additional comments (4)
src/snakemake_interface_common/plugin_registry/plugin.py (1)

154-156: LGTM! Improved argument group label clarity.

The argument group label now includes the plugin type (e.g., "executor plugin settings" instead of just "plugin settings"), making it more descriptive for users.

src/snakemake_interface_common/plugin_registry/__init__.py (3)

7-7: LGTM! Required import for plugin type derivation.

The re module is correctly imported to support the regex-based plugin type extraction in get_plugin_type.


68-70: LGTM! Plugin type correctly derived and propagated.

The method now derives the plugin type once and passes it to each plugin's register_cli_args, which aligns with the updated signature in plugin.py.


72-80: Verify naming of PluginRegistry subclasses
No concrete *PluginRegistry subclasses were found in this repo; please manually confirm that any actual registry classes (including those loaded externally) follow the <Type>PluginRegistry naming pattern or adjust the regex to handle edge cases.

@johanneskoester johanneskoester merged commit f641114 into main Sep 30, 2025
7 checks passed
@johanneskoester johanneskoester deleted the feat/get-plugin-type branch September 30, 2025 17:00
johanneskoester pushed a commit that referenced this pull request Sep 30, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.22.0](v1.21.0...v1.22.0)
(2025-09-30)


### Features

* expand variables and user dirs in settings of type Path.
([#83](#83))
([ea3357f](ea3357f))
* extend API for plugin type validation and retrieval
([#82](#82))
([f641114](f641114))


### Bug Fixes

* add help text for user dir and env var expansion
([#85](#85))
([75ff281](75ff281))

---
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant