FS#68874 - [python-aiohttp-apispec] 2.2.1-2 is not compatible with python-apispec 4.0.0+

Attached to Project: Community Packages
Opened by Houkime (houkime) - Sunday, 06 December 2020, 20:53 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 25 April 2023, 20:00 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Filipe Laíns (FFY00)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Upstream of the python-aiohttp-apispec is not yet made compatible with python-apispec 4.0.0+ and this is reflected in requirements.txt
https://github.com/maximdanilchenko/aiohttp-apispec/blob/master/requirements.txt
However, package allows apispec to be 4.0.0 which results in runtime error.

Additional info:

* Versions: python-aiohttp-apispec 2.2.1-2 python-apispec 4.0.0-3
* Runtime error example: https://github.com/Tribler/tribler/issues/5814
(but minimal example is also constructed below)
* upstream report: https://github.com/maximdanilchenko/aiohttp-apispec/issues/105

Steps to reproduce:
* install python-aiohttp-apispec

try running attached test.py
this will end up in error like this:

```
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-1' coro=<_run_app() done, defined at /usr/lib/python3.9/site-packages/aiohttp/web.py:287> exception=TypeError("schema2parameters() missing 1 required keyword-only argument: 'location'")>
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/aiohttp/web.py", line 508, in run_app
loop.run_until_complete(main_task)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/usr/lib/python3.9/site-packages/aiohttp/web.py", line 319, in _run_app
await runner.setup()
File "/usr/lib/python3.9/site-packages/aiohttp/web_runner.py", line 275, in setup
self._server = await self._make_server()
File "/usr/lib/python3.9/site-packages/aiohttp/web_runner.py", line 375, in _make_server
await self._app.startup()
File "/usr/lib/python3.9/site-packages/aiohttp/web_app.py", line 416, in startup
await self.on_startup.send(self)
File "/usr/lib/python3.9/site-packages/aiohttp/signals.py", line 34, in send
await receiver(*args, **kwargs) # type: ignore
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 77, in doc_routes
self._register(app_)
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 117, in _register
self._register_route(route, method, view)
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 131, in _register_route
self._update_paths(view.__apispec__, method, self.prefix + url_path)
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 137, in _update_paths
parameters = self.plugin.converter.schema2parameters(
TypeError: schema2parameters() missing 1 required keyword-only argument: 'location'
Traceback (most recent call last):
File "/home/user/aiotest/test.py", line 38, in <module>
web.run_app(app)
File "/usr/lib/python3.9/site-packages/aiohttp/web.py", line 508, in run_app
loop.run_until_complete(main_task)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/usr/lib/python3.9/site-packages/aiohttp/web.py", line 319, in _run_app
await runner.setup()
File "/usr/lib/python3.9/site-packages/aiohttp/web_runner.py", line 275, in setup
self._server = await self._make_server()
File "/usr/lib/python3.9/site-packages/aiohttp/web_runner.py", line 375, in _make_server
await self._app.startup()
File "/usr/lib/python3.9/site-packages/aiohttp/web_app.py", line 416, in startup
await self.on_startup.send(self)
File "/usr/lib/python3.9/site-packages/aiohttp/signals.py", line 34, in send
await receiver(*args, **kwargs) # type: ignore
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 77, in doc_routes
self._register(app_)
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 117, in _register
self._register_route(route, method, view)
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 131, in _register_route
self._update_paths(view.__apispec__, method, self.prefix + url_path)
File "/usr/lib/python3.9/site-packages/aiohttp_apispec/aiohttp_apispec.py", line 137, in _update_paths
parameters = self.plugin.converter.schema2parameters(
TypeError: schema2parameters() missing 1 required keyword-only argument: 'location'
```

Now, if you do

pip install --user aiohttp_apispec

and run test.py again, this will run normally.

```
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
```
(to revert to broken situation, pip uninstall apispec aiohttp_apispec, this will make pacman-installed system versions active again)
   test.py (0.9 KiB)
This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 25 April 2023, 20:00 GMT
Reason for closing:  Won't fix
Additional comments about closing:  Pkg dropped to the AUR
Comment by Filipe Laíns (FFY00) - Monday, 07 December 2020, 16:54 GMT
Felix, can you downgrade python-apispec?
Comment by Felix Yan (felixonmars) - Monday, 11 January 2021, 22:03 GMT
@FFY00

Please consider to add a separate old python-apispec3 package if it's not so easy to fix the package for new python-apisepc.
Comment by Felix Yan (felixonmars) - Monday, 14 November 2022, 20:36 GMT
FYI: aiohttp-apispec supports new apispec since version 3.0 (currently beta): https://github.com/maximdanilchenko/aiohttp-apispec/commit/cd8c68e761c74484530b5a19ac95d01487b06e99

Loading...