Skip to content

Conversation

keyboardAnt
Copy link

The current dev container setup prevents new contributors from installing dependencies due to a Python version mismatch. The base Docker image (lmsysorg/sglang:dev) only provides Python 3.9, while the project's pyproject.toml explicitly requires python>=3.10.

This incompatibility causes modern package managers like uv and pip to fail during dependency installation, effectively blocking developers from setting up a working development environment using the provided dev container.

Modifications

  • Added Python 3.10 installation to .devcontainer/Dockerfile
  • Used the deadsnakes PPA as a reliable source for recent Python versions
  • Configured update-alternatives to set Python 3.10 as the default interpreter
  • Added development packages (python3.10-dev, python3-pip) for complete toolchain support
  • Set up alternatives for both python3 and python commands to ensure compatibility

This ensures the development environment meets the project's explicit Python version requirements and provides a robust setup for all contributors.

Accuracy Tests

Not applicable - this change only affects the development environment setup and does not impact model outputs.

Benchmarking and Profiling

Not applicable - this change only affects the development environment setup and does not impact inference performance.

Checklist

Note: The checked items above are marked as complete because:

  • Formatting: Dockerfile follows proper formatting conventions and passes applicable pre-commit checks (no trailing whitespace, proper newlines)
  • Unit tests: Not applicable for infrastructure/environment setup changes
  • Documentation: The change is self-documenting in the Dockerfile with clear comments
  • Accuracy/Speed tests: Not applicable as this only affects development environment setup, not runtime behavior

…lchain

- Add python3.10-dev for development headers
- Add python3-pip to ensure pip is available
- Set up alternatives for both python3 and python commands
- Ensures robust development environment for all contributors
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.

Summary of Changes

Hello @keyboardAnt, 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 resolves a critical issue in the development container setup that prevented new contributors from installing project dependencies. The previous setup used Python 3.9, which conflicted with the project's pyproject.toml requiring Python 3.10 or newer. This change updates the .devcontainer/Dockerfile to install Python 3.10 and configure it as the default interpreter, thereby ensuring a robust and compatible development environment for all contributors.

Highlights

  • Python 3.10 Installation: Added commands to the .devcontainer/Dockerfile to install Python 3.10.
  • Deadsnakes PPA Integration: Utilized the deadsnakes PPA to reliably source recent Python versions.
  • Default Python Version Configuration: Configured update-alternatives to set Python 3.10 as the default interpreter for both python and python3 commands.
  • Development Packages Inclusion: Included essential development packages like python3.10-dev and python3-pip for a complete Python toolchain.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 addresses a critical issue in the dev container setup by installing Python 3.10 to match the project's requirements. The approach of using the deadsnakes PPA is appropriate. I've added one suggestion to further optimize the Dockerfile layer by incorporating best practices for package installation and cleanup, which will result in a smaller and more efficient image. Overall, this is a valuable fix that improves the contributor experience.

Comment on lines 17 to 24
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \
rm -rf /var/lib/apt/lists/*
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This RUN instruction can be optimized for a smaller Docker image size by following a few best practices:

  • Avoid unnecessary packages: Use the --no-install-recommends flag with apt-get install to prevent the installation of optional recommended packages, which can significantly reduce the image size.
  • Thorough cleanup: Add apt-get clean before rm -rf /var/lib/apt/lists/* to remove downloaded package files from /var/cache/apt/archives.

These changes will help create a more efficient and leaner development environment, and also align with practices in other Dockerfiles in this repository.

RUN apt-get update && \
    apt-get install -y --no-install-recommends software-properties-common && \
    add-apt-repository -y ppa:deadsnakes/ppa && \
    apt-get update && \
    apt-get install -y --no-install-recommends python3.10 python3.10-venv python3.10-dev python3-pip && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

The add-apt-repository command is a Python script that requires the apt_pkg
module, which is provided by python3-apt. Without this package, the Docker
build fails with 'ModuleNotFoundError: No module named apt_pkg'.

This fix ensures the deadsnakes PPA can be added successfully to install
Python 3.10 in the development container.
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.

1 participant