-
Notifications
You must be signed in to change notification settings - Fork 37
Add --tag option to download command #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add --tag option to download command #249
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds tag filtering capability to the cloudsmith download command, enabling users to filter packages by tags alongside existing filters (version, format, architecture, OS). The implementation treats various package metadata fields as "tags" beyond just the explicit tags field.
Key Changes:
- Added
--tagoption to the download command with support for filtering by actual tags, format, architecture, distribution, and components - Enhanced package resolution logic with the new
_matches_tag_filter()helper function - Updated documentation with comprehensive download command examples
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| cloudsmith_cli/core/download.py | Added _matches_tag_filter() function and integrated tag filtering into resolve_package() |
| cloudsmith_cli/cli/commands/download.py | Added --tag CLI option and updated command documentation with tag filtering example |
| cloudsmith_cli/core/tests/test_download.py | Added unit test covering tag filtering for actual tags, format, architecture, and distro fields |
| README.md | Added download command to features list and created new "Downloading Packages" section with examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
b5cf8ac to
628c873
Compare
BartoszBlizniak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good - Got a few questions:
- I can see we're starting to use a lot of "filters" for the download command. All of these are essentially being passed to the query parameter for listing packages. From code maintenance and usability, perhaps adding
package_queryinstead of filters could allow for a better user experience (see package list command). -> This would require some re-working as it would be a breaking change, removing the filters (Future PR). - Integration test for the tag appears to be missing (you have core tests ✅)
- The
--tag,--osand--archappear to be case sensitive, while--nameisn't, should this be the case (no pun intended 😄)?
| if isinstance(tag_category, list) and tag_filter in tag_category: | ||
| return True | ||
|
|
||
| # Check other metadata fields that appear as tags in the UI (case-sensitive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worthwhile double-checking if Cloudsmith Tags are actually case-sensitive in the API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are. Just retested by adding some and the API returned:
"tags": { "info": [ "RANJAN", "RanJan", "Ranjan", "trivy", "upstream" ] }
|
Thanks @BartoszBlizniak
|
Summary
This PR adds tag filtering capability to the
cloudsmith downloadcommand and updates the README with comprehensive download command documentation.Changes Made
🚀 New Feature: --tag Option
--tagoption tocloudsmith downloadcommand for filtering packages by tagsresolve_package()function to support tag filtering across multiple metadata fields:📚 Documentation Updates
downloadcommand to README features list--tagfeatureUsage Examples
Testing
test_resolve_package_with_tag_filtervalidates tag filteringBreaking Changes
None - this is a backward-compatible feature addition.