Skip to content

fix: streamline inheritance annotation#23

Merged
johanneskoester merged 4 commits into
mainfrom
fix/protocols
Sep 12, 2025
Merged

fix: streamline inheritance annotation#23
johanneskoester merged 4 commits into
mainfrom
fix/protocols

Conversation

@johanneskoester

@johanneskoester johanneskoester commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added capability checks to determine if an environment can be deployed, cached, or pinned.
    • More consistent deployment path resolution and environment configuration handling.
  • Refactor

    • Centralized environment metadata and prefixes for cache, deployment, and pin files.
    • Simplified subclassing for deployable, pinnable, and cacheable environments, improving consistency and extensibility.
    • Reduced brittle runtime assertions for more robust operations.
  • Tests

    • Updated tests to use capability-based checks and renamed the archive test to cache.

@coderabbitai

coderabbitai Bot commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@johanneskoester has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1a2ee and 76ea04f.

📒 Files selected for processing (2)
  • snakemake_interface_software_deployment_plugins/__init__.py (7 hunks)
  • snakemake_interface_software_deployment_plugins/tests.py (3 hunks)
📝 Walkthrough

Walkthrough

Refactors the core environment base API to centralize context and capability checks, adding explicit attributes, a post-init hook, and per-instance is_deployable/is_pinnable/is_cacheable methods. Inheritance is unified under EnvBase. Assertions are relaxed/centralized. Tests are updated to use capability methods and rename archive test to cache.

Changes

Cohort / File(s) Summary
Core API refactor
snakemake_interface_software_deployment_plugins/__init__.py
EnvBase expanded with explicit context fields, path-prefixes, optional hash stores, ClassVar cache, and post_init. Adds is_deployable/is_pinnable/is_cacheable. PinnableEnvBase/CacheableEnvBase/DeployableEnvBase now inherit from EnvBase. Removes several isinstance assertions; adjusts deployment path assertion. Typing imports updated to include ClassVar.
Tests updated for capability checks
snakemake_interface_software_deployment_plugins/tests.py
Tests switch from isinstance checks to is_cacheable/is_pinnable/is_deployable guards with follow-up assertions. Rename test_archive to test_cache. _deploy now accepts EnvBase and guards via is_deployable before asserting DeployableEnvBase and deploying.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Test
  participant Env as EnvBase instance
  participant Cache as CacheableEnvBase
  participant Pin as PinnableEnvBase
  participant Deploy as DeployableEnvBase

  Test->>Env: is_cacheable()
  alt cacheable
    Test->>Cache: cache_assets()
  end

  Test->>Env: is_pinnable()
  alt pinnable
    Test->>Pin: pin()
  end

  Test->>Env: is_deployable()
  alt deployable
    Test->>Deploy: deploy()
  else not deployable
    Note over Test,Env: Skip deployment
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/protocols

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

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

@johanneskoester johanneskoester changed the title fix: use Protocol type fix: streamline inheritance annotation Sep 12, 2025
@johanneskoester johanneskoester merged commit 2a10a4a into main Sep 12, 2025
4 checks passed
@johanneskoester johanneskoester deleted the fix/protocols branch September 12, 2025 13:18
johanneskoester pushed a commit that referenced this pull request Sep 12, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.7.3](v0.7.2...v0.7.3)
(2025-09-12)


### Bug Fixes

* use Protocol type
([#23](#23))
([2a10a4a](2a10a4a))

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