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

webargs.async and webargs.aiohttpparser contain un-guarded Python 3 syntax #105

Closed
ijstokes opened this issue May 2, 2016 · 5 comments
Closed

Comments

@ijstokes
Copy link

ijstokes commented May 2, 2016

pip install webargs or setuptools-based install python setup.py install of webargs when using Python 2.x results in SyntaxError on either of these statements:

import webargs.async
import webargs.aiohttpparser

Perhaps it makes sense to incorporate an import guard that would raise an ImportError instead, or something that would more clearly indicate that those sub-modules aren't available when using Python 2.x

Incidentally, I came across this while trying to create conda packages for webargs that work with Python 2.7.

@freddrake
Copy link

Isn't this the same as issue #86?

Ultimately, the problem is that tools attempt to force byte-compilation without considering syntax errors being reported during parsing (not execution). There's nothing that can be done about this from within the code of the offending modules, aside from avoiding Python 3 syntax completely. I'm not sure there's a valid reason for that in the case of these particular modules.

Ultimately, byte-compilation steps from tools should tolerate these syntax errors and simply not install generated .pyc files for modules that trigger these errors.

@freddrake
Copy link

Alternately, these modules could be dropped from installations targeting Python 2.

Making the tools (setuptools, pip, the Debian install process) more resilient is probably the better approach, because it applies to all packages, rather than forcing all affected packages to worry about this. But this can be reasonably argued either way.

@sloria
Copy link
Member

sloria commented May 29, 2016

There doesn't seem to be a clean way to do this in setup.py, though I may be missing something.

One alternative would be to separate the aiohttp code into a separate package. It's really not ideal though, because that would be a breaking change.

@asmodehn
Copy link

I am having this problem as well, trying to release webargs for ROS
Not really breaking, since I don't use aiohttp or any async behavior though. The .pyc files are just missing from the final deb package.

IMHO, using FromWrapper() from trollius for now (not a breaking change I believe) is probably best option... How about it ?

And maybe at some point in the future, separate "all async" behavior requiring python3, in a different subpackage/plugin ? I m kind of expecting more async driven python3 webservers will appear...

@sloria
Copy link
Member

sloria commented Mar 16, 2017

Closing this for now, since we don't have plans on making changes to support this.

@sloria sloria closed this as completed Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants