Skip to content

[BUG] python-fastapi requirements.txt incompatible with Python 3.14 #24788

Description

@bendres97

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

It was discovered during testing on Python 3.14 that our docker builds fail when using the shipped requirements.txt file for FastAPI due to a version mismatch with typing-extensions. Pinning later versions of this specific package resolves the issue.

During research, it was discovered that there are several other packages that could use updating to use prebuilt wheels for Python 3.14 and move away from old packages.

openapi-generator version

7.25.0

OpenAPI declaration file content or url

https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/refs/heads/master/examples/v3.0/petstore.yaml

Generation Details
docker run \
  -v ${PWD}:/local \
  openapitools/openapi-generator-cli generate \
  -g python-fastapi \
  -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator-cli/refs/heads/master/examples/v3.0/petstore.yaml \
  -o /local/python
Steps to reproduce

Update Dockerfile to use Python 3.14 and install requirements.txt:

FROM python:3.14 AS builder

WORKDIR /usr/src/app

RUN python3 -m venv /venv
ENV PATH="/venv/bin:$PATH"

COPY . .
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir .

Build the Dockerfile

Observe an error in PyO3 specifically for Python 3.14:

744.0         error: the configured Python interpreter version (3.14) is newer than PyO3's maximum supported version (3.13)
744.0         = help: please check if an updated version of PyO3 is available. Current version: 0.24.1
744.0         = help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
744.0       warning: build failed, waiting for other jobs to finish...
744.0       💥 maturin failed
744.0         Caused by: Failed to build a native library through cargo
744.0         Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_BUILD_EXTENSION_MODULE="1" PYO3_ENVIRONMENT_SIGNATURE="cpython-3.14-64bit" PYO3_PYTHON="/venv/bin/python3" PYTHON_SYS_EXECUTABLE="/venv/bin/python3" "cargo" "rustc" "--profile" "release" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/tmp/pip-install-4g750msd/pydantic-core_2b59c4cd37794b708db3f471f62f7938/Cargo.toml" "--lib" "--crate-type" "cdylib"`
744.0       Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/venv/bin/python3', '--compatibility', 'off'] returned non-zero exit status 1
744.0       [end of output]

Pinning typing-extensions is forcing pydantic to be resolved to an older version that's not prebuilt for 3.14 so it tries to build from source which is using an older version of PyO3 that's incompatible with Python 3.14.

Related issues/PRs
Suggest a fix

Update requirements.txt with newer packages for Python 3.14. Consider if requirements.txt is necessary when projects can be built as a wheel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions