Skip to content

Conversation

@nvmbreughe
Copy link
Contributor

@nvmbreughe nvmbreughe commented Oct 7, 2025

📌 Description

To avoid duplication bugs between Dockerfile (install_python_packages.sh) and setup.py, the common dependencies were moved into requirements.txt

🔍 Related Issues

🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.

✅ Pre-commit Checks

  • I have installed pre-commit by running pip install pre-commit (or used your preferred method).
  • I have installed the hooks with pre-commit install.
  • I have run the hooks manually with pre-commit run --all-files and fixed any reported issues.

If you are unsure about how to set up pre-commit, see the pre-commit documentation.

🧪 Tests

  • Tests have been added or updated as needed.
  • All tests are passing (unittest, etc.).

Reviewer Notes

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @nvmbreughe, 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 refactors the project's dependency management by introducing a central requirements.txt file. This change eliminates redundant dependency declarations in both the Docker build process and the setup.py configuration, thereby preventing potential version conflicts and simplifying maintenance. The goal is to ensure a single source of truth for common Python package requirements across the project.

Highlights

  • Centralized Dependency Management: Common Python dependencies previously duplicated across the Docker build script (install_python_packages.sh) and setup.py have been consolidated into a new requirements.txt file.
  • Streamlined Docker Installation: The install_python_packages.sh script now leverages requirements.txt for installing the majority of Python packages, reducing redundancy and simplifying maintenance.
  • Dynamic setup.py Requirements: The setup.py file has been updated to dynamically read its install_requires from requirements.txt, ensuring consistency with other dependency declarations.
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.

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 is a great step towards improving dependency management by consolidating common requirements into a single requirements.txt file. This reduces duplication between setup.py and the Docker build process. My review includes a few suggestions to enhance the robustness and efficiency of these changes. Specifically, I recommend removing torch from requirements.txt to avoid installation conflicts, ensuring the build fails if requirements.txt is missing, and combining pip installation commands in the Docker script for better performance.

packaging>=24.2
requests
tabulate
torch
Copy link
Contributor

Choose a reason for hiding this comment

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

high

torch is installed separately in docker/install/install_python_packages.sh using a specific index URL based on the CUDA version. Including it in requirements.txt is redundant and can lead to version conflicts or incorrect installations. For users installing via setup.py, it's standard practice to expect them to have torch pre-installed according to their specific hardware and CUDA setup. Please remove torch from this file.

Comment on lines +49 to +50
if not requirements_file.exists():
return []
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Silently returning an empty list when requirements.txt is missing can lead to a successful installation with missing dependencies, which will cause hard-to-debug runtime errors. It's better to let the build fail fast if requirements.txt is not found. Removing this check will allow path.read_text() to raise a FileNotFoundError, which is the desired behavior.

Comment on lines 26 to 27
pip3 install -r requirements.txt
pip3 install responses pytest scipy build cuda-python nvidia-nvshmem-cu12
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve efficiency, you can combine these two pip install commands into a single call. This allows pip to perform dependency resolution once for all packages, which is faster and can help avoid potential dependency conflicts.

Suggested change
pip3 install -r requirements.txt
pip3 install responses pytest scipy build cuda-python nvidia-nvshmem-cu12
pip3 install -r requirements.txt responses pytest scipy build cuda-python nvidia-nvshmem-cu12

@yongwww
Copy link
Member

yongwww commented Oct 7, 2025

/bot run

@flashinfer-bot
Copy link
Collaborator

GitLab MR !67 has been created, and the CI pipeline #36172478 is currently running. I'll report back once the pipeline job completes.

@flashinfer-ai flashinfer-ai deleted a comment from flashinfer-bot Oct 7, 2025
@nvmbreughe
Copy link
Contributor Author

This is failing because requirements.txt lives in root, and the docker build command is invoked in the docker directory. If we want this to work we either need to move requirements.txt into the docker directory, or update the docker build command. Preference is the latter.

@yzh119
Copy link
Collaborator

yzh119 commented Oct 7, 2025

or update the docker build command. Preference is the latter.

Agreed with the latter

Copy link
Collaborator

@yzh119 yzh119 left a comment

Choose a reason for hiding this comment

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

LGTM

@yzh119 yzh119 enabled auto-merge (squash) October 7, 2025 22:39
@yzh119 yzh119 merged commit ebea4bd into flashinfer-ai:main Oct 8, 2025
13 checks passed
@cyx-6 cyx-6 mentioned this pull request Oct 15, 2025
5 tasks
yzh119 pushed a commit that referenced this pull request Oct 16, 2025
<!-- .github/pull_request_template.md -->

## 📌 Description

This PR fixes the dev container after #1880.

<!-- What does this PR do? Briefly describe the changes and why they’re
needed. -->

## 🔍 Related Issues

<!-- Link any related issues here -->

## 🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.

### ✅ Pre-commit Checks

- [ ] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [ ] I have installed the hooks with `pre-commit install`.
- [ ] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).

## 🧪 Tests

- [ ] Tests have been added or updated as needed.
- [ ] All tests are passing (`unittest`, etc.).

## Reviewer Notes

<!-- Optional: anything you'd like reviewers to focus on, concerns, etc.
-->
cyx-6 added a commit to cyx-6/flashinfer that referenced this pull request Oct 16, 2025
<!-- .github/pull_request_template.md -->

## 📌 Description

This PR fixes the dev container after flashinfer-ai#1880.

<!-- What does this PR do? Briefly describe the changes and why they’re
needed. -->

## 🔍 Related Issues

<!-- Link any related issues here -->

## 🚀 Pull Request Checklist

Thank you for contributing to FlashInfer! Before we review your pull
request, please make sure the following items are complete.

### ✅ Pre-commit Checks

- [ ] I have installed `pre-commit` by running `pip install pre-commit`
(or used your preferred method).
- [ ] I have installed the hooks with `pre-commit install`.
- [ ] I have run the hooks manually with `pre-commit run --all-files`
and fixed any reported issues.

> If you are unsure about how to set up `pre-commit`, see [the
pre-commit documentation](https://pre-commit.com/).

## 🧪 Tests

- [ ] Tests have been added or updated as needed.
- [ ] All tests are passing (`unittest`, etc.).

## Reviewer Notes

<!-- Optional: anything you'd like reviewers to focus on, concerns, etc.
-->
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.

4 participants