-
Notifications
You must be signed in to change notification settings - Fork 24
[SP-3346] feat: use gRPC by default instead of REST #154
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
[SP-3346] feat: use gRPC by default instead of REST #154
Conversation
WalkthroughIntroduces version 1.35.0, updates changelog, bumps version, and changes CLI defaults to use gRPC by default with a new --rest flag to opt into REST. Post-parse logic ensures --rest disables gRPC. No other public APIs are altered. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant C as CLI Entry
participant P as ArgParser
participant N as Post-parse Normalizer
participant S as Client Selector
participant G as gRPC Client
participant R as REST Client
U->>C: run command (no flags / --grpc / --rest)
C->>P: define args (grpc default=True, rest default=False)
P-->>C: parsed args
C->>N: normalize flags
Note over N: If rest==True ⇒ set grpc=False
N-->>S: args.grpc / args.rest
alt grpc==True
S->>G: initialize and call
G-->>U: results
else rest==True
S->>R: initialize and call
R-->>U: results
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
SCANOSS SCAN Completed 🚀
View more details on SCANOSS Action Summary |
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/scanoss/cli.py (2)
1073-1075
: Make gRPC/REST flags mutually exclusive and remove ambiguityUse an argparse mutually exclusive group so only one can be chosen, defaulting to gRPC. This removes the need for a post-parse hack and avoids both flags being true.
Also, consider not adding these flags to gRPC-only crypto commands (algorithms/hints/versions-in-range) to avoid UX confusion.
Apply this diff inside the loop adding transport flags:
- p.add_argument('--grpc', action='store_true', default=True, help='Use gRPC (default)') - p.add_argument('--rest', action='store_true', dest='rest', help='Use REST instead of gRPC') + group = p.add_mutually_exclusive_group() + group.add_argument('--grpc', dest='grpc', action='store_true', default=True, help='Use gRPC (default)') + group.add_argument('--rest', dest='grpc', action='store_false', help='Use REST instead of gRPC')Optionally exclude the crypto subcommands from this loop (or update help to state “gRPC only; REST unsupported”).
1116-1120
: Remove post-parse override and update commentWith mutually exclusive flags, this hack is unnecessary and the TODO is misleading.
- # TODO: Remove this hack once we go back to using REST as default - # Handle --rest overriding --grpc default - if hasattr(args, 'rest') and args.rest: - args.grpc = False + # Transport selection handled via mutually exclusive --grpc/--rest flags (default: gRPC)CHANGELOG.md (1)
12-15
: Clarify behavior change and migration noteAdd a brief note that gRPC is now the default and users can opt into REST with --rest. This helps downstream scripts.
Example:
- Default transport changed to gRPC across CLI and SDK. Use --rest to force REST where supported. Some commands (e.g., crypto) remain gRPC-only.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.md
(1 hunks)src/scanoss/__init__.py
(1 hunks)src/scanoss/cli.py
(2 hunks)
⏰ 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: build
🔇 Additional comments (1)
src/scanoss/__init__.py (1)
25-25
: Version bump looks goodAligned with CHANGELOG and CLI changes.
Summary by CodeRabbit
New Features
Documentation
Chores