googleapis / synthtool

Apache License 2.0
89 stars 84 forks source link

chore(python): Add Python 3.12 #1903

Closed m-strzelczyk closed 11 months ago

m-strzelczyk commented 11 months ago

Following what #1742 did.

parthea commented 11 months ago

Thanks for putting this together @m-strzelczyk ! Please could you also help with testing in a downstream repo, for example python-bigquery-storage?

I think we may need to add python 3.12 support in https://github.com/googleapis/testing-infra-docker/blob/c02d27d75de5d8f4edb90568e15f42bd9d400c91/python/googleapis/python-multi/Dockerfile#L122 which is for the gcr.io/cloud-devrel-kokoro-resources/python-multi:latest image used in the Kokoro Prerelease Dependencies. For example, see this check in python-bigquery-storage.

To test the changes, run the following command in a clone of this repo (in the specific branch where you made changes)

docker build -f docker/owlbot/python/Dockerfile -t python312 .

Then in a downstream repo such as https://github.com/googleapis/python-bigquery-storage, run

docker run --user $(id -u):$(id -g) --rm -v $(pwd):/repo -w /repo python312
m-strzelczyk commented 11 months ago

I ran the commands you mentioned, but I'm not sure that it actually tested the new python-multi image. I did build the docker/owlbot/python/Dockerfile image and used it on python-bigquery-storage - it seems to only run black on the source code.

Not sure how to locally replicate the whole build and test process that actually runs inside the python-multi on Kokoro.

I did similar changes to python-docs-samples/.kokoro/docker/Dockerfile in #10930 and it worked fine there. As far as I can see, those Dockerfiles are almost identical.

parthea commented 11 months ago

In the monorepo we use the latest python runtime in the prerelease_deps nox session. I think we need this change in split repositories to help with the roll out of the new runtime. Unrelated to your changes, could you please update the file synthtool/gcp/templates/python_library/noxfile.py.j2 to use the latest python version for the prerelease_deps nox session in split repos?

https://github.com/googleapis/synthtool/blob/74ed3ebfea2d0634024bedc4fe08b4c177d7c884/synthtool/gcp/templates/python_mono_repo_library/noxfile.py.j2#L419-L420

https://github.com/googleapis/synthtool/blob/74ed3ebfea2d0634024bedc4fe08b4c177d7c884/synthtool/gcp/templates/python_library/noxfile.py.j2#L410-L411

parthea commented 11 months ago

Will address https://github.com/googleapis/synthtool/pull/1903#issuecomment-1823011348 in a separate PR