KEMBAR78
[None][doc] Replace the main in the examples' link with commit id. by nv-guomingz · Pull Request #7837 · NVIDIA/TensorRT-LLM · GitHub
Skip to content

Conversation

@nv-guomingz
Copy link
Collaborator

@nv-guomingz nv-guomingz commented Sep 18, 2025

Replace
https://github.com/NVIDIA/TensorRT-LLM/blob/main/examples/llm-api/llm_inference_distributed.py
with
https://github.com/NVIDIA/TensorRT-LLM/blob/2f3e3ae465fe03203f4e87c7cfa153d22cb54e43/examples/llm-api/llm_inference_distributed.py

Summary by CodeRabbit

  • Documentation

    • Example script links now point to the exact commit matching the viewed documentation, improving accuracy and preventing link drift.
    • Updated LLM API and Serve example references to use commit-specific URLs.
  • Chores

    • Added a git-based mechanism to resolve the current commit for generating versioned documentation links.

@nv-guomingz nv-guomingz requested a review from a team as a code owner September 18, 2025 10:29
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 18, 2025

📝 Walkthrough

Walkthrough

Adds pygit2 usage to docs tooling to read the repository HEAD commit and pin example script URLs to that commit for llm-api and serve references. No public interfaces changed; also removes an extraneous blank line.

Changes

Cohort / File(s) Summary of Changes
Docs URL generation update
docs/source/helper.py
Adds pygit2 usage to derive the current HEAD commit hash, constructs example script base URLs using the commit hash (.../blob/{commit_hash}/examples/llm-api and .../blob/{commit_hash}/examples/serve) instead of hard-coded main-branch URLs; minor formatting cleanup (removed blank line).

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Helper as docs/source/helper.py
    participant pygit2 as pygit2
    participant LocalRepo as Local Git repo
    participant GitHub as GitHub URL builder

    Helper->>pygit2: open repository
    pygit2->>LocalRepo: read HEAD
    LocalRepo-->>pygit2: return commit hash
    pygit2-->>Helper: provide commit hash
    Helper->>GitHub: build blob/{commit_hash}/examples/llm-api URL
    Helper->>GitHub: build blob/{commit_hash}/examples/serve URL
    Note over Helper,GitHub: Documentation links pinned to exact commit
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description only shows the specific URL replacement and does not follow the repository's required template sections (summary, Description, Test Coverage, and PR Checklist), so it lacks rationale, test information, and contextual details. It also omits mention of the new dependency (pygit2) indicated by the code changes, leaving reviewers without important information. Because required template fields are missing, the description check fails. Please update the PR description to follow the repository template: include the @coderabbitai summary or equivalent, a clear "Description" explaining why the change was made, a "Test Coverage" section listing relevant tests, and complete the PR Checklist. Explicitly list any new dependencies (e.g., pygit2), confirm license/vulnerability scan status for them, and note whether documentation or CODEOWNERS need updates. After adding these details reviewers will have the necessary context and the description will meet template requirements.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title follows the repository template ([None][doc]) and succinctly describes the primary change—replacing 'main' with a commit id in example links. It is concise and focused so a reviewer scanning history can understand the main intent. A minor grammatical tweak could improve clarity but is not required for acceptance.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91ac31a and eb162fb.

📒 Files selected for processing (1)
  • docs/source/helper.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/source/helper.py
⏰ 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: Pre-commit Check

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.

@nv-guomingz
Copy link
Collaborator Author

/bot run

@nv-guomingz nv-guomingz enabled auto-merge (squash) September 18, 2025 10:30
@tensorrt-cicd
Copy link
Collaborator

PR_Github #19182 [ run ] triggered by Bot

Copy link
Contributor

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
docs/source/helper.py (2)

72-74: Type annotations use PEP 585 generics; this breaks on Python 3.8.

Target is Python 3.8+. Either enable postponed annotations or use typing.List/typing.Dict, etc.

Minimal fix (add near top of file, after the license header):

+from __future__ import annotations

Or replace occurrences like:

  • def collect_script_paths(...) -> list[Path]:-> List[Path]
  • def write_scripts(...) -> list[DocMeta]:-> List[DocMeta]
  • def get_pydantic_methods() -> list[str]:-> List[str]

And:

-from typing import Optional
+from typing import Optional, List

157-159: Bug: mixing str with Path using the / operator.

This raises TypeError. Wrap the string in Path.

Apply this diff:

-            include_path = '../../..' / script_path.relative_to(root_dir)
+            include_path = Path('../../..') / script_path.relative_to(root_dir)
🧹 Nitpick comments (1)
docs/source/helper.py (1)

1-1: Missing NVIDIA Apache‑2.0 header (2025).

Please prepend the standard NVIDIA Apache‑2.0 header per repo policy.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f3e3ae and 91ac31a.

📒 Files selected for processing (1)
  • docs/source/helper.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Use only spaces, no tabs; indent with 4 spaces.

Files:

  • docs/source/helper.py
**/*.py

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.

Files:

  • docs/source/helper.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}

📄 CodeRabbit inference engine (CODING_GUIDELINES.md)

Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).

Files:

  • docs/source/helper.py
⏰ 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: Pre-commit Check

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
@nv-guomingz nv-guomingz force-pushed the user/guomingz/replace_main_with_commit_id branch from 91ac31a to eb162fb Compare September 18, 2025 10:53
@tensorrt-cicd
Copy link
Collaborator

PR_Github #19182 [ run ] completed with state SUCCESS
/LLM/release-1.0/L0_MergeRequest_PR pipeline #418 completed with status: 'SUCCESS'

@nv-guomingz
Copy link
Collaborator Author

/bot skip --comment "doc build already pass"

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19207 [ skip ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

PR_Github #19207 [ skip ] completed with state SUCCESS
Skipping testing for commit eb162fb

@nv-guomingz nv-guomingz merged commit 1240724 into NVIDIA:release/1.0 Sep 18, 2025
5 checks passed
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 23, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 23, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 23, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
yuanjingx87 pushed a commit that referenced this pull request Sep 23, 2025
…7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 24, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
dominicshanshan pushed a commit to dominicshanshan/TensorRT-LLM that referenced this pull request Sep 25, 2025
…VIDIA#7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
chzblych pushed a commit that referenced this pull request Sep 25, 2025
…7837)

Signed-off-by: nv-guomingz <137257613+nv-guomingz@users.noreply.github.com>
Signed-off-by: Wangshanshan <30051912+dominicshanshan@users.noreply.github.com>
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.

3 participants