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

Fix #88: conform to 'new' pyuv API #240

Merged
merged 3 commits into from
Jan 8, 2017
Merged

Conversation

heliomeiralins
Copy link
Contributor

This solves issue #88.
According to the pyuv releases the API changed in version 1.0.0 in Dec 2, 2014.

@heliomeiralins heliomeiralins changed the title Fix #88: conform to new pyuv API Fix #88: conform to 'new' pyuv API Jan 6, 2017
@justinmk
Copy link
Member

justinmk commented Jan 7, 2017

Thanks. Just to be clear, are you on windows? If I'm reading things correctly, pyuv is only required there. Else python-client uses asyncio (or trollius for python 2.6).

If all that's correct, perhaps we should also specify a minimum pyuv version in setup.py

@heliomeiralins
Copy link
Contributor Author

heliomeiralins commented Jan 7, 2017

No, I'm on linux.
I was looking into #238 because my tests on 3.6 are failling and I found this issue in the process.
This PR fixes tests for me ( if i install a recent pyuv), but I still haven't found the problem with the asyncio tests.

args=argv,
exit_callback=self._on_exit,
flags=pyuv.UV_PROCESS_WINDOWS_HIDE,
stdio=(stdin, stdout, stderr,))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since pyuv isn't a required dependency we can't really specify the version (except for Windows).

We could check if spawn() is a class method:

inspect.ismethod(pyuv.Process.spawn) and pyuv.Process.spawn.__self__ is pyuv.Process

and use that as part of the decision here.

Copy link
Contributor Author

@heliomeiralins heliomeiralins Jan 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so we should require versions newer than 1.0 on Windows.

About Linux, what is your idea? Support both API versions?
I think we should just raise an exception or, ignore pyuv and use asyncio, if pyuv is < 1.0.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we don't need to do it in this PR, but I noticed that here we choose asyncio or pyuv. So as part of that choice, check the API as described in my above comment: if pyuv.Process.spawn is not an instance method, then we known we have pyuv >= 1.x, and we choose EventLoop = UvEventLoop. Else, choose EventLoop = AsyncioEventLoop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I can get back at it monday.

@justinmk
Copy link
Member

justinmk commented Jan 7, 2017

It couldn't hurt to specify a minimum pyuv version in setup.py, and also add extras_require to setup.py.

diff --git a/setup.py b/setup.py
index f3837036f269..e89bcbea8b6b 100644
--- a/setup.py
+++ b/setup.py
@@ -8,8 +8,12 @@ install_requires = [
     'msgpack-python>=0.4.0',
 ]
-
+extras_require = {
+    'pyuv': ['pyuv>=1.0.0'],
+}
+
 if os.name == 'nt':
-    install_requires.append('pyuv')
+    install_requires.append('pyuv>=1.0.0')
 elif sys.version_info < (3, 4):
     # trollius is just a backport of 3.4 asyncio module
     install_requires.append('trollius')
@@ -29,4 +33,5 @@ setup(name='neovim',
       packages=['neovim', 'neovim.api', 'neovim.msgpack_rpc',
                 'neovim.msgpack_rpc.event_loop', 'neovim.plugin'],
       install_requires=install_requires,
+      extras_require=extras_require,
       zip_safe=False)

cc @jamessan @viccuad

@heliomeiralins
Copy link
Contributor Author

Nice, will update the PR.

Now it's possible to: `pip install neovim[pyuv]`
@justinmk justinmk merged commit 171d137 into neovim:master Jan 8, 2017
@heliomeiralins heliomeiralins deleted the pyuv-api branch October 11, 2017 18:23
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

Successfully merging this pull request may close these issues.

3 participants