[python] Fix invalid pip syntax for httpx/tornado in requirements.txt#23889
Merged
wing328 merged 1 commit intoMay 28, 2026
Merged
Conversation
The httpx and tornado entries in the python generator's
requirements.mustache template were written using TOML/Pipfile-style
`name = "spec"` assignment syntax, which is invalid in a pip
requirements.txt file. The surrounding entries (urllib3,
python_dateutil, pydantic, etc.) all use the correct pip syntax.
This made `pip install -r requirements.txt` fail with:
ERROR: Invalid requirement: 'httpx = ">= 0.28.1"': Expected
semicolon (after name with no version specifier) or end
httpx = ">= 0.28.1"
^ (from line 2 of requirements.txt)
for every Python client generated with `--library httpx` (and the same
issue would affect `--library tornado`).
The Poetry and PEP 621 sections of `pyproject.mustache` are unaffected;
they already use the correct syntax for their respective formats.
Also regenerated samples/openapi3/client/petstore/python-httpx/requirements.txt
to match the corrected template.
Member
|
thanks for the fix i'm able to repeat the issue with #23892 will add that after merging your fix. |
Member
|
FYI. Merged #23892 to update the CI workflow covering the issue moving forward. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the PR
The
httpxandtornadoentries in the python generator'srequirements.mustachetemplate were written using TOML / Pipfile-stylename = "spec"assignment syntax, which is not valid in a piprequirements.txtfile. The other entries in the same template(
urllib3,python_dateutil,pydantic,aiohttp, etc.) all use thecorrect pip syntax — only these two lines are wrong.
As a result, every Python client generated with
--library httpxfails immediately at
pip install -r requirements.txt:The same bug would affect
--library tornado(same broken pattern on theline below it in the template), though that path is less commonly used.
What this PR changes
In
modules/openapi-generator/src/main/resources/python/requirements.mustache:{{#httpx}} -httpx = ">= 0.28.1" +httpx >= 0.28.1 {{/httpx}} {{#tornado}} -tornado = ">= 4.2, < 5" +tornado >= 4.2, < 5 {{/tornado}}And the committed sample at
samples/openapi3/client/petstore/python-httpx/requirements.txtisregenerated to match.
Scope check — was this bug anywhere else?
I checked the other two python dependency templates:
python/setup.mustache— not affected. Theinstall_requiresentries already use correct pip syntax:
"httpx >= 0.28.1","tornado>=4.2, < 5".python/pyproject.mustache— not affected. Both dependencysections are syntactically valid:
[tool.poetry.dependencies]useshttpx = ">= 0.28.1", which isthe correct TOML form for Poetry.
[project].dependenciesuses"httpx (>=0.28.1)", which is thecorrect PEP 621 form.
So the fix is isolated to
requirements.mustacheplus itscorresponding sample.
PR checklist
./bin/(or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. (Only thepython-httpxsample changed; updated in this PR.)masterbranch for non-breaking changes.cc @OpenAPITools/generator-core-team
cc python technical committee
Summary by cubic
Fix pip requirement syntax for
httpxandtornadoin the Python generator so generated clients install cleanly. Replaces TOML-stylename = "spec"with valid pip specifiers and updates thepython-httpxsample.python/requirements.mustache, usehttpx >= 0.28.1andtornado >= 4.2, < 5.samples/openapi3/client/petstore/python-httpx/requirements.txt.setup.mustacheandpyproject.mustacheare already correct (no changes).Written for commit f81d086. Summary will update on new commits.
Review in cubic