Skip to content

Prepare project config for Text2Gremlin - #76

Open
LRriver wants to merge 2 commits into
hugegraph:mainfrom
LRriver:text2gremlin-project-plumbing
Open

Prepare project config for Text2Gremlin#76
LRriver wants to merge 2 commits into
hugegraph:mainfrom
LRriver:text2gremlin-project-plumbing

Conversation

@LRriver

@LRriver LRriver commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

This is the first split-out PR from the larger Text2Gremlin work in #52.

The full #52 PR is intentionally kept open for context while the work is submitted in smaller, reviewable parts. The original PR was too large to review safely as a single change, so this series will separate project plumbing, parser artifacts, AST generalization, demo data/templates, CLI/docs, LLM augmentation, DPO generation, and follow-up quality fixes.

This PR contains only the project plumbing needed before the implementation PRs:

  • Add Text2Gremlin dependency requirements.
  • Add local ignore rules for generated/output files.
  • Add license exclusions for generated ANTLR metadata and CSV data files.
  • Add narrowed Ruff configuration for the upcoming Text2Gremlin files.

It intentionally does not include parser code, AST/generalization logic, movie demo data, CLI/docs, LLM pipeline code, or DPO generation. Those will be submitted as follow-up PRs in smaller layers.

Validation:

  • uv run python TOML parse check for pyproject.toml
  • uv run ruff format --check .
  • uv run ruff check .

Summary by CodeRabbit

  • Chores
    • 更新了代码检查与格式化规则,增加对特定自动生成/复杂文件的排除与按文件忽略,降低误报。
    • 扩展了许可证扫描的忽略范围,避免对特定文件类型进行覆盖处理。
    • 补充了项目忽略列表,防止环境文件、输出目录与构建产物被误纳入版本管理。
    • 新增并锁定运行所需依赖版本,完善依赖清单。

Copilot AI review requested due to automatic review settings July 1, 2026 10:12
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

@codecov-ai-reviewer review

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

本次变更为 text2gremlin/AST_Text2Gremlin 子项目新增 .gitignorerequirements.txt,并更新根级 .licenserc.yamlpyproject.toml 的忽略与排除规则。

Changes

项目配置与检查规则更新

Layer / File(s) Summary
子项目基础配置
text2gremlin/AST_Text2Gremlin/.gitignore, text2gremlin/AST_Text2Gremlin/requirements.txt
新增忽略规则与依赖版本约束。
根级 license 与 lint 规则适配
.licenserc.yaml, pyproject.toml
新增 license 忽略模式,并为 text2gremlin/AST_Text2Gremlin 相关路径补充 Ruff 排除与逐文件忽略规则。

Estimated code review effort: 1 (Trivial) | ~5 minutes

Poem

