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

RouteTableDef.options() not available in 3.8.1 on PyPI #6323

Closed
1 task done
tstodden opened this issue Nov 18, 2021 · 4 comments
Closed
1 task done

RouteTableDef.options() not available in 3.8.1 on PyPI #6323

tstodden opened this issue Nov 18, 2021 · 4 comments
Assignees
Labels

Comments

@tstodden
Copy link

Describe the bug

There is an options() method available for RouteTableDef in web_routedef.py for 3.8.1, but when I go to use the decorator approach for creating a route I get a failure saying AttributeError: 'RouteTableDef' object has no attribute 'options'. I downloaded the source from PyPI and the options method seems to be missing.

Is there some reason why this method would not be included in the package distributed on PyPI? Thanks!

To Reproduce

  1. Install aiohttp 3.8.1 from PyPI
  2. Attempt to create a route using the following approach
routes = web.RouteTableDef()

@routes.options("/email")
async def handle...

Expected behavior

To be able to use the following approach to creating a route that can handle an OPTIONS request

routes = web.RouteTableDef()

@routes.options("/email")
async def handle...

Logs/tracebacks

Traceback (most recent call last):
  File "/home/tyler/.pyenv/versions/3.10.0/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/tyler/.pyenv/versions/3.10.0/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/tyler/code/python/email-service/service/__main__.py", line 12, in <module>
    @routes.options("/email")
AttributeError: 'RouteTableDef' object has no attribute 'options'

Python Version

$ python --version
Python 3.10.0

aiohttp Version

$ python -m pip show aiohttp
Name: aiohttp
Version: 3.8.1
Summary: Async http client/server framework (asyncio)
Home-page: https://github.com/aio-libs/aiohttp
Author:
Author-email:
License: Apache 2
Location: /home/tyler/.local/share/virtualenvs/email-service-fx4Px62o/lib/python3.10/site-packages
Requires: frozenlist, aiosignal, yarl, attrs, async-timeout, multidict, charset-normalizer
Required-by:

multidict Version

$ python -m pip show multidict
Name: multidict
Version: 5.2.0
Summary: multidict implementation
Home-page: https://github.com/aio-libs/multidict
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /home/tyler/.local/share/virtualenvs/email-service-fx4Px62o/lib/python3.10/site-packages
Requires:
Required-by: yarl, aiohttp

yarl Version

$ python -m pip show yarl
Name: yarl
Version: 1.7.2
Summary: Yet another URL library
Home-page: https://github.com/aio-libs/yarl/
Author: Andrew Svetlov
Author-email: andrew.svetlov@gmail.com
License: Apache 2
Location: /home/tyler/.local/share/virtualenvs/email-service-fx4Px62o/lib/python3.10/site-packages
Requires: idna, multidict
Required-by: aiohttp

OS

Arch Linux

Related component

Server

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@tstodden tstodden added the bug label Nov 18, 2021
@asvetlov
Copy link
Member

3.8.1 is built from 3.8 branch.
Perhaps the PR was landed on the master only and was not backported to 3.8

@tstodden
Copy link
Author

3.8.1 is built from 3.8 branch. Perhaps the PR was landed on the master only and was not backported to 3.8

Got it, yeah it looks like OPTIONS support was implemented in #4615 on master. There is an easy workaround in using:

routes = RouteTableDef()

@routes.route("OPTIONS", "/path"):
def ...

But it might be a good idea to include in the released version for consistency with master. I'm not sure I know how to do the backport myself, otherwise I'd open a PR.

@asvetlov
Copy link
Member

Thank you for pointing on the PR.
I'll create the backport myself.
Will be published by 3.8.2 (release date is not scheduled yet).

@asvetlov asvetlov assigned asvetlov and unassigned asvetlov Nov 18, 2021
@asvetlov
Copy link
Member

Backported by 7a647d5 and 4521ba3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants