-
Notifications
You must be signed in to change notification settings - Fork 191
Adding support for Python 3.15 #2937
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
Open
vijaysaayi
wants to merge
3
commits into
main
Choose a base branch
from
user/visaayir/python-3.15
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/bash | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT license. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| set -ex | ||
|
|
||
| # Core runtime libs + DB driver dev headers + tools | ||
| apt-get update \ | ||
| && apt-get upgrade -y \ | ||
| && apt-get install -y --no-install-recommends \ | ||
| ca-certificates \ | ||
| curl \ | ||
| wget \ | ||
| less \ | ||
| git \ | ||
| gnupg \ | ||
| libexpat1 \ | ||
| libodbc2 \ | ||
| libpq-dev \ | ||
| default-libmysqlclient-dev | ||
|
|
||
| # Microsoft ODBC Driver 18 for SQL Server (pyodbc target). | ||
| # Uses the official packages.microsoft.com ubuntu/24.04 prod feed. | ||
| # See https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server | ||
| curl -fsSL https://packages.microsoft.com/keys/microsoft.asc \ | ||
| | gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg | ||
| curl -fsSL https://packages.microsoft.com/config/ubuntu/24.04/prod.list \ | ||
| > /etc/apt/sources.list.d/mssql-release.list | ||
|
|
||
| apt-get update \ | ||
| && ACCEPT_EULA=Y apt-get install -y --no-install-recommends msodbcsql18 | ||
|
|
||
| mkdir -p /etc/unixODBC | ||
| cat >/etc/unixODBC/odbcinst.ini <<'EOL' | ||
| [ODBC Driver 18 for SQL Server] | ||
| Description=Microsoft ODBC Driver 18 for SQL Server | ||
| Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.1.so.1.1 | ||
| Threading=1 | ||
| UsageCount=1 | ||
| EOL | ||
|
|
||
| # Remove gnupg — only needed to dearmor the key above. | ||
| apt-get purge -y --auto-remove gnupg | ||
|
|
||
| # Clean up — keep at the very end so every apt-get install above is included. | ||
| rm -rf /var/lib/apt/lists/* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| ARG DEBIAN_FLAVOR | ||
| ARG BASE_IMAGE | ||
|
|
||
| # Stage 1 — build the Oryx startup-script generator (the `oryx` CLI). | ||
| FROM mcr.microsoft.com/oss/go/microsoft/golang:1.26.4-bookworm AS startupCmdGen | ||
| WORKDIR /go/src | ||
| COPY src/startupscriptgenerator/src . | ||
| ARG GIT_COMMIT=unspecified | ||
| ARG BUILD_NUMBER=unspecified | ||
| ARG RELEASE_TAG_NAME=unspecified | ||
| ENV RELEASE_TAG_NAME=${RELEASE_TAG_NAME} | ||
| ENV GIT_COMMIT=${GIT_COMMIT} | ||
| ENV BUILD_NUMBER=${BUILD_NUMBER} | ||
| ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt" | ||
| RUN chmod +x build.sh && ./build.sh python /opt/startupcmdgen/startupcmdgen | ||
|
|
||
|
|
||
| # Stage 2 — compile CPython from source (PGO+LTO via prereqs/build.sh). | ||
| FROM ${BASE_IMAGE} AS pythonSdkBuilder | ||
| ARG DEBIAN_FLAVOR | ||
| ARG PYTHON_FULL_VERSION | ||
| ARG PYTHON_VERSION | ||
| ENV PYTHON_VERSION=${PYTHON_FULL_VERSION} | ||
| COPY platforms/python/prereqs/build.sh /tmp/build.sh | ||
| COPY platforms/python/versions/${DEBIAN_FLAVOR}/versionsToBuild.txt /tmp/versionsToBuild.txt | ||
| COPY images/receiveGpgKeys.sh /tmp/receiveGpgKeys.sh | ||
| RUN chmod +x /tmp/build.sh /tmp/receiveGpgKeys.sh | ||
| RUN set -e \ | ||
| && mkdir -p /usr/src/python && cd /usr/src/python \ | ||
| && VERSION_LINE=$(grep "^${PYTHON_VERSION}," /tmp/versionsToBuild.txt) \ | ||
| && export GPG_KEY=$(echo "$VERSION_LINE" | cut -d',' -f2 | tr -d ' ') \ | ||
| && export PYTHON_SHA256=$(echo "$VERSION_LINE" | cut -d',' -f3 | tr -d ' ') \ | ||
| && export OS_FLAVOR=${DEBIAN_FLAVOR} \ | ||
| && /tmp/build.sh | ||
|
|
||
|
|
||
| # Stage 3 — final runtime image. | ||
| FROM ${BASE_IMAGE} as main | ||
|
|
||
| ARG SDK_STORAGE_BASE_URL_VALUE | ||
| ARG DEBIAN_FLAVOR | ||
| ENV DEBIAN_FLAVOR=${DEBIAN_FLAVOR} | ||
| ENV ORYX_SDK_STORAGE_BASE_URL=${SDK_STORAGE_BASE_URL_VALUE} | ||
|
|
||
| # Layer 1 — runtime apt deps (least volatile; bumped only on driver/SSL CVEs). | ||
| # Targeted COPY of only the dep script — avoids invalidating this layer on | ||
| # every unrelated change under images/. | ||
| COPY images/runtime/python/install-dependencies-slim.sh /tmp/install-dependencies-slim.sh | ||
| RUN chmod +x /tmp/install-dependencies-slim.sh \ | ||
| && /tmp/install-dependencies-slim.sh \ | ||
| && rm -f /tmp/install-dependencies-slim.sh | ||
|
|
||
| # Layer 2 — extracted Python (changes every patch bump). | ||
| ARG PYTHON_FULL_VERSION | ||
| ARG PYTHON_VERSION | ||
| ARG PYTHON_MAJOR_VERSION | ||
| ENV PYTHON_VERSION=${PYTHON_FULL_VERSION} | ||
|
|
||
| COPY --from=pythonSdkBuilder /opt/python/${PYTHON_FULL_VERSION} /opt/python/${PYTHON_FULL_VERSION} | ||
|
|
||
| RUN set -ex \ | ||
| && cd /opt/python/ \ | ||
| && ln -s ${PYTHON_FULL_VERSION} ${PYTHON_VERSION} \ | ||
| && ln -s ${PYTHON_VERSION} ${PYTHON_MAJOR_VERSION} \ | ||
| && echo /opt/python/${PYTHON_MAJOR_VERSION}/lib >> /etc/ld.so.conf.d/python.conf \ | ||
| && ldconfig \ | ||
| && if [ "${PYTHON_MAJOR_VERSION}" = "3" ]; then cd /opt/python/${PYTHON_MAJOR_VERSION}/bin \ | ||
| && ln -nsf idle3 idle \ | ||
| && ln -nsf pydoc3 pydoc \ | ||
| && ln -nsf python3-config python-config; fi \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| ENV PATH="/opt/python/${PYTHON_MAJOR_VERSION}/bin:${PATH}" | ||
|
|
||
| # AI + cert envs. | ||
| ARG AI_CONNECTION_STRING | ||
| ENV ORYX_AI_CONNECTION_STRING=${AI_CONNECTION_STRING} | ||
| ENV PATH_CA_CERTIFICATE="/etc/ssl/certs/ca-certificate.crt" | ||
|
|
||
| # Buildpacks contract. | ||
| ENV CNB_STACK_ID="oryx.stacks.skeleton" | ||
| LABEL io.buildpacks.stack.id="oryx.stacks.skeleton" | ||
|
|
||
| # Layer 3 — pip toolchain (gunicorn only; rebuilt on pip bumps). | ||
| RUN --mount=type=secret,id=pip_index_url,target=/run/secrets/pip_index_url \ | ||
| pip install --index-url $(cat /run/secrets/pip_index_url) --upgrade pip && \ | ||
| pip install --index-url $(cat /run/secrets/pip_index_url) gunicorn | ||
|
|
||
| # C.UTF-8 is provided by libc — no `locales` package install required. | ||
| ENV LANG="C.UTF-8" \ | ||
| LANGUAGE="C.UTF-8" \ | ||
| LC_ALL="C.UTF-8" | ||
|
|
||
| # Layer 4 — oryx CLI (per-build, tiny — last for max cache hit on rebuilds). | ||
| COPY --from=startupCmdGen /opt/startupcmdgen/startupcmdgen /opt/startupcmdgen/startupcmdgen | ||
| RUN ln -s /opt/startupcmdgen/startupcmdgen /usr/local/bin/oryx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
jfyi, we do install
in
images/runtime/commonbase/Dockerfile