ets-labs / python-dependency-injector

Dependency injection framework for Python
https://python-dependency-injector.ets-labs.org/
BSD 3-Clause "New" or "Revised" License
3.99k stars 305 forks source link

Install fails on Python 3.13 - sillicon #827

Open Jufik opened 1 month ago

Jufik commented 1 month ago

Python 3.13 was released earlier in October 2024, and install fails. Interestingly, install is successful on 3.14-dev.

Step to reproduce

pyvenv install 3.13
pyenv local 3.13 && python -m venv .venv
source .venv/bin/activate && pip install dependency-injector

Expected output Install is successful

Curent output Install fails with current logs:

      running bdist_wheel
      running build
      running build_py
      creating build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/__init__.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/resources.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/errors.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/schema.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/wiring.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      creating build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      copying src/dependency_injector/ext/aiohttp.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      copying src/dependency_injector/ext/flask.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      copying src/dependency_injector/ext/__init__.py -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      copying src/dependency_injector/containers.pyi -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/__init__.pyi -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/providers.pyi -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/py.typed -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/providers.pxd -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/containers.pxd -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector
      copying src/dependency_injector/ext/__init__.pyi -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      copying src/dependency_injector/ext/aiohttp.pyi -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      copying src/dependency_injector/ext/flask.pyi -> build/lib.macosx-14.5-arm64-cpython-313/dependency_injector/ext
      running build_ext
      building 'dependency_injector.containers' extension
      creating build/temp.macosx-14.5-arm64-cpython-313/src/dependency_injector
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g -O3 -Wall -DCYTHON_CLINE_IN_TRACEBACK=0 -I/Users/$USER/.pyenv/versions/3.13.0/include/python3.13 -c src/dependency_injector/containers.c -o build/temp.macosx-14.5-arm64-cpython-313/src/dependency_injector/containers.o -O2
      src/dependency_injector/containers.c:828:59: warning: 'Py_UNICODE' is deprecated [-Wdeprecated-declarations]
      static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
                                                                ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/unicodeobject.h:10:1: note: 'Py_UNICODE' has been explicitly marked deprecated here
      Py_DEPRECATED(3.13) typedef wchar_t Py_UNICODE;
      ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/pyport.h:251:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      src/dependency_injector/containers.c:829:11: warning: 'Py_UNICODE' is deprecated [-Wdeprecated-declarations]
          const Py_UNICODE *u_end = u;
                ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/unicodeobject.h:10:1: note: 'Py_UNICODE' has been explicitly marked deprecated here
      Py_DEPRECATED(3.13) typedef wchar_t Py_UNICODE;
      ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/pyport.h:251:54: note: expanded from macro 'Py_DEPRECATED'
      #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
                                                           ^
      src/dependency_injector/containers.c:3271:22: error: call to undeclared function '_PyList_Extend'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          PyObject* none = _PyList_Extend((PyListObject*)L, v);
                           ^
      src/dependency_injector/containers.c:3271:22: note: did you mean 'PyList_Extend'?
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/listobject.h:52:17: note: 'PyList_Extend' declared here
      PyAPI_FUNC(int) PyList_Extend(PyObject *self, PyObject *iterable);
                      ^
      src/dependency_injector/containers.c:3271:15: error: incompatible integer to pointer conversion initializing 'PyObject *' (aka 'struct _object *') with an expression of type 'int' [-Wint-conversion]
          PyObject* none = _PyList_Extend((PyListObject*)L, v);
                    ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/dependency_injector/containers.c:32151:7: error: call to undeclared function '_PyDict_SetItem_KnownHash'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if (__Pyx_SetNameInClass(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
            ^
      src/dependency_injector/containers.c:3321:38: note: expanded from macro '__Pyx_SetNameInClass'
          (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
                                           ^
      src/dependency_injector/containers.c:32151:7: note: did you mean '_PyDict_GetItem_KnownHash'?
      src/dependency_injector/containers.c:3321:38: note: expanded from macro '__Pyx_SetNameInClass'
          (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
                                           ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/dictobject.h:38:24: note: '_PyDict_GetItem_KnownHash' declared here
      PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
                             ^
      src/dependency_injector/containers.c:34712:13: error: call to undeclared function '_PyGen_SetStopIterationValue'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                  _PyGen_SetStopIterationValue(result);
                  ^
      src/dependency_injector/containers.c:34712:13: note: did you mean '__Pyx_PyGen__FetchStopIterationValue'?
      src/dependency_injector/containers.c:34467:12: note: '__Pyx_PyGen__FetchStopIterationValue' declared here
      static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
                 ^
      src/dependency_injector/containers.c:36049:5: error: call to undeclared function '_PyErr_FormatFromCause'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
          _PyErr_FormatFromCause(
          ^
      src/dependency_injector/containers.c:36864:13: error: call to undeclared function '_PyUnicode_FastCopyCharacters'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                  _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
                  ^
      src/dependency_injector/containers.c:36864:13: note: did you mean 'PyUnicode_CopyCharacters'?
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/unicodeobject.h:416:24: note: 'PyUnicode_CopyCharacters' declared here
      PyAPI_FUNC(Py_ssize_t) PyUnicode_CopyCharacters(
                             ^
      src/dependency_injector/containers.c:38432:70: error: too few arguments to function call, expected 6, have 5
                                                    is_little, !is_unsigned);
                                                                           ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/longobject.h:111:17: note: '_PyLong_AsByteArray' declared here
      PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
                      ^
      src/dependency_injector/containers.c:38628:70: error: too few arguments to function call, expected 6, have 5
                                                    is_little, !is_unsigned);
                                                                           ^
      /Users/$USER/.pyenv/versions/3.13.0/include/python3.13/cpython/longobject.h:111:17: note: '_PyLong_AsByteArray' declared here
      PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
                      ^
      2 warnings and 8 errors generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
oleksandr-kuzmenko commented 4 weeks ago

I'm also waiting for python 3.13 support

JFYI https://github.com/ets-labs/python-dependency-injector/issues/812 https://github.com/ets-labs/python-dependency-injector/issues/812#issuecomment-2340716157

rmk135 commented 3 weeks ago

Hi @Jufik! Can you try it now with version 4.43.0? It was released yesterday and contains support for Python 3.13. There should be a pre-compiled package for Apple Silicon.

rmk135 commented 3 weeks ago

@oleksandr-kuzmenko , Python 3.13 support is available in 4.43.0 which was released yesterday.

oleksandr-kuzmenko commented 3 weeks ago

great news, thank you very much 🙌