Package: lepus
LepusUsing RabbitMQ with Python in a simplified way.Lepus is a Python library designed to streamline integration with RabbitMQ, a robust and widely-used messaging system. The name "Lepus" pays homage to the constellation of the hare (Lepus), which is one of the many constellations that dot the night sky. Similarly, Lepus simplifies communication between your application's components, allowing them to efficiently and reliably exchange information without the complexity of managing RabbitMQ's low-level details.Why Lepus?RabbitMQ is a popular choice for implementing message systems due to its reliability, scalability, and support for various communication protocols. However, dealing directly with RabbitMQ using Pika, the official Python library for RabbitMQ interaction, can be a challenging task. Lepus was created with the aim of simplifying this process, making it more accessible for developers who want to focus on their application's business logic rather than worrying about low-level details.Getting StartedTo start using Lepus in your project, follow these simple steps:Install Lepus using pip:pip install lepusImport the library into your Python code:fromlepusimportRabbitDeclare queues and exchanges, configure message handling, and start efficiently exchanging information with RabbitMQ.rabbit=Rabbit('config.json')@rabbit.listener(queue='my-queue')defcallback(ch,method,properties,body):print(f" [x] Received{body}")rabbit.publish("Hello World!",routing_key='my-queue')Lepus provides a smooth and effective development experience for RabbitMQ integration, enabling you to make the most of the power of this powerful messaging tool.ContributionLepus is an open-source project, and we encourage contributions from the community. Feel free to open issues, submit pull requests, or help improve the documentation. Together, we can make Lepus even better.DocumentationAs mentioned above, almost all configuration must be in a JSON file. This configuration will be used when instantiating theRabbitobject in the example above (in our example,config.json). Here is the list of settings:
Certainly, here is the first table in English:Root propertiesPropertyDescriptionhostThe host address for the RabbitMQ connection.portThe RabbitMQ host port for the connection.blocked_connection_timeoutThe timeout for blocked connections.channel_maxThe maximum number of allowed communication channels.client_propertiesRabbitMQ client properties.connection_attemptsThe number of connection attempts allowed.frame_maxThe maximum frame size for communication.heartbeatThe timeout for maintaining the heartbeat connection.localeThe locale for communication with RabbitMQ.retry_delayThe delay between connection retry attempts.socket_timeoutThe timeout for socket operations.stack_timeoutThe timeout for communication stack operations.virtual_hostThe virtual host for the RabbitMQ connection.queuesList of queues (See details in the lists below)exchangesList of exchanges (See details in the lists below)Queue PropertiesPropertyDescriptionnameThe name of the queue.passiveWhether the queue is passive (default: False).durableWhether the queue is durable (default: False).exclusiveWhether the queue is exclusive (default: False).auto_deleteWhether the queue is auto-deleted (default: False).argumentsAdditional arguments for the queue (default: None).These properties define the characteristics and behavior of a RabbitMQ queue.Exchange PropertiesPropertyDescriptionnameThe name of the exchange.typeThe type of the exchange (default: 'fanout').passiveWhether the exchange is passive (default: False).durableWhether the exchange is durable (default: False).auto_deleteWhether the exchange is auto-deleted (default: False).internalWhether the exchange is internal (default: False).argumentsAdditional arguments for the exchange (default: None).Credentials VariablesWe have two crucial properties, username and password, are sourced from environment variables. These environment variables play a pivotal role in establishing secure authentication with RabbitMQ. Here is a brief explanation of each, along with a list:Environment VariableDescriptionRABBIT_USERNAMEThe user identifier for authentication with RabbitMQ.RABBIT_PASSWORDThe secret passphrase associated withusernamefor authentication.by default: guest / guestLicenseLepus is distributed under theGNU General Public Licience. Please read the LICENSE file for details on the license terms.ContactIf you have any questions, suggestions, or need assistance, don't hesitate to reach out to us atMarcos Stefani Rosaor visit ourGitHub pagefor more information.If you want to collaborate so that we can continue to have innovative ideas and more time to invest in these projects, contribute to ourPatreon.