Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][python-fastapi] Generated versions of PyYaml and httptools causing errors when install requirements.txt #19665

Open
5 of 6 tasks
louissullivan4 opened this issue Sep 24, 2024 · 0 comments

Comments

@louissullivan4
Copy link
Contributor

louissullivan4 commented Sep 24, 2024

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • 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

When generating a server stub using python-fastapi, the requirements.txt file includes outdated dependencies:

  • PyYAML==5.4.1
  • httptools>=0.1.2

Attempting to install these packages with Python 3.12 (or versions below) results in installation errors due to compatibility issues with the specified versions.

Error for PyYaml:
Collecting PyYAML==5.4.1 (from -r requirements.txt (line 26))
  Using cached PyYAML-5.4.1.tar.gz (175 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      ...
      AttributeError: cython_sources
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
Error for httptools:
Building wheels for collected packages: httptools
  Building wheel for httptools (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for httptools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      ...
      httptools/parser/parser.c:212:12: fatal error: 'longintrepr.h' file not found
        #include "longintrepr.h"
                 ^~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for httptools
Failed to build httptools
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (httptools)
openapi-generator version

Tested with the latest master version of openapi-generator as of 24/09/2024, and the issue still exists.

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: mail
  version: 1.0.0
  description: A sample API to illustrate OpenAPI concepts
servers:
- url: https://localhost:3000/
paths:
  "/user":
    get:
      responses:
        '200':
          description: Successfully returned a user
          content:
            application/json:
              schema:
                type: string
      description: Returns a user
Generation Details
openapi-generator generate -i mail.yaml -g python-fastapi -o ./generated-server
Steps to reproduce
  1. Generate a python-fastapi server stub using above command
  2. cd ./generated-server
  3. python -m venv venv
  4. source ./venv/bin/activate
  5. pip install -r requirements.txt
    This is where the failure hits, if you update the versions it will pass.
Related issues/PRs

PR created: 19666

Suggest a fix

Update the requirements.mustache template to include the following versions

  • PyYAML>=5.4.1,<6.1.0
  • httptools>=0.3.0,<0.7.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant