Confirm this is a Python library issue and not an underlying Cloudflare API issue.
edit: I'm not sure this is an issue with the "Python library" but with the Python support in CloudFlare itself, but I don't see where that is reportable/feature requestable? I came here via the link in the CloudFlare developer platform changelog and would appreciate being pointed in the right direction if I'm in the wrong place!
Describe the bug
I'm not sure how easy it would be for you to use uv behind the scenes to set Python up itself, but this is something uv supports.
Currently PYTHON_VERSION triggers setup of a Python runtime via pyenv, to my understanding.
I imagine uv would do this faster, as uv is optimised for speed, besides which once I get a Python [with pip] the first thing I have to do is use that to get uv to set up the tool I actually want.
I use uv rather than plain pip because it works with my lockfile, and for many Python developers it is the go-to tool, so this makes cloudflare-python feel a little awkward to work with. I would think this can be easily fixed by having a mechanism to set up uv?
A Python runtime is set up if you set PYTHON_VERSION (here "3.13") but then you have to pip install uv to get uv.
This setup took ~100 seconds, 94% of which is building Python from source. uv can install Python for you, it'd be nice to be able to instead set UV_PYTHON_VERSION and have uv install a Python runtime via python-build-standalone (used by mise for example). This exact scenario is highlighted in the uv docs in contrast to the uv approach:
As Python does not publish official distributable CPython binaries, uv instead uses pre-built distributions from the Astral python-build-standalone project. python-build-standalone is also is used in many other Python projects, like Mise and bazelbuild/rules_python.
The uv Python distributions are self-contained, highly-portable, and performant. While Python can be built from source, as in tools like pyenv, doing so requires preinstalled system dependencies, and creating optimized, performant builds (e.g., with PGO and LTO enabled) is very slow.
These distributions have some behavior quirks, generally as a consequence of portability; see the python-build-standalone quirks documentation for details.
2026-05-11T09:58:20.18442Z Detected the following tools from environment: python@3.13.12, pip@25.1.1
2026-05-11T09:58:20.184785Z Installing python 3.13.12
2026-05-11T09:58:20.92625Z From https://github.com/pyenv/pyenv
2026-05-11T09:58:20.926531Z d26308df..c639152a master -> origin/master
2026-05-11T09:58:20.926629Z * [new tag] v2.6.31 -> v2.6.31
2026-05-11T09:58:20.941038Z * [new tag] v2.6.27 -> v2.6.27
2026-05-11T09:58:20.941232Z * [new tag] v2.6.28 -> v2.6.28
2026-05-11T09:58:20.941299Z * [new tag] v2.6.29 -> v2.6.29
2026-05-11T09:58:20.941401Z * [new tag] v2.6.30 -> v2.6.30
2026-05-11T09:58:21.131194Z python-build 3.13.12 /opt/buildhome/.asdf/installs/python/3.13.12
2026-05-11T09:58:21.206109Z Downloading Python-3.13.12.tar.xz...
2026-05-11T09:58:21.206372Z -> https://www.python.org/ftp/python/3.13.12/Python-3.13.12.tar.xz
2026-05-11T09:58:23.253131Z Installing Python-3.13.12...
2026-05-11T09:59:57.220831Z Installed Python-3.13.12 to /opt/buildhome/.asdf/installs/python/3.13.12
2026-05-11T09:59:58.07709Z Executing user command: pip install uv && uvx zensical build
2026-05-11T09:59:58.977421Z Collecting uv
2026-05-11T09:59:59.031347Z Downloading uv-0.11.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)
2026-05-11T09:59:59.050936Z Downloading uv-0.11.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.7 MB)
2026-05-11T09:59:59.530469Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.7/24.7 MB 54.2 MB/s 0:00:00
2026-05-11T09:59:59.57034Z Installing collected packages: uv
2026-05-11T09:59:59.921853Z Successfully installed uv-0.11.13
2026-05-11T10:00:00.031242Z
2026-05-11T10:00:00.031568Z [notice] A new release of pip is available: 25.3 -> 26.1.1
2026-05-11T10:00:00.031744Z [notice] To update, run: pip3 install --upgrade pip
2026-05-11T10:00:00.100405Z Reshimming asdf python...
uv setup benchmark
I measured in an Ubuntu (latest) Docker container:
- Installing uv takes 3 seconds
curl -LsSf https://astral.sh/uv/install.sh | sh
root@564346048fa8:/# export PATH="$HOME/.local/bin:$PATH"
root@564346048fa8:/# uv --version
uv 0.11.13 (x86_64-unknown-linux-gnu)
- Installing Python 3.13 takes another 3 seconds
root@564346048fa8:/# UV_PYTHON_VERSION=3.13
root@564346048fa8:/# uv python install $UV_PYTHON_VERSION
Installed Python 3.13.13 in 3.31s
+ cpython-3.13.13-linux-x86_64-gnu (python3.13)
So we're easily looking at over 10x faster than the pyenv approach (~6s not 100s)
To Reproduce
- Set
PYTHON_VERSION when setting up CloudFlare Pages
- Build spends 94s compiling Python from source
- This compilation step could pull prebuilt binaries much faster
Code snippets
OS
Linux
Python version
3.13
Library version
v5.1.0 (latest)
Confirm this is a Python library issue and not an underlying Cloudflare API issue.
Describe the bug
I'm not sure how easy it would be for you to use uv behind the scenes to set Python up itself, but this is something uv supports.
Currently
PYTHON_VERSIONtriggers setup of a Python runtime viapyenv, to my understanding.I imagine uv would do this faster, as uv is optimised for speed, besides which once I get a Python [with pip] the first thing I have to do is use that to get uv to set up the tool I actually want.
I use uv rather than plain pip because it works with my lockfile, and for many Python developers it is the go-to tool, so this makes cloudflare-python feel a little awkward to work with. I would think this can be easily fixed by having a mechanism to set up uv?
A Python runtime is set up if you set
PYTHON_VERSION(here "3.13") but then you have topip install uvto get uv.This setup took ~100 seconds, 94% of which is building Python from source. uv can install Python for you, it'd be nice to be able to instead set
UV_PYTHON_VERSIONand have uv install a Python runtime via python-build-standalone (used by mise for example). This exact scenario is highlighted in the uv docs in contrast to the uv approach:uv setup benchmark
I measured in an Ubuntu (latest) Docker container:
curl -LsSf https://astral.sh/uv/install.sh | shSo we're easily looking at over 10x faster than the pyenv approach (~6s not 100s)
To Reproduce
PYTHON_VERSIONwhen setting up CloudFlare PagesCode snippets
OS
Linux
Python version
3.13
Library version
v5.1.0 (latest)