fastapi-code-generator icon indicating copy to clipboard operation
fastapi-code-generator copied to clipboard

remove typed-ast (EOL) from dependencies and update poetry.lock

Open marcoemorais opened this issue 8 months ago • 1 comments

The fastapi-code-generator has a dependency on typed-ast in the pyproject.toml and poetry.lock even though this dependency is not used in the repository. The typed-ast package is EOL on pypi and cannot be installed with python 3.13. As a result, users are not able to install fastapi-code-generator with python 3.13.

On this commit I remove the typed-ast from pyproject.toml and regenerate the poetry.lock. Publishing a new version of fastapi-code-generator based on this commit to pypi will allow users to install fastapi-code-generator with python 3.13.

marcoemorais avatar Apr 10 '25 22:04 marcoemorais

Instructions for reproducing.

  1. Install fastapi-code-generator==0.5.1 on python 3.13 generates error.
$ docker run --rm -it -v $(pwd):/src --entrypoint /bin/bash python:3.13-bookworm
root@36f6bb7d082a:/# pip install fastapi-code-generator==0.5.1                                                                                     
Collecting fastapi-code-generator==0.5.1                                                                                                           
  Downloading fastapi_code_generator-0.5.1-py3-none-any.whl.metadata (22 kB)
...
Building wheels for collected packages: stringcase, typed-ast
  Building wheel for stringcase (pyproject.toml) ... done
  Created wheel for stringcase: filename=stringcase-1.2.0-py3-none-any.whl size=3635 sha256=4f3ca22173f1cf35d392b96599e6e81b07ff70b063ae27555fa932f81871d9cb
  Stored in directory: /root/.cache/pip/wheels/cc/7a/34/a1ee5a3a7b5ca8aef0588af3dd02e498799e533b0545a328d1
  Building wheel for typed-ast (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for typed-ast (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-313/typed_ast
      copying typed_ast/__init__.py -> build/lib.linux-x86_64-cpython-313/typed_ast
      copying typed_ast/ast3.py -> build/lib.linux-x86_64-cpython-313/typed_ast
      copying typed_ast/conversions.py -> build/lib.linux-x86_64-cpython-313/typed_ast
      copying typed_ast/ast27.py -> build/lib.linux-x86_64-cpython-313/typed_ast
      creating build/lib.linux-x86_64-cpython-313/typed_ast/tests
      copying ast3/tests/test_basics.py -> build/lib.linux-x86_64-cpython-313/typed_ast/tests
      running build_ext
      building '_ast27' extension
      creating build/temp.linux-x86_64-cpython-313/ast27/Custom
      creating build/temp.linux-x86_64-cpython-313/ast27/Parser
      creating build/temp.linux-x86_64-cpython-313/ast27/Python
      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -Iast27/Include -I/usr/local/include/python3.13 -c ast27/Custom/typed_ast.c -o build/temp.linux-x86_64-cpython-313/ast27/Custom/typed_ast.o
      In file included from /usr/local/include/python3.13/pyport.h:358,
                       from /usr/local/include/python3.13/Python.h:63,
                       from ast27/Custom/typed_ast.c:1:
      ast27/Custom/../Include/compile.h:12:12: error: unknown type name ‘PyFutureFeatures’
         12 | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
            |            ^~~~~~~~~~~~~~~~
      /usr/local/include/python3.13/exports.h:94:53: note: in definition of macro ‘PyAPI_FUNC’
         94 | #       define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE
            |                                                     ^~~~~
      error: command '/usr/bin/gcc' 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 typed-ast
Successfully built stringcase
Failed to build typed-ast

  1. Install fastapi-code-generator==0.5.1 built with the changes on this commit on python 3.13 is successful.
# pip install /src/.mmorais/dist/fastapi_code_generator-0.5.1.tar.gz           
Processing /src/.mmorais/dist/fastapi_code_generator-0.5.1.tar.gz
...
Building wheels for collected packages: fastapi-code-generator
  Building wheel for fastapi-code-generator (pyproject.toml) ... done
  Created wheel for fastapi-code-generator: filename=fastapi_code_generator-0.5.1-py3-none-any.whl size=18636 sha256=9e9a1908a710ea8bdd58fad21e81aef3e38677c01d91c446e710ffcea451184e
  Stored in directory: /root/.cache/pip/wheels/af/9d/f3/6cb866c60835f4f93e950dac6c663d1104d82a7adeef143722
Successfully built fastapi-code-generator

marcoemorais avatar Apr 10 '25 23:04 marcoemorais