Skip to content

Getting Started

  Welcome to the Getting Started section! In this guide, you will learn how to install Pyventus, as well as enable any of its optional dependencies. For more detailed information on how to use this library, you can refer to the API and Learn sections.

Installation

  Pyventus is published as a Python package and can be installed using pip, ideally in a virtual environment for proper dependency isolation. To get started, open up a terminal and install Pyventus with the following command:

pip install pyventus

  By default, Pyventus relies on the Python standard library and requires Python 3.10 or higher with no additional dependencies aside from typing-extensions, which is primarily used to support advanced typing features in older versions of Python.

Optional Dependencies

  While Pyventus primarily relies on the Python standard library, it also supports optional dependencies to access additional features, such as different processing services1. Below is a list of supported integrations:

Supported Library Integrations

  • Celery ─ Pyventus integrates with Celery through the CeleryProcessingService, which is a concrete implementation of the ProcessingService interface that leverages the Celery framework to handle the execution of calls. To install Pyventus with Celery support, use the following command:

    pip install pyventus[celery] (1)
    

    1. Optional Package Dependencies

        This package also includes optional dependencies. For more information, please visit the Celery documentation.


  • Redis Queue (RQ) ─ Pyventus integrates with Redis Queue through the RedisProcessingService, which is a concrete implementation of the ProcessingService interface that leverages the Redis Queue framework to handle the execution of calls. To install Pyventus with Redis Queue support, use the following command:

    pip install pyventus[rq]
    

Supported Framework Integrations

  • FastAPI ─ Pyventus integrates with FastAPI through the FastAPIProcessingService, which is a concrete implementation of the ProcessingService interface that utilizes the FastAPI's BackgroundTasks to handle the execution of calls. To install Pyventus with FastAPI integration, use the following command:

    pip install pyventus[fastapi] (1)
    

    1. Optional Package Dependencies

        This package also includes optional dependencies. For more information, please visit the FastAPI documentation.


You can install all of these integrations simultaneously using:

pip install pyventus[all]

  1. These processing services expand the capabilities of Pyventus by providing different strategies for processing calls. For instance, the EventEmitter class leverages these services to decouple the processing of each event emission from the underlying implementation, resulting in a more flexible and efficient execution mechanism that enhances the responsiveness and scalability of event handling.