Skip to content

Conversation

@kosciej
Copy link
Contributor

@kosciej kosciej commented Mar 3, 2018

PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call
with advice to use asyncio native run-loop instead of zmq specific.

This caused exception when running the contrib/zmq/zmq_sub*.py examples.

This commit simply follows the advice and fixes mentioned examples.

PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call
with advice to use asyncio native run-loop instead of zmq specific.

This caused exception when running the contrib/zmq/zmq_sub*.py examples.

This commit simply follows the advice.
@kosciej kosciej changed the title Remove deprecated PyZMQ call from Python ZMQ example [Utils] Remove deprecated PyZMQ call from Python ZMQ example Mar 3, 2018
@randolf
Copy link
Contributor

randolf commented Mar 4, 2018

@kosciej I tried to find documentation describing this change, but Google didn't quite get me there. Do you happen to have a link to the documentation that describes this change? Thanks.

@kosciej
Copy link
Contributor Author

kosciej commented Mar 4, 2018

@randolf Changelog for PyZMQ 17.0.0 describes this change in poor wording:

Allow pyzmq asyncio/tornado integration to run without installing zmq_poll() implementation. The following methods and classes are deprecated and no longer required:

zmq.eventloop.ioloop.install()
zmq.eventloop.ioloop.IOLoop
zmq.asyncio.install()
zmq.asyncio.ZMQEventLoop

However, in the code of PyZMQ 17 the call to zmq.asyncio.install() is not only deprecated but also returns None:

def _deprecated():
    if _deprecated.called:
        return
    _deprecated.called = True
    import warnings
    warnings.warn("ZMQEventLoop and zmq.asyncio.install are deprecated in pyzmq 17. Special eventloop integration is no longer needed.", DeprecationWarning, stacklevel=3)
_deprecated.called = False


def install():
    """DEPRECATED: No longer needed in pyzmq 17"""
    _deprecated()

Even the documentation of PyZMQ no longer mentions zmq.asyncio.install() method.

This makes the example unusable in most recent version of PyZMQ.

I can add the condition for newest PyZMQ (and later) to choose right implementation of run-loop, but for the sake of brevity of example I think it's not necessary.

@laanwj
Copy link
Member

laanwj commented Mar 5, 2018

I think this is fine, the example doesn't have to accommodate for every single version. utACK.

@fanquake
Copy link
Member

fanquake commented Mar 6, 2018

utACK 6058766

@laanwj laanwj merged commit 6058766 into bitcoin:master Mar 6, 2018
laanwj added a commit that referenced this pull request Mar 6, 2018
…ample

6058766 Remove deprecated PyZMQ call from Python ZMQ example (Michał Zabielski)

Pull request description:

  PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call
  with advice to use asyncio native run-loop instead of zmq specific.

  This caused exception when running the contrib/zmq/zmq_sub*.py examples.

  This commit simply follows the advice and fixes mentioned examples.

Tree-SHA512: af357aafa5eb9506cfa3f513f06979bbc49f6132fddc1e96fbcea175da4f8e2ea298be7c7055e7d3377f0814364e13bb88b5c195f6a07898cd28c341d23a93c5
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 13, 2019
… ZMQ example

6058766 Remove deprecated PyZMQ call from Python ZMQ example (Michał Zabielski)

Pull request description:

  PyZMQ 17.0.0 has deprecated and removed zmq.asyncio.install() call
  with advice to use asyncio native run-loop instead of zmq specific.

  This caused exception when running the contrib/zmq/zmq_sub*.py examples.

  This commit simply follows the advice and fixes mentioned examples.

Tree-SHA512: af357aafa5eb9506cfa3f513f06979bbc49f6132fddc1e96fbcea175da4f8e2ea298be7c7055e7d3377f0814364e13bb88b5c195f6a07898cd28c341d23a93c5
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants