Skip to content

Conversation

@SoleSarthak
Copy link

@SoleSarthak SoleSarthak commented Jan 18, 2026

Hi mentors! Preparing for GSoC 2026. I noticed that setting up the RISC-V toolchain (gcc, verilator, sbt) can be a hurdle for new contributors. I've added a simple check_env.py script that automatically verifies if these tools are installed and in the system path, making the onboarding process for the NucleusRV core much smoother.

Summary by CodeRabbit

  • New Features
    • Environment verification utility now available to validate your development setup. Automatically checks for required build dependencies and provides installation guidance for any missing tools.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

A new utility module check_env.py is introduced that defines a public check_toolchain function to verify installation of three required development tools (riscv64-unknown-elf-gcc, verilator, sbt) by executing subprocess commands and reporting their availability status.

Changes

Cohort / File(s) Summary
Toolchain Verification Utility
check_env.py
New module with check_toolchain function that iterates through three tools, attempts to invoke each with --version flag using subprocess.check_output, and prints installation status. Includes main guard for standalone script execution.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A new scout hops into place,
Checking tools with env-checking grace,
Three friends must align—
Riscv, verilator, sbt shine!
Build systems now running the race.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a check_env.py utility to verify the developer toolchain, which aligns with the file addition and the PR's objective of checking RISC-V toolchain prerequisites.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

@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: 1

🤖 Fix all issues with AI agents
In `@check_env.py`:
- Line 2: Remove the unused import by deleting the top-level "import sys"
statement in check_env.py so there are no unused module imports; ensure no other
code in check_env.py references sys before removing it (if it does, replace
usage appropriately or re-add a necessary import).
🧹 Nitpick comments (2)
check_env.py (2)

8-12: Catch specific exceptions and add a timeout.

The bare Exception catch is overly broad and can mask unexpected errors. Additionally, the subprocess call lacks a timeout, which could cause the script to hang indefinitely if a tool doesn't respond.

Proposed fix
         try:
-            subprocess.check_output([tool, "--version"], stderr=subprocess.STDOUT)
+            subprocess.check_output([tool, "--version"], stderr=subprocess.STDOUT, timeout=10)
             print(f"? {tool} is installed.")
-        except Exception:
+        except (FileNotFoundError, subprocess.CalledProcessError, subprocess.TimeoutExpired):
             print(f"? {tool} NOT found. Please install it to build NucleusRV.")

4-15: Consider returning a status for CI/scripting usage.

For use in CI pipelines or scripts, it would be helpful if the function returned a boolean or the script exited with a non-zero code when tools are missing.

Example implementation
 def check_toolchain():
     tools = ["riscv64-unknown-elf-gcc", "verilator", "sbt"]
     print("?? Checking MERL Development Environment...")
+    all_found = True
     for tool in tools:
         try:
-            subprocess.check_output([tool, "--version"], stderr=subprocess.STDOUT)
+            subprocess.check_output([tool, "--version"], stderr=subprocess.STDOUT, timeout=10)
             print(f"? {tool} is installed.")
-        except Exception:
+        except (FileNotFoundError, subprocess.CalledProcessError, subprocess.TimeoutExpired):
             print(f"? {tool} NOT found. Please install it to build NucleusRV.")
+            all_found = False
+    return all_found

 if __name__ == "__main__":
-    check_toolchain()
+    import sys
+    if not check_toolchain():
+        sys.exit(1)

@SoleSarthak SoleSarthak reopened this Jan 18, 2026
@SoleSarthak
Copy link
Author

Hi mentors! I noticed that the Read the Docs build is failing due to a missing configuration file in the master branch. I've updated my PR to ensure my contribution doesn't interfere with the documentation build. I'm very interested in the NucleusRV core verification for GSoC 2026 and look forward to your feedback!

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