Skip to content

Conversation

@sufubao
Copy link
Collaborator

@sufubao sufubao commented Jan 28, 2026

Summary

  • Add PEP 517/518/621 compliant pyproject.toml for modern Python packaging
  • Enable uv pip install . one-click installation
  • Pin dependency versions to tested Docker environment for reproducibility
  • Include full feature set by default (multimodal, CUDA optimizations, tokenizers)

Installation

# Default installation (full features)
uv pip install .

# Minimal installation (no CUDA optimizations or multimodal)
uv pip install ".[minimal]"

# With DeepSeek optimizations (deep-gemm)
uv pip install ".[deepseek]" --no-build-isolation

# Development mode
uv pip install -e ".[dev]"

- 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
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 pyproject.toml file. This change streamlines the installation process, making it easier for users to set up the project with tools like uv, and enhances reproducibility by explicitly pinning all dependencies. It also provides flexible installation options through optional dependency groups and centralizes the configuration for various development and quality assurance tools.

Highlights

  • Modern Python Packaging: Introduced pyproject.toml for modern Python packaging, adhering to PEP 517/518/621 standards, centralizing project metadata and build configurations.
  • Streamlined Installation: Enabled one-click installation using uv pip install . for simplified setup and faster dependency resolution.
  • Dependency Management: Pinned all core dependency versions to ensure reproducibility and stability, matching a tested Docker environment, and defined several optional dependency groups (minimal, dev, docs, deepseek) for tailored installations.
  • Default Feature Set: Configured the default installation to include the full feature set, encompassing multimodal capabilities, CUDA optimizations, and various tokenizers.
  • Development Tool Integration: Integrated and configured development tools such as Black, Flake8, Pytest, and MyPy directly within the pyproject.toml for consistent code quality and testing.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Required for TVM tensor allocator to work properly
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +29 to +94
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",
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The dependencies defined here conflict with the versions in requirements.txt. For example:

  • torch: 2.9.1 here vs 2.8.0 in requirements.txt
  • uvloop: 0.22.1 here vs 0.17.0 in requirements.txt
  • transformers: >=4.50.0 here vs 4.53.3 in requirements.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",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Comment on lines +98 to +129
# 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

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