Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

The great renaming

  • Loading branch information...
commit 9f79520dea23ea42d37fad221284f1a4682fef08 1 parent 8064f08
@tonyg tonyg authored
View
2  .gitignore
@@ -1,2 +1,2 @@
*.pyc
-rabbitmq/spec.py
+pika/spec.py
View
5 COPYING
@@ -1,5 +1,6 @@
-This package, the RabbitMQ C client, is licensed under the MPL. For
-the MPL, please see LICENSE-MPL-RabbitMQ.
+This package, Pika, an AMQP client library for use with RabbitMQ and
+other AMQP servers, is licensed under the MPL. For the MPL, please see
+LICENSE-MPL-Pika.
If you have any questions regarding licensing, please contact us at
info@rabbitmq.com.
View
19 LICENSE-MPL-RabbitMQ → LICENSE-MPL-Pika
@@ -444,21 +444,14 @@ EXHIBIT A -Mozilla Public License.
License for the specific language governing rights and limitations
under the License.
- The Original Code is RabbitMQ.
+ The Original Code is Pika.
- The Initial Developers of the Original Code are LShift Ltd,
- Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
+ The Initial Developers of the Original Code are LShift Ltd and
+ Tony Garnock-Jones.
- Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
- Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
- are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
- Technologies LLC, and Rabbit Technologies Ltd.
-
- Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
- Ltd. Portions created by Cohesive Financial Technologies LLC are
- Copyright (C) 2007-2009 Cohesive Financial Technologies
- LLC. Portions created by Rabbit Technologies Ltd are Copyright
- (C) 2007-2009 Rabbit Technologies Ltd.
+ Portions created by LShift Ltd are Copyright (C) 2009 LShift
+ Ltd. Portions created by Tony Garnock-Jones are Copyright (C)
+ 2009 Tony Garnock-Jones.
All Rights Reserved.
View
11 Makefile
@@ -4,14 +4,14 @@ AMQP_SPEC_JSON_PATH=$(AMQP_CODEGEN_DIR)/amqp-0.8.json
PYTHON=python
-all: rabbitmq/spec.py
+all: pika/spec.py
-rabbitmq/spec.py: codegen.py $(AMQP_CODEGEN_DIR)/amqp_codegen.py $(AMQP_SPEC_JSON_PATH)
+pika/spec.py: codegen.py $(AMQP_CODEGEN_DIR)/amqp_codegen.py $(AMQP_SPEC_JSON_PATH)
$(PYTHON) codegen.py body $(AMQP_SPEC_JSON_PATH) $@
clean:
- rm -f rabbitmq/spec.py
- rm -f rabbitmq/*.pyc
+ rm -f pika/spec.py
+ rm -f pika/*.pyc
rm -f tests/*.pyc tests/.coverage
codegen:
@@ -22,5 +22,4 @@ codegen:
tests: test
test: all
- cd tests && PYTHONPATH=.. $(PYTHON) run.py ../rabbitmq rabbitmq
-
+ cd tests && PYTHONPATH=.. $(PYTHON) run.py ../pika pika
View
16 codegen.py
@@ -8,7 +8,7 @@
## License for the specific language governing rights and limitations
## under the License.
##
-## The Original Code is RabbitMQ.
+## The Original Code is Pika.
##
## The Initial Developers of the Original Code are LShift Ltd,
## Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
@@ -119,7 +119,7 @@ def genSingleDecode(prefix, cLvalue, unresolved_domain):
elif type == 'bit':
raise "Can't decode bit in genSingleDecode"
elif type == 'table':
- print prefix + "(%s, offset) = rabbitmq.table.decode_table(encoded, offset)" % \
+ print prefix + "(%s, offset) = pika.table.decode_table(encoded, offset)" % \
(cLvalue,)
else:
raise "Illegal domain in genSingleDecode", type
@@ -145,7 +145,7 @@ def genSingleEncode(prefix, cValue, unresolved_domain):
elif type == 'bit':
raise "Can't encode bit in genSingleEncode"
elif type == 'table':
- print prefix + "rabbitmq.table.encode_table(pieces, %s)" % (cValue,)
+ print prefix + "pika.table.encode_table(pieces, %s)" % (cValue,)
else:
raise "Illegal domain in genSingleEncode", type
@@ -253,8 +253,8 @@ def fieldInitList(prefix, fields):
print '# Autogenerated code, do not edit'
print
print 'import struct'
- print 'import rabbitmq.specbase'
- print 'import rabbitmq.table'
+ print 'import pika.specbase'
+ print 'import pika.table'
print
print "PROTOCOL_VERSION = (%d, %d)" % (spec.major, spec.minor)
print "PORT = %d" % (spec.port)
@@ -265,13 +265,13 @@ def fieldInitList(prefix, fields):
print
for c in spec.allClasses():
- print 'class %s(rabbitmq.specbase.Class):' % (camel(c.name),)
+ print 'class %s(pika.specbase.Class):' % (camel(c.name),)
print " INDEX = 0x%.04X ## %d" % (c.index, c.index)
print " NAME = %s" % (fieldvalue(camel(c.name)),)
print
for m in c.allMethods():
- print ' class %s(rabbitmq.specbase.Method):' % (camel(m.name),)
+ print ' class %s(pika.specbase.Method):' % (camel(m.name),)
methodid = m.klass.index << 16 | m.index
print " INDEX = 0x%.08X ## %d, %d; %d" % \
(methodid,
@@ -286,7 +286,7 @@ def fieldInitList(prefix, fields):
for c in spec.allClasses():
if c.fields:
- print 'class %s(rabbitmq.specbase.Properties):' % (c.structName(),)
+ print 'class %s(pika.specbase.Properties):' % (c.structName(),)
print " CLASS = %s" % (camel(c.name),)
print " INDEX = 0x%.04X ## %d" % (c.index, c.index)
print " NAME = %s" % (fieldvalue(c.structName(),))
View
6 examples/demo_receive.py
@@ -3,12 +3,12 @@
Example of simple consumer, waits one message, replies an ack and exits.
'''
-import rabbitmq
+import pika
import asyncore
-conn = rabbitmq.AsyncoreConnection(rabbitmq.ConnectionParameters(
+conn = pika.AsyncoreConnection(pika.ConnectionParameters(
'127.0.0.1',
- credentials = rabbitmq.PlainCredentials('guest', 'guest')))
+ credentials = pika.PlainCredentials('guest', 'guest')))
ch = conn.channel()
ch.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False)
View
22 examples/demo_relay.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import rabbitmq
+import pika
import asyncore
class Relay:
@@ -32,10 +32,10 @@ def __init__(self,
c.addStateChangeHandler(self.handle_target_connection_state_change)
def fresh_connection(self, parameters):
- strategy = rabbitmq.SimpleReconnectionStrategy()
- return rabbitmq.AsyncoreConnection(parameters,
- wait_for_open = False,
- reconnection_strategy = strategy)
+ strategy = pika.SimpleReconnectionStrategy()
+ return pika.AsyncoreConnection(parameters,
+ wait_for_open = False,
+ reconnection_strategy = strategy)
def reset_pending_lists(self):
self.pending_deliveries = dict((c, []) for c in self.target_conns.itervalues())
@@ -183,13 +183,13 @@ def spec_for(id_and_host, parser):
parser.exit()
if parser.values.user:
- creds = rabbitmq.PlainCredentials(parser.values.user, parser.values.password)
+ creds = pika.PlainCredentials(parser.values.user, parser.values.password)
else:
creds = None
- return (id, rabbitmq.ConnectionParameters(hostname,
- parser.values.port or None,
- parser.values.virtual_host or "/",
- creds))
+ return (id, pika.ConnectionParameters(hostname,
+ parser.values.port or None,
+ parser.values.virtual_host or "/",
+ creds))
def set_source(option, opt_str, value, parser):
setattr(parser.values, "source", spec_for(value, parser))
@@ -228,4 +228,4 @@ def add_target(option, opt_str, value, parser):
options.binding_key,
options.durable_relay)
- rabbitmq.asyncore_loop()
+ pika.asyncore_loop()
View
8 examples/demo_send.py
@@ -3,12 +3,12 @@
Example of simple producer, creates one message and exits.
'''
-import rabbitmq
+import pika
import asyncore
-conn = rabbitmq.AsyncoreConnection(rabbitmq.ConnectionParameters(
+conn = pika.AsyncoreConnection(pika.ConnectionParameters(
'127.0.0.1',
- credentials=rabbitmq.PlainCredentials('guest', 'guest')))
+ credentials=pika.PlainCredentials('guest', 'guest')))
ch = conn.channel()
ch.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False)
@@ -16,7 +16,7 @@
ch.basic_publish(exchange='',
routing_key="test",
body="Hello World!",
- properties=rabbitmq.BasicProperties(
+ properties=pika.BasicProperties(
content_type = "text/plain",
delivery_mode = 2, # persistent
))
View
24 examples/t.py
@@ -1,25 +1,25 @@
-import rabbitmq
+import pika
import asyncore
def t_codec():
- import rabbitmq.spec
+ import pika.spec
import datetime
- p = rabbitmq.BasicProperties(content_type = 'text/plain',
- delivery_mode = 2,
- headers = {'hello': 'world',
- 'time': datetime.datetime.utcnow()})
- print rabbitmq.BasicProperties()
+ p = pika.BasicProperties(content_type = 'text/plain',
+ delivery_mode = 2,
+ headers = {'hello': 'world',
+ 'time': datetime.datetime.utcnow()})
+ print pika.BasicProperties()
pe = ''.join(p.encode())
print pe.encode('hex')
- print rabbitmq.BasicProperties().decode(pe)
+ print pika.BasicProperties().decode(pe)
- m = rabbitmq.spec.Connection.Start(server_properties = {"prop1": "hello",
+ m = pika.spec.Connection.Start(server_properties = {"prop1": "hello",
"prop2": 123})
print m
me = ''.join(m.encode())
print me.encode('hex')
- print rabbitmq.spec.Connection.Start().decode(me)
+ print pika.spec.Connection.Start().decode(me)
# t_codec()
@@ -31,9 +31,9 @@ def handle_delivery(method, header, body):
ch.close()
c.close()
-c = rabbitmq.AsyncoreConnection('127.0.0.1')
+c = pika.AsyncoreConnection('127.0.0.1')
ch = c.channel()
ch.queue_declare(queue = "test")
tag = ch.basic_consume(handle_delivery, queue = 'test')
-ch.basic_publish('', "test", "hello!", rabbitmq.BasicProperties(content_type = "text/plain"))
+ch.basic_publish('', "test", "hello!", pika.BasicProperties(content_type = "text/plain"))
asyncore.loop()
View
14 pika/__init__.py
@@ -0,0 +1,14 @@
+from pika.spec import \
+ BasicProperties
+from pika.connection import \
+ PlainCredentials, \
+ ConnectionParameters, \
+ SimpleReconnectionStrategy
+
+import pika.asyncore_adapter
+from pika.asyncore_adapter import \
+ AsyncoreConnection
+asyncore_loop = pika.asyncore_adapter.loop
+
+from pika.blocking_adapter import \
+ BlockingConnection
View
4 rabbitmq/asyncore_adapter.py → pika/asyncore_adapter.py
@@ -5,7 +5,7 @@
import time
from heapq import heappush, heappop
from errno import EAGAIN
-import rabbitmq.connection
+import pika.connection
class RabbitDispatcher(asyncore.dispatcher):
def __init__(self, connection):
@@ -45,7 +45,7 @@ def handle_write(self):
r = self.send(fragment)
self.connection.outbound_buffer.consume(r)
-class AsyncoreConnection(rabbitmq.connection.Connection):
+class AsyncoreConnection(pika.connection.Connection):
def reconnect_after(self, delay_sec):
add_oneshot_timer_rel(delay_sec, self.reconnect)
View
4 rabbitmq/blocking_adapter.py → pika/blocking_adapter.py
@@ -1,7 +1,7 @@
import socket
-import rabbitmq.connection
+import pika.connection
-class BlockingConnection(rabbitmq.connection.Connection):
+class BlockingConnection(pika.connection.Connection):
def connect(self, host, port):
self.socket = socket.socket()
self.socket.connect((host, port))
View
8 rabbitmq/channel.py → pika/channel.py
@@ -1,7 +1,7 @@
-import rabbitmq.spec as spec
-import rabbitmq.codec as codec
-import rabbitmq.event as event
-from rabbitmq.exceptions import *
+import pika.spec as spec
+import pika.codec as codec
+import pika.event as event
+from pika.exceptions import *
class ChannelHandler:
def __init__(self, connection, channel_number = None):
View
8 rabbitmq/codec.py → pika/codec.py
@@ -1,7 +1,7 @@
import struct
-import rabbitmq.spec as spec
+import pika.spec as spec
-from rabbitmq.exceptions import *
+from pika.exceptions import *
class Frame:
def __init__(self, frame_type, channel_number):
@@ -14,8 +14,8 @@ def _marshal(self, pieces):
payload + chr(spec.FRAME_END)
def __repr__(self):
- import rabbitmq.specbase
- return rabbitmq.specbase._codec_repr(self, lambda: Frame(-1, -1))
+ import pika.specbase
+ return pika.specbase._codec_repr(self, lambda: Frame(-1, -1))
class FrameMethod(Frame):
def __init__(self, channel_number, method):
View
18 rabbitmq/connection.py → pika/connection.py
@@ -1,11 +1,11 @@
import random
-import rabbitmq.spec as spec
-import rabbitmq.codec as codec
-import rabbitmq.channel as channel
-import rabbitmq.simplebuffer as simplebuffer
-import rabbitmq.event as event
-from rabbitmq.exceptions import *
+import pika.spec as spec
+import pika.codec as codec
+import pika.channel as channel
+import pika.simplebuffer as simplebuffer
+import pika.event as event
+from pika.exceptions import *
class PlainCredentials:
def __init__(self, username, password):
@@ -37,8 +37,8 @@ def __init__(self,
self.heartbeat = heartbeat
def __repr__(self):
- import rabbitmq.specbase
- return rabbitmq.specbase._codec_repr(self, lambda: ConnectionParameters(None))
+ import pika.specbase
+ return pika.specbase._codec_repr(self, lambda: ConnectionParameters(None))
class SimpleReconnectionStrategy:
def __init__(self, initial_retry_delay = 1.0, multiplier = 2.0, max_delay = 30.0, jitter = 0.5):
@@ -272,7 +272,7 @@ def _login1(self, frame):
raise LoginError("No acceptable SASL mechanism for the given credentials",
credentials)
self.send_method(0, spec.Connection.StartOk(client_properties = \
- {"product": "RabbitMQ Python"},
+ {"product": "Pika Python AMQP Client Library"},
mechanism = response[0],
response = response[1]))
self.erase_credentials()
View
0  rabbitmq/event.py → pika/event.py
File renamed without changes
View
0  rabbitmq/exceptions.py → pika/exceptions.py
File renamed without changes
View
0  rabbitmq/simplebuffer.py → pika/simplebuffer.py
File renamed without changes
View
0  rabbitmq/specbase.py → pika/specbase.py
File renamed without changes
View
2  rabbitmq/table.py → pika/table.py
@@ -3,7 +3,7 @@
import datetime
import calendar
-from rabbitmq.exceptions import *
+from pika.exceptions import *
def encode_table(pieces, table):
length_index = len(pieces)
View
14 rabbitmq/__init__.py
@@ -1,14 +0,0 @@
-from rabbitmq.spec import \
- BasicProperties
-from rabbitmq.connection import \
- PlainCredentials, \
- ConnectionParameters, \
- SimpleReconnectionStrategy
-
-import rabbitmq.asyncore_adapter
-from rabbitmq.asyncore_adapter import \
- AsyncoreConnection
-asyncore_loop = rabbitmq.asyncore_adapter.loop
-
-from rabbitmq.blocking_adapter import \
- BlockingConnection
View
8 setup.py
@@ -2,17 +2,17 @@
import os
try:
- os.stat("rabbitmq/spec.py")
+ os.stat("pika/spec.py")
except:
import sys
print >> sys.stderr, 'Autogenerated spec.py not found -- run make first!'
sys.exit(1)
-setup(name='rabbitmq',
+setup(name='pika',
version='0.1',
- description='RabbitMQ Python AMQP Client Library',
+ description='Pika Python AMQP Client Library',
author='Tony Garnock-Jones',
author_email='tonyg@rabbitmq.com',
url='http://www.rabbitmq.com/',
- packages=['rabbitmq'],
+ packages=['pika'],
)
View
6 tests/test_basic.py
@@ -1,10 +1,10 @@
import unittest
-import rabbitmq
+import pika
class TestConcurrency(unittest.TestCase):
def test_publish_after_consume(self):
- conn_a = rabbitmq.AsyncoreConnection(rabbitmq.ConnectionParameters('127.0.0.1'))
+ conn_a = pika.AsyncoreConnection(pika.ConnectionParameters('127.0.0.1'))
ch_a = conn_a.channel()
ch_a.queue_declare(queue="test", durable=True, \
exclusive=False, auto_delete=False)
@@ -16,7 +16,7 @@ def handle_delivery(method, header, body):
tag = ch_a.basic_consume(handle_delivery, queue='test')
ch_a.basic_publish(exchange='', routing_key="test", body="Hello World!",)
- rabbitmq.asyncore_loop()
+ pika.asyncore_loop()
if __name__ == '__main__':
import run
View
4 tests/test_threads.py
@@ -1,12 +1,12 @@
import unittest
-import rabbitmq
+import pika
import thread
class TestThreads(unittest.TestCase):
def test_threads(self):
def fun():
- conn_a = rabbitmq.BlockingConnection(rabbitmq.ConnectionParameters('127.0.0.1'))
+ conn_a = pika.BlockingConnection(pika.ConnectionParameters('127.0.0.1'))
ch_a = conn_a.channel()
ch_a.queue_declare(queue="test", durable=True, \
exclusive=False, auto_delete=False)
Please sign in to comment.
Something went wrong with that request. Please try again.