Skip to content

feat: use py312#8832

Merged
zhyncs merged 1 commit intomainfrom
zhyncs/docker
Aug 5, 2025
Merged

feat: use py312#8832
zhyncs merged 1 commit intomainfrom
zhyncs/docker

Conversation

@zhyncs
Copy link
Copy Markdown
Collaborator

@zhyncs zhyncs commented Aug 5, 2025

Motivation

Modifications

Accuracy Test

Benchmark & Profiling

Checklist

@zhyncs zhyncs requested review from ByronHsu and HaiShaw as code owners August 5, 2025 20:26
Copy link
Copy Markdown
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 @zhyncs, 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 focuses on upgrading the Python version used in the project's Docker build environment. The primary change involves modifying the Dockerfile to incorporate Python 3.12, ensuring that future builds and deployments leverage the latest stable Python release.

Highlights

  • Python Version Upgrade: The Dockerfile has been updated to install Python 3.12 and configure it as the default python3 interpreter within the Docker image. This involves adding the deadsnakes/ppa repository and using update-alternatives.
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 or fill out our survey to provide feedback.

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
Copy Markdown
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 PR updates the Dockerfile to use Python 3.12. The review focuses on improving the new RUN instruction by applying Dockerfile best practices for image size optimization and maintainability.

Comment thread docker/Dockerfile
Comment on lines +15 to +22
RUN apt update && apt install wget -y && apt install software-properties-common -y \
&& add-apt-repository ppa:deadsnakes/ppa -y \
&& apt install python3.12-full -y \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 \
&& update-alternatives --set python3 /usr/bin/python3.12 \
&& wget https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py
Copy link
Copy Markdown
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 improved by applying some Dockerfile best practices to optimize for image size and maintainability.

  • Image Size: To reduce the final image size, it's recommended to:
    • Use the --no-install-recommends flag with apt-get install.
    • Clean up temporary files like get-pip.py after use.
    • Clean up the apt cache at the end of the RUN layer using apt-get clean && rm -rf /var/lib/apt/lists/*.
  • Maintainability:
    • It's recommended to use apt-get instead of apt in scripts for a more stable and predictable interface.
    • Multiple apt-get install calls can be consolidated for better readability.
    • While add-apt-repository on Ubuntu 22.04 automatically updates the package list, explicitly adding apt-get update can make the script more robust and portable.
RUN apt-get update && \
    apt-get install -y --no-install-recommends wget software-properties-common && \
    add-apt-repository ppa:deadsnakes/ppa -y && \
    apt-get update && \
    apt-get install -y --no-install-recommends python3.12-full && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 2 && \
    update-alternatives --set python3 /usr/bin/python3.12 && \
    wget https://bootstrap.pypa.io/get-pip.py && \
    python3 get-pip.py && \
    rm -f get-pip.py && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

@Swipe4057
Copy link
Copy Markdown
Contributor

Hello! Python 3.12 is also installed here, but by default and without unnecessary commands in the dockerfile

#8761 (comment)

@zhyncs
Copy link
Copy Markdown
Collaborator Author

zhyncs commented Aug 5, 2025

Hi We don't want to upgrade ubuntu for now.

@zhyncs zhyncs merged commit 4ef4783 into main Aug 5, 2025
15 of 18 checks passed
@zhyncs zhyncs deleted the zhyncs/docker branch August 5, 2025 20:38
narutolhy pushed a commit to narutolhy/sglang that referenced this pull request Aug 17, 2025
MahmoudAshraf97 pushed a commit to MahmoudAshraf97/sglang that referenced this pull request Sep 8, 2025
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