Skip to content

Commit 45d2b20

Browse files
srinjoyraycopybara-github
authored andcommitted
Add UV support to GCP Python Buildpacks.
PiperOrigin-RevId: 802420875 Change-Id: If73be6632afa936b2f722d1b622215ef66e2363c
1 parent 74ce405 commit 45d2b20

26 files changed

+1303
-69
lines changed

builders/gcp/base/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ GROUPS = {
6262
"//cmd/python/pip:pip.tgz",
6363
"//cmd/python/runtime:runtime.tgz",
6464
"//cmd/python/poetry:poetry.tgz",
65+
"//cmd/python/uv:uv.tgz",
6566
],
6667
"ruby": [
6768
"//cmd/ruby/missing_entrypoint:missing_entrypoint.tgz",
@@ -138,6 +139,7 @@ GROUPS_USING_RUNNER = {
138139
"//cmd/python/pip:pip_using_runner.tgz",
139140
"//cmd/python/runtime:runtime_using_runner.tgz",
140141
"//cmd/python/poetry:poetry_using_runner.tgz",
142+
"//cmd/python/uv:uv_using_runner.tgz",
141143
],
142144
"ruby": [
143145
"//cmd/ruby/missing_entrypoint:missing_entrypoint_using_runner.tgz",

builders/gcp/base/acceptance/acceptance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const (
5555
pythonMissingEntrypoint = "google.python.missing-entrypoint"
5656
pythonWebserver = "google.python.webserver"
5757
pythonPoetry = "google.python.poetry"
58+
pythonUV = "google.python.uv"
5859
rubyBundle = "google.ruby.bundle"
5960
rubyFF = "google.ruby.functions-framework"
6061
rubyRails = "google.ruby.rails"

builders/gcp/base/acceptance/python_test.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,28 +255,49 @@ func TestAcceptancePython(t *testing.T) {
255255
App: "poetry_app",
256256
MustUse: []string{pythonRuntime, pythonPoetry},
257257
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
258-
VersionInclusionConstraint: ">=3.9.0",
258+
VersionInclusionConstraint: ">=3.10.0",
259259
},
260260
{
261261
Name: "poetry_main",
262262
App: "poetry_main",
263263
MustUse: []string{pythonRuntime, pythonPoetry},
264264
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
265-
VersionInclusionConstraint: ">=3.9.0",
265+
VersionInclusionConstraint: ">=3.10.0",
266266
},
267267
{
268268
Name: "poetry_lock",
269269
App: "poetry_lock",
270270
MustUse: []string{pythonRuntime, pythonPoetry},
271271
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
272-
VersionInclusionConstraint: ">=3.9.0",
272+
VersionInclusionConstraint: ">=3.10.0",
273273
},
274274
{
275275
Name: "poetry_setuptools",
276276
App: "poetry_setuptools",
277277
MustUse: []string{pythonRuntime, pythonPoetry},
278278
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
279-
VersionInclusionConstraint: ">=3.9.0",
279+
VersionInclusionConstraint: ">=3.10.0",
280+
},
281+
{
282+
Name: "uv_app",
283+
App: "uv_app",
284+
MustUse: []string{pythonRuntime, pythonUV},
285+
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
286+
VersionInclusionConstraint: ">=3.10.0",
287+
},
288+
{
289+
Name: "uv_main",
290+
App: "uv_main",
291+
MustUse: []string{pythonRuntime, pythonUV},
292+
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
293+
VersionInclusionConstraint: ">=3.10.0",
294+
},
295+
{
296+
Name: "pyproject_without_lock",
297+
App: "pyproject_without_lock",
298+
MustUse: []string{pythonRuntime, pythonUV},
299+
Env: []string{"X_GOOGLE_RELEASE_TRACK=ALPHA"},
300+
VersionInclusionConstraint: ">=3.10.0",
280301
},
281302
}
282303

builders/gcp/base/builder.toml

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
124124
id = "google.python.poetry"
125125
uri = "python/poetry.tgz"
126126

127+
[[buildpacks]]
128+
id = "google.python.uv"
129+
uri = "python/uv.tgz"
130+
127131
[[buildpacks]]
128132
id = "google.python.functions-framework"
129133
uri = "python/functions_framework.tgz"
@@ -516,16 +520,41 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
516520
id = "google.utils.label-image"
517521

518522
# Python applications with default entrypoint or fail with a message.
523+
# Poetry order group.
519524
[[order]]
520525
[[order.group]]
521526
id = "google.python.runtime"
522527

523528
[[order.group]]
524-
id = "google.python.pip"
525-
optional = true
529+
id = "google.python.poetry"
526530

527531
[[order.group]]
528-
id = "google.python.poetry"
532+
id = "google.config.entrypoint"
533+
534+
[[order.group]]
535+
id = "google.utils.label-image"
536+
537+
# UV order group.
538+
[[order]]
539+
[[order.group]]
540+
id = "google.python.runtime"
541+
542+
[[order.group]]
543+
id = "google.python.uv"
544+
545+
[[order.group]]
546+
id = "google.config.entrypoint"
547+
548+
[[order.group]]
549+
id = "google.utils.label-image"
550+
551+
# Pip order group.
552+
[[order]]
553+
[[order.group]]
554+
id = "google.python.runtime"
555+
556+
[[order.group]]
557+
id = "google.python.pip"
529558
optional = true
530559

531560
[[order.group]]
@@ -714,6 +743,7 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
714743
# Python 2/2 #
715744
##############
716745
# Python applications with default entrypoint or fail with a message.
746+
# Poetry order group.
717747
[[order]]
718748
[[order.group]]
719749
id = "google.python.runtime"
@@ -723,11 +753,43 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
723753
optional = true
724754

725755
[[order.group]]
726-
id = "google.python.pip"
756+
id = "google.python.poetry"
757+
758+
[[order.group]]
759+
id = "google.python.missing-entrypoint"
760+
761+
[[order.group]]
762+
id = "google.utils.label-image"
763+
764+
# UV order group.
765+
[[order]]
766+
[[order.group]]
767+
id = "google.python.runtime"
768+
769+
[[order.group]]
770+
id = "google.python.webserver"
727771
optional = true
728772

729773
[[order.group]]
730-
id = "google.python.poetry"
774+
id = "google.python.uv"
775+
776+
[[order.group]]
777+
id = "google.python.missing-entrypoint"
778+
779+
[[order.group]]
780+
id = "google.utils.label-image"
781+
782+
# Pip order group.
783+
[[order]]
784+
[[order.group]]
785+
id = "google.python.runtime"
786+
787+
[[order.group]]
788+
id = "google.python.webserver"
789+
optional = true
790+
791+
[[order.group]]
792+
id = "google.python.pip"
731793
optional = true
732794

733795
[[order.group]]

builders/gcp/base/google.22.builder.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
124124
id = "google.python.poetry"
125125
uri = "python/poetry.tgz"
126126

127+
[[buildpacks]]
128+
id = "google.python.uv"
129+
uri = "python/uv.tgz"
130+
127131
[[buildpacks]]
128132
id = "google.python.functions-framework"
129133
uri = "python/functions_framework.tgz"
@@ -530,6 +534,20 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
530534
[[order.group]]
531535
id = "google.utils.label-image"
532536

537+
# UV order group.
538+
[[order]]
539+
[[order.group]]
540+
id = "google.python.runtime"
541+
542+
[[order.group]]
543+
id = "google.python.uv"
544+
545+
[[order.group]]
546+
id = "google.config.entrypoint"
547+
548+
[[order.group]]
549+
id = "google.utils.label-image"
550+
533551
# Pip order group.
534552
[[order]]
535553
[[order.group]]
@@ -743,6 +761,24 @@ description = "Ubuntu 22.04 base image with buildpacks for .NET, Dart, Go, Java,
743761
[[order.group]]
744762
id = "google.utils.label-image"
745763

764+
# UV order group.
765+
[[order]]
766+
[[order.group]]
767+
id = "google.python.runtime"
768+
769+
[[order.group]]
770+
id = "google.python.webserver"
771+
optional = true
772+
773+
[[order.group]]
774+
id = "google.python.uv"
775+
776+
[[order.group]]
777+
id = "google.python.missing-entrypoint"
778+
779+
[[order.group]]
780+
id = "google.utils.label-image"
781+
746782
# Pip order group.
747783
[[order]]
748784
[[order.group]]

builders/gcp/base/google.24.builder.runner.toml

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ description = "Ubuntu 24.04 base image with buildpacks for .NET, Dart, Go, Java,
124124
id = "google.python.poetry"
125125
uri = "python/poetry_using_runner.tgz"
126126

127+
[[buildpacks]]
128+
id = "google.python.uv"
129+
uri = "python/uv_using_runner.tgz"
130+
127131
[[buildpacks]]
128132
id = "google.python.functions-framework"
129133
uri = "python/functions_framework_using_runner.tgz"
@@ -516,16 +520,41 @@ description = "Ubuntu 24.04 base image with buildpacks for .NET, Dart, Go, Java,
516520
id = "google.utils.label-image"
517521

518522
# Python applications with default entrypoint or fail with a message.
523+
# Poetry order group.
519524
[[order]]
520525
[[order.group]]
521526
id = "google.python.runtime"
522527

523528
[[order.group]]
524-
id = "google.python.pip"
525-
optional = true
529+
id = "google.python.poetry"
526530

527531
[[order.group]]
528-
id = "google.python.poetry"
532+
id = "google.config.entrypoint"
533+
534+
[[order.group]]
535+
id = "google.utils.label-image"
536+
537+
# UV order group.
538+
[[order]]
539+
[[order.group]]
540+
id = "google.python.runtime"
541+
542+
[[order.group]]
543+
id = "google.python.uv"
544+
545+
[[order.group]]
546+
id = "google.config.entrypoint"
547+
548+
[[order.group]]
549+
id = "google.utils.label-image"
550+
551+
# Pip order group.
552+
[[order]]
553+
[[order.group]]
554+
id = "google.python.runtime"
555+
556+
[[order.group]]
557+
id = "google.python.pip"
529558
optional = true
530559

531560
[[order.group]]
@@ -714,6 +743,7 @@ description = "Ubuntu 24.04 base image with buildpacks for .NET, Dart, Go, Java,
714743
# Python 2/2 #
715744
##############
716745
# Python applications with default entrypoint or fail with a message.
746+
# Poetry order group.
717747
[[order]]
718748
[[order.group]]
719749
id = "google.python.runtime"
@@ -723,11 +753,43 @@ description = "Ubuntu 24.04 base image with buildpacks for .NET, Dart, Go, Java,
723753
optional = true
724754

725755
[[order.group]]
726-
id = "google.python.pip"
756+
id = "google.python.poetry"
757+
758+
[[order.group]]
759+
id = "google.python.missing-entrypoint"
760+
761+
[[order.group]]
762+
id = "google.utils.label-image"
763+
764+
# UV order group.
765+
[[order]]
766+
[[order.group]]
767+
id = "google.python.runtime"
768+
769+
[[order.group]]
770+
id = "google.python.webserver"
727771
optional = true
728772

729773
[[order.group]]
730-
id = "google.python.poetry"
774+
id = "google.python.uv"
775+
776+
[[order.group]]
777+
id = "google.python.missing-entrypoint"
778+
779+
[[order.group]]
780+
id = "google.utils.label-image"
781+
782+
# Pip order group.
783+
[[order]]
784+
[[order.group]]
785+
id = "google.python.runtime"
786+
787+
[[order.group]]
788+
id = "google.python.webserver"
789+
optional = true
790+
791+
[[order.group]]
792+
id = "google.python.pip"
731793
optional = true
732794

733795
[[order.group]]

0 commit comments

Comments
 (0)