docs(rules): Update script type hint advice#4193
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughDocumentation and inline comments updated: external-script example now recommends importing the ChangesExternal script type-hint docs and stub comments
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Currently I'm not confident I do actually understand that this is correct. |
17f22f6 to
2cef2fa
Compare
|
Ok, I think I understand the problem now and have addressed it in a reasonably backwards compatible manner. Not sure if the type hint in iocontainers should stay, but for the moment that still enables the previous advice, and why force users to update their scripts yet again? |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/snakemake/iocontainers.py`:
- Line 599: Replace the misspelled word "compatability" in the comment that
currently reads "For compatability with old advice, this should probably" with
the correct spelling "compatibility" so the comment becomes "For compatibility
with old advice, this should probably"; update the single-line comment
containing "compatability" to fix codespell CI failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 230a0339-b088-4143-9296-f035b9ddfeff
📒 Files selected for processing (2)
docs/snakefiles/rules.rstsrc/snakemake/iocontainers.py
0e3175c to
5abf845
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/test_script_alternative_type_checking/script.py`:
- Around line 3-6: Ruff flags the runtime-injected name "snakemake" as
undefined; to fix, add a typing-only import guarded by TYPE_CHECKING so you
don't clobber the runtime value: import TYPE_CHECKING from typing, then inside
"if TYPE_CHECKING:" import the Snakemake type (e.g., "from snakemake import
Snakemake") or alias it, and use that type in annotations for the existing
"snakemake" usage; reference symbols: snakemake, TYPE_CHECKING, Snakemake.
In `@tests/tests.py`:
- Around line 2305-2307: The function name test_script_import_snakemake_obj is
duplicated which overrides the earlier test; rename this second function to a
unique name (e.g., test_script_import_snakemake_obj_alternative) or merge its
behavior into the original, and update any references; locate the duplicate by
searching for test_script_import_snakemake_obj and change the function
definition (and any callers) so both tests run independently while keeping the
run(dpath("test_script_alternative_type_checking")) invocation intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 94962088-36e3-4701-8f9b-037feb0d68ef
📒 Files selected for processing (4)
tests/test_script_alternative_type_checking/Snakefiletests/test_script_alternative_type_checking/expected-results/test.txttests/test_script_alternative_type_checking/script.pytests/tests.py
✅ Files skipped from review due to trivial changes (1)
- tests/test_script_alternative_type_checking/expected-results/test.txt
f5ea8d8 to
23f42f9
Compare
23f42f9 to
e5fb140
Compare
|
After this comment by CodeRabbit, I decided to scale this back and just update the line in the docs. |
e5fb140 to
1068a85
Compare
The mentioned mechanism just does not work any more since snakemake#4032 adjusted the preamble.
1068a85 to
414955a
Compare
🤖 I have created a release *beep* *boop* --- ## [9.21.1](v9.21.0...v9.21.1) (2026-05-29) ### Bug Fixes * add default json function to benchmarks ([#4128](#4128)) ([41fab22](41fab22)) * do not rerun when checkpoint job missing but downstream file exists ([#4124](#4124)) ([a060b93](a060b93)) * ensure that error logs contain all available details ([#4183](#4183)) ([74a86e9](74a86e9)) * handle missing pss attribute in benchmark on Windows ([#4160](#4160)) ([da52080](da52080)) * implement Resources.setdefault ([#3968](#3968)) ([2413e99](2413e99)) * reporting remote nodes number ([#3978](#3978)) ([8c534f0](8c534f0)) * resolve pathvars before constructing storage queries ([#3969](#3969)) ([bd15237](bd15237)) * storage temp() file cleanup with RemoteProvider ([#4189](#4189)) ([898bad1](898bad1)) * tolerate FileNotFoundError in drop_iocache ([#4153](#4153)) ([#4191](#4191)) ([ce26b28](ce26b28)) ### Documentation * Added guide on debugging workflows ([#4029](#4029)) ([3d052ae](3d052ae)) * **cli:** Remove broken ref bold markup ([#4204](#4204)) ([1200ebf](1200ebf)) * remove duplicated resources attribute in rules.rst ([#4190](#4190)) ([6c8ecdd](6c8ecdd)) * **rules:** Update script type hint advice ([#4193](#4193)) ([6108712](6108712)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
The described mechanism of importing the type via
from snakemake.script import snakemakejust does not work any more since #4032 adjusted the preamble.To address #4192.
QC
docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).AI-assistance disclosure
I used AI assistance for:
Summary by CodeRabbit