小兔跳进新项目,
忽略清单轻轻抖,
依赖版本排排坐,
lint 规则也点头,
代码角落更整洁,
啦啦啦,蹦蹦走 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次变更的核心:为 Text2Gremlin 准备项目配置。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces configuration changes and dependency specifications for a new text2gremlin component, including updates to .licenserc.yaml, Ruff linting exclusions in pyproject.toml, and a new requirements.txt file. The review feedback highlights three key areas for improvement: first, it warns that suppressing F811 (redefined names) in GremlinTransVisitor.py may mask bugs caused by Python's lack of method overloading; second, it recommends renaming the new directories and files to follow PEP 8 snake_case conventions rather than suppressing N999 lint errors; and third, it suggests integrating the new dependencies into the root pyproject.toml to maintain unified dependency management via uv instead of using a standalone requirements.txt.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pyproject.toml
Comment on lines +201 to +205
"text2gremlin/AST_Text2Gremlin/base/GremlinTransVisitor.py" = [
"F403", # ANTLR visitor compatibility import style.
"F811", # Visitor methods mirror grammar alternatives and may intentionally repeat names.
"T20", # Parser diagnostics are printed by the standalone visitor helper.
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In Python, defining multiple methods with the same name within a class will silently overwrite the previous definitions (as Python does not support method overloading). If the upcoming GremlinTransVisitor.py indeed repeats method names, only the last one defined will be executed, which is likely a bug.\n\nANTLR4 typically generates unique visitor method names for each labeled alternative (e.g., visitAdd, visitSub). Please verify if F811 is truly needed, or if the visitor implementation needs to be corrected to avoid duplicate method definitions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this in PR1. This PR only prepares project plumbing and does not include GremlinTransVisitor.py. I verified the concern against the full Text2Gremlin branch; duplicate visitor method names need to be handled or justified in the later core/quality PR where the visitor implementation is actually introduced.

Comment thread pyproject.toml
Comment on lines +194 to +196
"text2gremlin/AST_Text2Gremlin/base/*.py" = [
"N999", # Keep existing standalone module names such as GremlinBase.py.
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

PEP 8 recommends using short, all-lowercase names for modules and packages, with underscores only if they improve readability (e.g., ast_text2gremlin, gremlin_base.py, gremlin_trans_visitor.py, traversal_generator.py).\n\nSince this is a brand new feature being introduced to the repository, it is highly recommended to rename these directories and files to follow standard snake_case naming conventions. This will improve maintainability, align with the rest of the codebase, and eliminate the need for suppressing N999 (invalid module name) lint errors.

References
  1. PEP 8 recommends using short, all-lowercase names for modules and packages, with underscores only if they improve readability. (link)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this in PR1. Renaming AST_Text2Gremlin and the existing visitor/generator modules would affect imports, docs, and follow-up split PR boundaries. This series is intentionally splitting the existing implementation for review without doing a broad rename/refactor; naming cleanup can be handled as a separate follow-up if maintainers want it.

Comment on lines +1 to +5
antlr4-python3-runtime==4.13.1
openai>=1.30.0
pandas>=2.0.0
pydantic>=2.0.0
pytest>=8.0.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The repository uses uv for workspace and dependency management, with centralized constraints defined in pyproject.toml (under tool.uv.constraint-dependencies). Introducing a standalone requirements.txt in a subdirectory bypasses this unified dependency management and can lead to version drift or conflicts (e.g., installing different versions of pandas, pydantic, or openai than those constrained in the root).\n\nIt is highly recommended to integrate text2gremlin's dependencies into the root pyproject.toml (for example, by adding a text2gremlin extra under [project.optional-dependencies] or managing it as a workspace member) to ensure consistent dependency resolution, locking, and ease of installation across environments.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 24b25b8. requirements.txt now matches the root workspace constraints: openai~=1.61.0, pandas~=2.2.3, pydantic~=2.10.6, and pytest~=8.0.0, while keeping antlr4-python3-runtime==4.13.1 for the generated parser runtime.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
text2gremlin/AST_Text2Gremlin/requirements.txt (1)

1-6: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

子项目依赖版本与根级约束不一致

requirements.txt 中的版本约束比 pyproject.tomlconstraint-dependencies 宽松:

  • openai>=1.30.0 对比 openai~=1.61.0
  • pandas>=2.0.0 对比 pandas~=2.2.3
  • pydantic>=2.0.0 对比 pydantic~=2.10.6

若该 requirements.txt 被独立使用(如直接 pip install -r),可能安装与 workspace 不兼容的版本。建议与根级约束对齐,或添加注释说明其使用场景。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@text2gremlin/AST_Text2Gremlin/requirements.txt` around lines 1 - 6, Align the
version constraints in requirements.txt with the workspace constraints defined
in pyproject.toml for openai, pandas, and pydantic so the subproject does not
install incompatible versions when used standalone. Update the dependency pins
in the requirements file to match the root-level constraint-dependencies, or add
a clear note in the file explaining that these looser bounds are intentional and
only for a specific install scenario.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@text2gremlin/AST_Text2Gremlin/requirements.txt`:
- Around line 1-6: Align the version constraints in requirements.txt with the
workspace constraints defined in pyproject.toml for openai, pandas, and pydantic
so the subproject does not install incompatible versions when used standalone.
Update the dependency pins in the requirements file to match the root-level
constraint-dependencies, or add a clear note in the file explaining that these
looser bounds are intentional and only for a specific install scenario.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 44a2b8e4-b48d-4ef2-a071-acf4853b35bb

📥 Commits

Reviewing files that changed from the base of the PR and between 4c643b0 and db2d12c.

📒 Files selected for processing (4)
  • .licenserc.yaml
  • pyproject.toml
  • text2gremlin/AST_Text2Gremlin/.gitignore
  • text2gremlin/AST_Text2Gremlin/requirements.txt

Copilot AI left a comment

Copy link
Copy Markdown

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 prepares project-level plumbing for upcoming Text2Gremlin work by adding a small Text2Gremlin subdirectory scaffold and tightening repository-wide tooling configuration to accommodate generated/parser-related files.

Changes:

  • Added a Text2Gremlin-side requirements.txt and local .gitignore for the text2gremlin/AST_Text2Gremlin/ area.
  • Updated Ruff configuration to exclude generated parser code and apply targeted per-file ignores for upcoming Text2Gremlin scripts.
  • Updated license-header tooling exclusions to ignore ANTLR metadata files and CSV artifacts.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
text2gremlin/AST_Text2Gremlin/requirements.txt Introduces dependency list for the Text2Gremlin AST subproject.
text2gremlin/AST_Text2Gremlin/.gitignore Adds local ignore rules for config/output artifacts within the Text2Gremlin subtree.
pyproject.toml Extends Ruff excludes and per-file ignores to accommodate generated/parser and script-style files.
.licenserc.yaml Excludes ANTLR metadata and CSV files from license-header checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +5
antlr4-python3-runtime==4.13.1
openai>=1.30.0
pandas>=2.0.0
pydantic>=2.0.0
pytest>=8.0.0

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 24b25b8. The standalone Text2Gremlin requirements now align with the root workspace constraints for OpenAI, pandas, pydantic, and pytest, so standalone installs do not drift from the workspace dependency set.

Comment on lines +1 to +5
# 配置文件
config.json
.env
output/

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this in PR1. The ANTLR parser artifacts are intentionally committed in the follow-up parser PR so reviewers can inspect the generated parser alongside the grammar. .licenserc.yaml excludes .interp, .tokens, and .csv from license-header checks, but .gitignore should not hide the parser artifacts we plan to submit.

@LRriver

LRriver commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

Review follow-up summary:

Accepted and fixed:

  • Aligned text2gremlin/AST_Text2Gremlin/requirements.txt with root workspace constraints in 24b25b8 (openai~=1.61.0, pandas~=2.2.3, pydantic~=2.10.6, pytest~=8.0.0).

Not changed in this PR:

  • Generated parser artifacts are intentionally planned for the follow-up parser PR, so .gitignore should not hide them in this plumbing PR.
  • GremlinTransVisitor.py is not included in PR1. The duplicate visitor-method concern is valid to handle or justify when the core visitor implementation is introduced.
  • Renaming AST_Text2Gremlin / visitor / generator modules is a broad path/import/doc refactor and is intentionally outside this split series. This PR series is preserving the existing implementation shape while splitting review boundaries.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
text2gremlin/AST_Text2Gremlin/requirements.txt (1)

5-5: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

请确认 pytest 是否应作为运行时依赖。

如果这个 requirements.txt 会被部署环境直接安装,pytest 会把测试工具一并带入生产环境;更合适的是拆到单独的 dev/test 依赖文件,或者确认该文件仅用于本地开发/CI。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@text2gremlin/AST_Text2Gremlin/requirements.txt` at line 5, `pytest` appears
to be listed in the main runtime requirements, which would install test tooling
in deployment environments. Move `pytest` out of this requirements file into a
dedicated dev/test dependencies file, or clearly scope this file to
development/CI only; keep the dependency list in `requirements.txt` limited to
runtime packages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@text2gremlin/AST_Text2Gremlin/requirements.txt`:
- Line 5: `pytest` appears to be listed in the main runtime requirements, which
would install test tooling in deployment environments. Move `pytest` out of this
requirements file into a dedicated dev/test dependencies file, or clearly scope
this file to development/CI only; keep the dependency list in `requirements.txt`
limited to runtime packages.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b682c5dd-2455-46e5-b71a-28cc589d36a7

📥 Commits

Reviewing files that changed from the base of the PR and between db2d12c and 24b25b8.

📒 Files selected for processing (1)
  • text2gremlin/AST_Text2Gremlin/requirements.txt

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.

2 participants