zeeguu / api

API for tracking a learner's progress when reading materials in a foreign language and recommending further personalized exercises and readings.
https://zeeguu.org
MIT License
8 stars 23 forks source link

Why is the build failing? #284

Closed mircealungu closed 15 hours ago

mircealungu commented 1 day ago

looking at the build output

we can see the following:

self = <FlaskClient <Flask 'Zeeguu-API'>>
args = (<Flask 'Zeeguu-API'>, <class 'flask.wrappers.Response'>)
kwargs = {'use_cookies': True}

    def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
        super().__init__(*args, **kwargs)
        self.preserve_context = False
        self._new_contexts: list[t.ContextManager[t.Any]] = []
        self._context_stack = ExitStack()
        self.environ_base = {
            "REMOTE_ADDR": "127.0.0.1",
>           "HTTP_USER_AGENT": f"werkzeug/{werkzeug.__version__}",
        }
E       AttributeError: module 'werkzeug' has no attribute '__version__'

I guess it's a matter of some version incompatibility between some of our upstream dependencies.

tfnribeiro commented 22 hours ago

I noted this in one of the PRs, however I don't replicate it in the docker container so I am a bit unsure what's happening. I will look into the action file to see if something there is off.

tfnribeiro commented 21 hours ago

Alright, I figured out why, I guess it's because our flask is still using an older version which expects werkzeug to have .version but this has been deprecated in more recent versions:

>>> import werkzeug
>>> werkzeug.__version__
<stdin>:1: DeprecationWarning: The '__version__' attribute is deprecated and will be removed in Werkzeug 3.1. Use feature detection or 'importlib.metadata.version("werkzeug")' instead.
'3.0.2'

I guess we either have to pin the build or maybe upgrade flask / python?

tfnribeiro commented 21 hours ago

I fixed it with: https://github.com/zeeguu/api/commit/3d33785c78fd076517a03b36840823fbf3da8425 (the version I had in my docker container)

I guess at some point we should look to upgrade python + flask.

mircealungu commented 20 hours ago

yes, we should upgrade to the latest flask!

tfnribeiro commented 15 hours ago

I am closing this one, as I opened https://github.com/zeeguu/api/issues/288