-
Notifications
You must be signed in to change notification settings - Fork 101
[doc] Add contributing.md and codeowners. #480
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: main
Are you sure you want to change the base?
[doc] Add contributing.md and codeowners. #480
Conversation
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
Signed-off-by: Yuchuan <[email protected]>
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 contributing guidelines and code ownership documentation to the XGrammar repository. The changes establish processes for community contributions, code review, and maintainership.
- Introduces CONTRIBUTING.md with PR naming conventions, review process, and community guidelines
- Adds CODEOWNERS file mapping repository files to responsible maintainers
- Includes utility scripts to generate and maintain the CODEOWNERS file
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 23 comments.
Show a summary per file
| File | Description |
|---|---|
| CONTRIBUTING.md | Establishes contribution workflow, PR conventions, and review process |
| .github/CODEOWNERS | Maps 226 files to code owners for review assignments |
| .github/name_mappings.csv | Provides git-to-GitHub username mappings for code owner generation |
| scripts/generate_code_owner.bash | Bash script to automate CODEOWNERS file generation from git history |
| scripts/name_replace.py | Python utility to replace names in CODEOWNERS using CSV mappings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| f.write(content) | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
Copilot
AI
Nov 22, 2025
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.
Missing input validation and error handling. The script will crash with IndexError if insufficient command-line arguments are provided. Consider adding a check like if len(sys.argv) != 3: and printing usage instructions.
| if __name__ == "__main__": | |
| if __name__ == "__main__": | |
| if len(sys.argv) != 3: | |
| print(f"Usage: {sys.argv[0]} <csv_file> <input_file>", file=sys.stderr) | |
| sys.exit(1) |
| with open(input_file, "r", encoding="utf-8") as f: | ||
| content = f.read() | ||
|
|
||
| with open(csv_file, "r", encoding="utf-8") as f: | ||
| reader = csv.reader(f) | ||
| next(reader, None) | ||
| for old, _, new in reader: | ||
| content = content.replace(old, new) | ||
|
|
||
| with open(input_file, "w", encoding="utf-8") as f: | ||
| f.write(content) | ||
|
|
||
|
|
Copilot
AI
Nov 22, 2025
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.
Missing error handling for file operations. If the input file doesn't exist or isn't readable, the script will crash with an unhelpful error. Consider wrapping file operations in try-except blocks with informative error messages.
| with open(input_file, "r", encoding="utf-8") as f: | |
| content = f.read() | |
| with open(csv_file, "r", encoding="utf-8") as f: | |
| reader = csv.reader(f) | |
| next(reader, None) | |
| for old, _, new in reader: | |
| content = content.replace(old, new) | |
| with open(input_file, "w", encoding="utf-8") as f: | |
| f.write(content) | |
| try: | |
| with open(input_file, "r", encoding="utf-8") as f: | |
| content = f.read() | |
| except (FileNotFoundError, PermissionError, OSError) as e: | |
| print(f"Error opening or reading input file '{input_file}': {e}", file=sys.stderr) | |
| sys.exit(1) | |
| try: | |
| with open(csv_file, "r", encoding="utf-8") as f: | |
| reader = csv.reader(f) | |
| next(reader, None) | |
| for old, _, new in reader: | |
| content = content.replace(old, new) | |
| except (FileNotFoundError, PermissionError, OSError) as e: | |
| print(f"Error opening or reading CSV file '{csv_file}': {e}", file=sys.stderr) | |
| sys.exit(1) | |
| try: | |
| with open(input_file, "w", encoding="utf-8") as f: | |
| f.write(content) | |
| except (PermissionError, OSError) as e: | |
| print(f"Error writing to input file '{input_file}': {e}", file=sys.stderr) | |
| sys.exit(1) |
| with open(csv_file, "r", encoding="utf-8") as f: | ||
| reader = csv.reader(f) | ||
| next(reader, None) | ||
| for old, _, new in reader: |
Copilot
AI
Nov 22, 2025
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.
CSV unpacking assumes exactly 3 columns per row. If the CSV has a different number of columns, this will raise a ValueError. Consider validating row length or using more defensive unpacking.
| for old, _, new in reader: | |
| for row in reader: | |
| if len(row) < 3: | |
| continue # Skip rows with insufficient columns | |
| old, _, new = row[:3] |
| .github/workflows/tmate.yaml @Ubospica | ||
| .github/workflows/unit_test.yaml @DarkSharpness | ||
| .gitignore @Ubospica | ||
| .gitmodules @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| .gitmodules @Ubospica @Ubospica | |
| .gitmodules @Ubospica |
| cpp/fsm_builder.cc @Ubospica @Seven-Streams | ||
| cpp/fsm_builder.h @Ubospica | ||
| cpp/grammar.cc @Ubospica | ||
| cpp/grammar_builder.h @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| cpp/grammar_builder.h @Ubospica @Ubospica | |
| cpp/grammar_builder.h @Ubospica |
| python/xgrammar/kernels/__init__.py @Ubospica | ||
| python/xgrammar/kernels/apply_token_bitmask_inplace_cpu.py @Ubospica | ||
| python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.cu @Ubospica @Ubospica | ||
| python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica @Ubospica | |
| python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica |
| python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.cu @Ubospica @Ubospica | ||
| python/xgrammar/kernels/apply_token_bitmask_inplace_cuda.py @Ubospica @Ubospica | ||
| python/xgrammar/kernels/apply_token_bitmask_inplace_torch_compile.py @Ubospica | ||
| python/xgrammar/kernels/apply_token_bitmask_inplace_triton.py @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| python/xgrammar/kernels/apply_token_bitmask_inplace_triton.py @Ubospica @Ubospica | |
| python/xgrammar/kernels/apply_token_bitmask_inplace_triton.py @Ubospica |
| tests/python/test_function_calling_converter.py @Seven-Streams | ||
| tests/python/test_grammar_compiler.py @Ubospica | ||
| tests/python/test_grammar_matcher_basic.py @Ubospica | ||
| tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica | |
| tests/python/test_grammar_matcher_ebnf.py @Ubospica |
| tests/python/test_grammar_compiler.py @Ubospica | ||
| tests/python/test_grammar_matcher_basic.py @Ubospica | ||
| tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica | ||
| tests/python/test_grammar_matcher_json.py @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| tests/python/test_grammar_matcher_json.py @Ubospica @Ubospica | |
| tests/python/test_grammar_matcher_json.py @Ubospica |
| tests/python/test_grammar_matcher_basic.py @Ubospica | ||
| tests/python/test_grammar_matcher_ebnf.py @Ubospica @Ubospica | ||
| tests/python/test_grammar_matcher_json.py @Ubospica @Ubospica | ||
| tests/python/test_grammar_matcher_json_schema.py @Ubospica @Ubospica |
Copilot
AI
Nov 22, 2025
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.
Duplicate code owner '@Ubospica' specified for the same file. This appears to be a redundant entry.
| tests/python/test_grammar_matcher_json_schema.py @Ubospica @Ubospica | |
| tests/python/test_grammar_matcher_json_schema.py @Ubospica |
This PR adds the
CONTRIBUTING.mdandCODEOWNERSfor the repo.