-
Notifications
You must be signed in to change notification settings - Fork 296
feat: add pyproject.toml for uv one-click installation #1195
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?
Conversation
- Add PEP 517/518/621 compliant pyproject.toml - Pin dependency versions to tested Docker environment - Include full feature set by default (multimodal, CUDA optimizations) - Add optional dependency groups: minimal, dev, docs, deepseek - Configure uv to disable build isolation for deep-gemm - deep-gemm moved to optional [deepseek] group due to slow GitHub clone
Summary of ChangesHello @sufubao, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly modernizes the project's Python packaging and dependency management by introducing a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Required for TVM tensor allocator to work properly
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.
Code Review
This pull request introduces a pyproject.toml file to modernize the project's packaging and simplify installation. This is a great step forward. My review focuses on ensuring the new packaging configuration is robust, maintainable, and consistent with existing project components.
I've identified a critical issue regarding conflicting dependency definitions between the new pyproject.toml and the existing requirements.txt, which will affect Docker builds. I've also included suggestions to improve the dependency structure for better maintainability by reducing duplication, and to enhance reproducibility by pinning a loosely defined dependency. Addressing these points will make the new packaging setup more solid.
| dependencies = [ | ||
| # Communication & async | ||
| "pyzmq==27.1.0", | ||
| "uvloop==0.22.1", | ||
| "rpyc==6.0.2", | ||
|
|
||
| # ML frameworks | ||
| "torch==2.9.1", | ||
| "triton==3.5.1", | ||
| "transformers>=4.50.0", | ||
| "safetensors==0.7.0", | ||
|
|
||
| # Numeric & data processing | ||
| "numpy==2.2.6", | ||
| "einops==0.8.1", | ||
|
|
||
| # Web server | ||
| "fastapi==0.128.0", | ||
| "uvicorn==0.40.0", | ||
| "pydantic==2.12.5", | ||
| "httpx==0.28.1", | ||
| "ujson==5.11.0", | ||
| "gunicorn==23.0.0", | ||
| "websockets==16.0", | ||
|
|
||
| # Utilities | ||
| "packaging==25.0", | ||
| "ninja==1.13.0", | ||
| "orjson==3.11.5", | ||
| "tqdm==4.67.1", | ||
| "requests==2.32.5", | ||
| "filelock==3.20.2", | ||
| "fsspec==2025.10.0", | ||
| "Pillow==12.1.0", | ||
| "psutil==7.2.1", | ||
| "prometheus_client==0.23.1", | ||
| "setproctitle==1.3.7", | ||
| "PyYAML==6.0.3", | ||
| "easydict==1.13", | ||
|
|
||
| # Core server components | ||
| "sortedcontainers==2.4.0", | ||
| "atomics==1.0.3", | ||
| "frozendict==2.4.7", | ||
| "xxhash==3.6.0", | ||
|
|
||
| # Tokenizers | ||
| "sentencepiece==0.2.1", | ||
| "tiktoken==0.12.0", | ||
|
|
||
| # Multimodal support | ||
| "torchvision==0.24.1", | ||
| "librosa==0.11.0", | ||
| "numba==0.61.2", | ||
| "matplotlib==3.10.8", | ||
|
|
||
| # CUDA optimizations | ||
| "flashinfer-python==0.6.1", | ||
| "sgl-kernel==0.3.21", | ||
| "cupy-cuda12x==13.6.0", | ||
| "cuda-bindings==12.9.5", | ||
| "torch-c-dlpack-ext==0.1.5", | ||
|
|
||
| # Constrained decoding | ||
| "interegular==0.3.3", | ||
| "partial-json-parser==0.2.1.1.post7", |
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.
The dependencies defined here conflict with the versions in requirements.txt. For example:
torch:2.9.1here vs2.8.0inrequirements.txtuvloop:0.22.1here vs0.17.0inrequirements.txttransformers:>=4.50.0here vs4.53.3inrequirements.txt
The Dockerfile uses requirements.txt first, then pip install -e . which uses this file. This will cause dependency conflicts and non-reproducible builds.
To fix this, pyproject.toml should be the single source of truth. requirements.txt should be removed, and the Dockerfile should be updated to install dependencies from this file (e.g., pip install .[dev]).
| # ML frameworks | ||
| "torch==2.9.1", | ||
| "triton==3.5.1", | ||
| "transformers>=4.50.0", |
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.
While most dependencies are pinned for reproducibility, transformers is specified with a minimum version (>=4.50.0). This could lead to non-reproducible builds if a new version of transformers is released with breaking changes. For consistency and stability, consider pinning it to a specific version (e.g., ==4.50.0) or using a compatible release specifier (e.g., ~=4.50.0). This also applies to the transformers dependency in the minimal optional-dependencies group on line 104.
| # Minimal installation (core functionality only, no CUDA optimizations or multimodal) | ||
| minimal = [ | ||
| "pyzmq==27.1.0", | ||
| "uvloop==0.22.1", | ||
| "rpyc==6.0.2", | ||
| "torch==2.9.1", | ||
| "triton==3.5.1", | ||
| "transformers>=4.50.0", | ||
| "safetensors==0.7.0", | ||
| "numpy==2.2.6", | ||
| "einops==0.8.1", | ||
| "fastapi==0.128.0", | ||
| "uvicorn==0.40.0", | ||
| "pydantic==2.12.5", | ||
| "httpx==0.28.1", | ||
| "ujson==5.11.0", | ||
| "packaging==25.0", | ||
| "ninja==1.13.0", | ||
| "orjson==3.11.5", | ||
| "tqdm==4.67.1", | ||
| "requests==2.32.5", | ||
| "filelock==3.20.2", | ||
| "fsspec==2025.10.0", | ||
| "Pillow==12.1.0", | ||
| "psutil==7.2.1", | ||
| "prometheus_client==0.23.1", | ||
| "setproctitle==1.3.7", | ||
| "PyYAML==6.0.3", | ||
| "sortedcontainers==2.4.0", | ||
| "atomics==1.0.3", | ||
| "frozendict==2.4.7", | ||
| "xxhash==3.6.0", |
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.
There is significant duplication between the main dependencies list and this minimal optional dependency group. This makes maintenance difficult, as dependencies need to be updated in two places, which is error-prone.
A more maintainable approach is to define the minimal set in dependencies and use extras for additional features. Then, a full extra can be created to install everything.
Example structure:
[project]
dependencies = [
# Packages from current 'minimal' group
]
[project.optional-dependencies]
cuda = [...]
multimodal = [...]
full = [
"lightllm[cuda,multimodal]"
]With this structure, pip install . would perform a minimal installation, and pip install .[full] would install all features. This is a common pattern that avoids duplication and improves maintainability.
Summary
pyproject.tomlfor modern Python packaginguv pip install .one-click installationInstallation