Skip to content
This repository has been archived by the owner. It is now read-only.

Merge JoinableQueue with Queue #220

Closed
GoogleCodeExporter opened this issue Apr 10, 2015 · 12 comments
Closed

Merge JoinableQueue with Queue #220

GoogleCodeExporter opened this issue Apr 10, 2015 · 12 comments

Comments

@GoogleCodeExporter
Copy link

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

When I implemented asyncio.queues, I put "join" and "task_done" methods on a 
separate JoinableQueue class, which is a subclass of asyncio.queues.Queue. I 
did this because I was originally emulating Gevent's API, not the standard 
library's "queue" module.

To more closely match the standard Queue, asyncio.queues.Queue should have 
"join" and "task_done". JoinableQueue should become an empty subclass of Queue, 
and JoinableQueue should be removed as soon as possible.

Should this go in for Python 3.5? Can JoinableQueue be removed in Python 3.5, 
or must it be deprecated, then removed in 3.6?

I'm happy to do this work if the change is approved.

Original issue reported on code.google.com by jesse@emptysquare.net on 23 Jan 2015 at 2:48

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Sounds good. asnycio is still in provisional mode so I think we can just move 
the two methods to Queue and delete JoinableQueue. No deprecation period 
necessary.

Original comment by gvanrossum@gmail.com on 23 Jan 2015 at 4:47

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

I don't expect a large number of applications or libraries written for asyncio, 
and even less which also uses synchronization primitives. So right now, it's 
fine to change the API.

"JoinableQueue should be removed as soon as possible". I propose to drop it in 
the next Tulip release and the new Python 3.4 *minor* version.

To support older Tulip/Python version, you can write something like:

try:
    from asyncio import JoinableQueue as Queue
except ImportError:
    from asyncio import Queue

Or something using hasattr().

I prefer to have an API closer to Python stdlib, and trying to provide the same 
API than Gevent.

Does it mean that PriorityQueue and LifoQueue will also be joinable?

Original comment by victor.s...@gmail.com on 23 Jan 2015 at 9:01

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Thanks. Yes, PriorityQueue and LifoQueue will also have task_done() and join(), 
as they do in the standard "queue" module.

Original comment by je...@10gen.com on 24 Jan 2015 at 3:33

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Review please: http://codereview.appspot.com/199030043

Original comment by jesse@emptysquare.net on 24 Jan 2015 at 4:45

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Objections, or shall I merge? Seems like it should go in before Python 3.5.0 
gets much closer to release. Thanks!

Original comment by je...@10gen.com on 13 Feb 2015 at 10:31

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

LGTM, but on second thought I'd like to keep JoinableQueue as an alias so we 
don't break too much code when 3.4.3 goes out.

Original comment by gvanrossum@gmail.com on 13 Feb 2015 at 10:36

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Done. I've opened http://bugs.python.org/issue23464 to remember to remove 
JoinableQueue from asyncio-sync.rst in CPython's docs for asyncio.

Original comment by je...@10gen.com on 14 Feb 2015 at 2:51

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Original comment by jesse@emptysquare.net on 14 Feb 2015 at 2:53

  • Changed state: Fixed
@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

I merged your change in Python 3.4 and 3.5. I also updated the documentation. 
The doc will be online in a few hours:
https://docs.python.org/dev/library/asyncio-sync.html#asyncio.Queue

I'm not sure that the change will be part of Python 3.4.3.

Original comment by victor.s...@gmail.com on 17 Feb 2015 at 10:16

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

Looks good, thanks.

Original comment by je...@10gen.com on 18 Feb 2015 at 2:05

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

> I'm not sure that the change will be part of Python 3.4.3.

Nope, it misssed the Python 3.4.3 release: it will in Python 3.4.4.

Original comment by victor.s...@gmail.com on 10 Mar 2015 at 3:27

@GoogleCodeExporter
Copy link
Author

@GoogleCodeExporter GoogleCodeExporter commented Apr 10, 2015

I fixed the doc:
https://hg.python.org/cpython/rev/12a857e173b7

Original comment by victor.s...@gmail.com on 10 Mar 2015 at 3:29

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.