Skip to content

Add 3.16-rc windows variants - #1139

Open
yosifkit wants to merge 1 commit into
docker-library:masterfrom
infosiftr:3.16-windows
Open

yosifkit wants to merge 1 commit into
docker-library:masterfrom
infosiftr:3.16-windows

Conversation

@yosifkit

Copy link
Copy Markdown
Member

The Python install manager for Windows is our tool for installing and managing runtimes. The traditional executable installer will stop being released with Python 3.16

-https://www.python.org/downloads/release/pymanager-261/

See also https://peps.python.org/pep-0773/

With the removal of the traditional executable installer for Windows in 3.16+, we needed to rework the Windows images and either use the Python install manager or the windows zip files directly. Since we don't want to keep pymanager installed in the resulting image, and it just downloads the same zip files, this PR just uses the zip files directly. (Plus it is complicated to use the .msix or .msi in a container.)

The 3.16-rc Windows Dockerfiles are very close to the pypy Windows Dockerfiles now, but the python zip includes the vcruntime DLL, so we don't have to install it like pypy.

image requirements:

  • parity with 3.15 and earlier windows images (e.g. python and pip available)
  • minimal extra maintenance

Possible follow up:

-ArgumentList @( \
'/quiet', \
'InstallAllUsers=1', \
'TargetDir=C:\Python', \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should match -- either C:\Python consistently in the new stuff or update the old images to C:\python (and I have a slight preference for the former, just to avoid even the possibility of breaking someone on the older images).

Comment thread shared.jq Outdated
def rcVersion:
env.version | rtrimstr("-rc")
;
def isWindowsZip:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol this looks funny next to is_alpine and is_slim (rcVersion only gets a pass because it matches the term for that we use elsewhere)

Comment thread versions.sh
Comment on lines +24 to +33
# > phase out the traditional installer by Python 3.16
# https://peps.python.org/pep-0773/#replacing-other-installers
case "${fullVersion}" in
3.11.*|3.12.*|3.13.*|3.14.*|3.15.*)
filename="python-$fullVersion-amd64.exe"
;;
*)
filename="python-$fullVersion-amd64.zip"
;;
esac

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing {{ if isWindowsZip then "zip" else "exe" end }} over and over in the template, should we store this in versions.json? Maybe store the full url and just trim off the file extension in the template instead?

Comment thread Dockerfile-windows.template Outdated
@@ -1,28 +1,54 @@
{{
def extension:
.checksums.windows.url | sub(".*[.]"; "")

@yosifkit yosifkit Oct 22, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively, split(".")[-1] or perhaps something else?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think split(".")[-1] is better 👍

Comment thread Dockerfile-windows.template Outdated
{{ ) else "" end -}}

RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f ($env:PYTHON_VERSION -replace '[a-z]+[0-9]*$', ''), $env:PYTHON_VERSION); \
RUN $url = '{{ .checksums.windows.url }}'; \

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I could use | @sh but I think that would not work for powershell.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use @sh, but you could use @json and PowerShell's ConvertFrom-Json, probably 👀

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, it's apparently safe enough if we use single quotes and gsub("'"; "''"):

Suggested change
RUN $url = '{{ .checksums.windows.url }}'; \
RUN $url = '{{ .checksums.windows.url | gsub("'"; "''") }}'; \

(because powershell is very strict about single quoted strings)

Comment thread Dockerfile-windows.template Outdated
Write-Host 'Re-Installing pip ...'; \
# remove zip-provided pip so that we can reinstall and get the exe in c:/python/Scripts
Remove-Item -Recurse C:/python/Lib/site-packages/pip; \
Remove-Item -Recurse C:/python/Lib/site-packages/pip-*; \

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh, missed these C:/python -> C:/Python swaps (even if it still works 🙃).

@yosifkit
yosifkit force-pushed the 3.16-windows branch 2 times, most recently from ca0f6de to b7c5ef8 Compare October 22, 2026 21:30
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