Skip to content

Conversation

matiasdaloia
Copy link
Contributor

@matiasdaloia matiasdaloia commented Oct 7, 2025

Summary by CodeRabbit

  • New Features

    • Default API transport is now gRPC across CLI subcommands.
    • Added --rest flag to explicitly use REST; selecting it disables gRPC.
    • The --grpc option is enabled by default unless --rest is specified.
  • Documentation

    • Updated changelog with version 1.35.0 and note on switching API calls to gRPC.
  • Chores

    • Bumped version to 1.35.0.

@matiasdaloia matiasdaloia self-assigned this Oct 7, 2025
Copy link

coderabbitai bot commented Oct 7, 2025

Walkthrough

Introduces 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

Cohort / File(s) Summary
Release notes
CHANGELOG.md
Added 1.35.0 entry (2025-10-07) noting API calls switch from REST to gRPC.
Version bump
src/scanoss/__init__.py
Updated __version__ from '1.34.0' to '1.35.0'.
CLI transport flags
src/scanoss/cli.py
Default gRPC enabled; added --rest (bool) to select REST. Post-parse logic sets args.grpc = False when --rest is provided. Applied across subcommand argument setup.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • ortizjeronimo
  • eeisegn
  • scanossmining

Poem

A hop, a skip, a gRPC leap—
I swapped my REST for faster sweep.
Flags flick like ears in windy zest,
“Use gRPC!” unless you ask for REST.
Version bumped, I thump with glee—
1.35.0, hare-certified, whee! 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly conveys the primary change of switching the default API transport to gRPC instead of REST, matching the implemented CLI updates and version bump.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/mdaloia/SP-3464-SCANOSS-PY-Use-grpc-as-default

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.

Copy link

github-actions bot commented Oct 7, 2025

SCANOSS SCAN Completed 🚀

  • Detected components: 1
  • Undeclared components: 0
  • Declared components: 1
  • Detected files: 82
  • Detected files undeclared: 0
  • Detected files declared: 82
  • Licenses detected: 1
  • Licenses detected with copyleft: 0
  • Policies: ✅ 1 pass (1 total)

View more details on SCANOSS Action Summary

Copy link

@coderabbitai coderabbitai bot left a 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 ambiguity

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

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

Add 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

📥 Commits

Reviewing files that changed from the base of the PR and between 26973c2 and b13e7b5.

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

Aligned with CHANGELOG and CLI changes.

@matiasdaloia matiasdaloia merged commit 01b5281 into main Oct 7, 2025
6 checks passed
@matiasdaloia matiasdaloia deleted the feature/mdaloia/SP-3464-SCANOSS-PY-Use-grpc-as-default branch October 7, 2025 15:16
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