fix: Support versioned URLs in Asset class and fix missing versions in Snakemake report#3203
fix: Support versioned URLs in Asset class and fix missing versions in Snakemake report#3203johanneskoester merged 6 commits intomainfrom
Conversation
…n Snakemake report
|
Warning Rate limit exceeded@fxwiegand has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 19 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. 📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces enhancements to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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 (
|
|
Please format your code with black: |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
snakemake/assets/__init__.py (1)
166-172: Add docstring to document the get_version method.The implementation is clean and follows good practices. Consider adding a docstring to document the method's purpose, parameters, and return value.
@classmethod def get_version(cls, asset_path: str) -> Optional[str]: + """Retrieve the version of a specified asset. + + Args: + asset_path: The path identifier of the asset in the spec dictionary. + + Returns: + The version string if the asset exists and has a version, None otherwise. + """ if asset_path in cls.spec: return cls.spec[asset_path].version else: return None
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
snakemake/assets/__init__.py(3 hunks)snakemake/report/html_reporter/data/packages.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
snakemake/assets/__init__.py (1)
Pattern **/*.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/report/html_reporter/data/packages.py (1)
Pattern **/*.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.
🔇 Additional comments (2)
snakemake/report/html_reporter/data/packages.py (1)
Line range hint 8-63: Verify version resolution for all package declarations.
The changes to Package.__init__ affect how versions are resolved. Please ensure all packages get proper version information, especially those without explicit versions.
Let's verify version resolution for each package:
#!/bin/bash
# Description: Check version resolution for each package declaration
# Extract all Package instantiations and their parameters
rg -A 5 'Package\(' | grep -v 'class Package' | grep -E '(version=|source_path=|license_path=)'
# Check if Assets class has version information for these paths
ast-grep --pattern 'class Assets:
$$$
_assets = {
$$$
}'snakemake/assets/__init__.py (1)
21-21: LGTM! Verify version formatting in URLs.
The version support implementation is clean and handles the optional nature of versions correctly. The URL formatting is done safely with a conditional check.
Let's verify that all versioned URLs in the spec follow the same format pattern:
Also applies to: 27-28
✅ Verification successful
Version formatting in URLs is consistent.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check consistency of version formatting in URLs
# Look for inconsistencies in how {version} is used in URLs
rg -U 'url.*\{version\}.*",' | sort | uniq -c
Length of output: 1930
| self.version = ( | ||
| version | ||
| or Assets.get_version(source_path) | ||
| or Assets.get_version(license_path) | ||
| ) |
There was a problem hiding this comment.
💡 Codebase verification
Add error handling to Assets.get_version to ensure reliable version retrieval.
🔗 Analysis chain
LGTM! The version fallback logic is well structured.
The implementation provides a clear fallback chain for version retrieval, prioritizing explicit versions over derived ones.
Let's verify the error handling of Assets.get_version and its impact on existing package declarations:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify Assets.get_version error handling and usage
# Check if Assets.get_version has error handling
ast-grep --pattern 'class Assets:
$$$
def get_version($_):
$$$
try {
$$$
} catch $_:
$$$'
# Check existing package declarations that might be affected
rg -A 5 'Package\(' | grep -v 'class Package'
Length of output: 1758
|
🤖 I have created a release *beep* *boop* --- ## [8.25.4](v8.25.3...v8.25.4) (2024-11-27) ### Bug Fixes * clean env vars in apptainer ([#3199](#3199)) ([76d5329](76d5329)) * ensure that intermediate files in job groups do not cause spurious mtime errors when checking for consistency with output files ([#3220](#3220)) ([4ba2bdf](4ba2bdf)) * Remove incomplete marker also when drop-metadata is active ([#3215](#3215)) ([a4f2e5c](a4f2e5c)) * Remove incomplete marker for job finished only after metadata is written ([#3197](#3197)) ([6567e5f](6567e5f)) * Support versioned URLs in Asset class and fix missing versions in Snakemake report ([#3203](#3203)) ([f086f6c](f086f6c)) * update rust-script usage to recent version (v0.35.0) [#3183](#3183) ([#3208](#3208)) ([43885d7](43885d7)) ### Documentation * clarify continuously updated input section ([#3219](#3219)) ([72a6994](72a6994)) * Fix typo in CHANGELOG.md ([#3198](#3198)) ([0e445ed](0e445ed)) * refer to Merkle trees instead of "blockchain" in caching.rst ([#3216](#3216)) ([282e5d9](282e5d9)) * remove twitter in favor of bluesky and mastodon ([#3217](#3217)) ([231c6df](231c6df)) * use "dictionary" not "array" wording in config docs ([#3156](#3156)) ([17aed41](17aed41)) --- 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>



Support versioned URLs in Asset class and fix missing versions in Snakemake report
Summary by CodeRabbit
New Features
Bug Fixes
Documentation