Skip to content

Commit

Permalink
Enable python 3.12 to ALPHA mode.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 570818380
Change-Id: I94d0b2861648bc088cd367d488ac16aab8599f43
  • Loading branch information
Sriram Mahavadi authored and copybara-github committed Oct 4, 2023
1 parent 74c408b commit 2570355
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 4 deletions.
12 changes: 10 additions & 2 deletions builders/python/acceptance/gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ func TestAcceptancePython(t *testing.T) {
App: "native_extensions",
Env: []string{"GOOGLE_ENTRYPOINT=gunicorn -b :8080 main:app"},
MustUse: []string{pythonRuntime, pythonPIP, entrypoint},
// numpy requires Python 3.8 or newer.
VersionInclusionConstraint: ">= 3.8.0",
// numpy 1.23.1 requires Python 3.8 and <3.12.0.
VersionInclusionConstraint: ">=3.8.0 <3.12.0",
},
{
Name: "python module dependency using a native extension for 3.9 and above",
App: "native_extensions_above_python39",
Env: []string{"GOOGLE_ENTRYPOINT=gunicorn -b :8080 main:app"},
MustUse: []string{pythonRuntime, pythonPIP, entrypoint},
// numpy 1.26.0 needed to support 3.12 only works on python 3.9 and above.
VersionInclusionConstraint: ">= 3.9.0",
},
{
Name: "pip vendored dependencies",
Expand Down
2 changes: 2 additions & 0 deletions builders/python/acceptance/runtime.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ gae_runtimes = {
"python39": "3.9.18",
"python310": "3.10.13",
"python311": "3.11.6",
"python312": "3.12.0",
}

gcf_runtimes = {
Expand All @@ -19,4 +20,5 @@ gcf_runtimes = {
"python39": "3.9.18",
"python310": "3.10.13",
"python311": "3.11.6",
"python312": "3.12.0",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flask==2.0.3
gunicorn==20.0.4 # gunicorn installs an executable into bin.
spacy==3.2.1 # spacy installs executables into bin and site-packages/bin.
spacy==3.7.0 # spacy installs executables into bin and site-packages/bin.
Werkzeug==2.2.2 # Flask 2.x incompatible with latest Werkzeug 3.x as of 10/2023
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
functions-framework==3.0.0
spacy==3.2.1 # spacy installs executables into bin and site-packages/bin.
spacy==3.7.0 # spacy installs executables into bin and site-packages/bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Simple flask web server used in acceptance tests.
"""
import os

from flask import Flask
import numpy as np
from numpy.ctypeslib import load_library

app = Flask(__name__)


def test_multiarray_umath():
try:
# Should succeed
load_library("_multiarray_umath", np.core._multiarray_umath.__file__)
except ImportError as e:
msg = ("Import error was: %s" % str(e))
print(msg)
return e


@app.route("/")
def hello():
if test_multiarray_umath() is None:
return "PASS"
else:
return "FAILED"

if __name__ == "__main__":
app.run(port=os.environ["PORT"], debug=True)

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
flask==2.0.3
gunicorn==20.0.4
numpy==1.26.0 # Python 3.12.0 is supported by numpy >= 1.26.0
setuptools==66.1.0 # Python 3.12.0 is supported by setuptools >= 1.26.0
Werkzeug==2.2.2 # Flask 2.x incompatible with latest Werkzeug 3.x as of 10/2023

0 comments on commit 2570355

Please sign in to comment.