-
Notifications
You must be signed in to change notification settings - Fork 565
Support for PY37 without contextvars #138
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
Conversation
This MR aligns the uvloop code to become compatible, not production ready, with PY37 adding the following changes: - Support for the new API used behind the `set_debug` function. - Adds the `context=None` kw to those functions that will receive it when uvloop runs with PY37. - Former asyncio.test_utils moved as an uvloop test resource.
@@ -362,6 +363,7 @@ def connection_lost(self, exc): | |||
self.assertIn(excs[0].__class__, | |||
(BrokenPipeError, ConnectionResetError)) | |||
|
|||
@unittest.skipUnless(sys.version_info < (3, 7), 'Python version must be < 3.7') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have some light about why this testing is failing with 3.7
please tell me.
uvloop/includes/stdlib.pxi
Outdated
# so we delete refs to all modules manually (except sys) | ||
del asyncio, concurrent, collections, errno | ||
# so we delete refs to all modules manually (except sys, asyncio) | ||
del concurrent, collections, errno |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just removed the asyncio
to avoid losing the ability to call later the asyncio.coroutines.debug_wrapper
when uvloop
run on an interpreter different than 3.7.
If you believe that this is a red flag, let's find another way to make the _set_coroutine_debug
ready to be executed by different Python versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to keep del asyncio
. Otherwise uvloop would hold refs to Tasks longer than necessary (that's Cython's fault and these del
s are a workaround).
You can use getattr
:
cdef aio_debug_wrapper = getattr(asyncio.coroutines, 'debug_wrapper', None)
And just check if it's not None
before you call it.
No way, Travis still failing one test gets frozen forever. My gut feeling says that is because the older 3.7-dev CPython version pointing still to Any ideas? [1] https://s3.amazonaws.com/travis-python-archives/binaries/ubuntu/16.04/x86_64/python-3.7-dev.tar.bz2 |
@1st1 ^^ |
Yep, I saw this PR yesterday. Will take a look tomorrow. Thanks! |
.ci/travis-install.sh
Outdated
@@ -22,6 +22,7 @@ if [ "${TRAVIS_OS_NAME}" == "osx" ]; then | |||
brew outdated automake || brew upgrade automake --with-default-names | |||
fi | |||
|
|||
pip install --upgrade pip wheel | |||
#pip install --upgrade pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting this error with the Mac environment
You should consider upgrading via the 'pip install --upgrade pip' command.
+pip install --upgrade setuptools
Traceback (most recent call last):
File "/Users/travis/.pyenv/versions/3.6.3/bin/pip", line 7, in <module>
from pip import main
ImportError: cannot import name 'main'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird. Which version of pip did it upgrade to?
Finally got a green CI, not really happy with some of the patches. in any case, its something that can be used to start and obviously to get improve it. Feedback welcomed @1st1. I know that you had some plans to give support for |
.travis.yml
Outdated
sudo: required | ||
# Travis has removed the py37 image from their repos | ||
# language: python | ||
# python: "3.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They seem to have "3.7-dev". Wouldn't that be enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally I'd like to avoid using docker for running our tests, it would slow the CI down way too much.
tests/test_udp.py
Outdated
@@ -3,7 +3,7 @@ | |||
import unittest | |||
import sys | |||
|
|||
from asyncio import test_utils | |||
from tests import utils as test_utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this "tests" import. Just move/copy the necessary functions to uvloop._testbase
.
I think I'll work on it myself. My idea is to copy |
This PR needs to land before I start working on contextvars though. |
@1st1 Changes applied, about the issues with Pip and Python 3.7: Travis CI uses an older The Pip issue started with the recent 10.0.0 release and the Pyenv environments [2] [3]. Take a look to the last commit, just pins the PIP version for the Mac osx environment. I hope so again that this will be just a temporary solution. [1] travis-ci/travis-ci#9069 |
Can you try installing python 3.7 using pyenv? It worked fine for me when we tried it for https://github.com/azure/azure-functions-python-worker/ |
@1st1 I didn't manage to reproduce the same issue in local. These have been the environments that ran the tests successfully in local:
I've tried to reproduce the local environment following this guide but looks like that the Xenial is still experimental and there is no way to download the image used by Travis, or at least I wasn't able to find it. In any case, I've opened an issue to gather some feedback from Travis Also, I've tried to get some information running the Travis CI, no luck and also the same issue: stuck in the same test So, let's wait for some feedback from the Travis team. But I wouldn't put so many hopes on it, taking into account that for them the Xenial is still experimental and not officially supported by Travis. |
Definitely, something is wrong with Xenial and Travis |
I am using pyenv, python 3.7.0b4 on CentOS 7, and installed this branch -- success! It would be nice for this to get released so more people could test 3.7-dev. I personally also use Travis/Xenial for CI so the remaining bug affects me, but ... |
My proposal here is going for the Docker option that was proven as successful and TBH didn't add so much overhead in terms of time needed to run the tests. Later if the |
I think we are agreeing that uvloop should not wait for TravisCI. |
This MR aligns the uvloop code to become compatible, not production ready, with PY37 adding the following changes: * Support for the new API used behind the set_debug function. * Adds the context=None KW to those functions that will receive it when uvloop runs with PY37. * Former asyncio.test_utils moved as an uvloop test resource. -- Yury: the original PR for this change is #138. I stripped out all the CI bits and squashed all commits by hand. The CI will be addressed later.
Closing this one in favour of #149. The new PR is a version of this one with removed CI tweaks. |
This MR aligns the uvloop code to become compatible, not production ready, with PY37 adding the following changes: * Support for the new API used behind the set_debug function. * Adds the context=None KW to those functions that will receive it when uvloop runs with PY37. * Former asyncio.test_utils moved as an uvloop test resource. -- Yury: the original PR for this change is #138. I stripped out all the CI bits and squashed all commits by hand. The CI will be addressed later.
Thanks! |
This MR aligns the
uvloop
code to become compatible, not productionready, with PY37 adding the following changes:
set_debug
function.context=None
KW to those functions that will receive itwhen
uvloop
runs with PY37.uvloop
test resource.New MR on top of that to enable
contextvars
should be expected.