This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A basic implementation of Go inspired channels.

Use these channels to communicate across Python threads, processes, or hosts, independent of network location. Channels are first class objects that can be passed themselves through the channels.

The current implementation uses RabbitMQ as a broker, but it can be swapped by other queues or even a peer-to-peer transport mechanism such as ZeroMQ. See the implementation details.


Start a RabbitMQ instance by executing the following command in the root directory of this repository:

docker-compose up -d


  • Create a channel with:

    >>> from channelpy import Channel
    >>> ch = Channel()
  • Put and get objects to and from the channel:

    >>> ch.put('foo')
    >>> ch.get()
    >>> ch.get(timeout=1)
    # raises ChannelTimeoutException since channel is empty
  • Pass channels into channels:

    >>> ch1 = Channel()
    >>> ch1.put(5)
    >>> ch2 = Channel()
    >>> ch2.put(ch1)
    >>> x = ch2.get()
    >>> x.get()
  • Channels can be instantiated by name:

    >>> ch = Channel()
    >>> another = Channel(
    >>> another.put('foo')
    >>> ch.get()

    Or create them with a specific name:

    >>> ch = Channel(name='my_channel')
  • Multiple consumers and producers can be attached to a channel. Messages are delivered in round-robin fashion to consumers. However, a close_all can be delivered to all the consumers to signal a full termination of the channel.

    >>> ch = Channel()
    >>> def f(c):
    ...     while True:
    ...         print(c.get())
    >>> threading.Thread(target=f, args=(ch,)).start()
    >>> threading.Thread(target=f, args=(ch,)).start()
    >>> ch.put(4)        # one of the threads will print 4
    >>> ch.close_all()   # ChannelClosedException is raised in all threads
  • The broker to use can be configured at instantiation time or by using the config file ~/.channelpy.yml. For example:

    connection: RabbitConnection
      uri: amqp://


Run the tests with:

$ BROKER='amqp://localhost:5672' py.test -v

Implementation Details

To be written.

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
channelpy-0.2-py2.py3-none-any.whl (9.3 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jul 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting