Skip to content

1. Installation

1.1. Preface: Installing Python 3.6 (or above)

Lightbus requires Python 3.6 or newer as it relies upon Python's new asyncio and type hinting features. This is readily available for all major operating systems.

Python 3.6 on macOS

You can check your current version of Python as follows:

$ python3 --version
Python 3.6.4

You need version 3.6 or above to run Lightbus.

If you are running an older version of Python you can install a newer version via one of the following methods:

  1. Install Python 3.6 using Homebrew – This is the easiest option, you will install that latest version of Python 3.
  2. Install Python 3.6 using Homebrew + pyenv – This option has some additional steps, but you will have complete control over the Python versions available to you. If you work on multiple Python projects this may be more suitable.
  3. Install Python 3.6 manually – Not recommended

Python 3.6 on Linux

Your Linux distribution may already come with Python 3.6 installed. You can check your Python version as follows:

$ python3 --version
Python 3.6.4

You need version 3.6 or above to run Lightbus. Digital Ocean has a beginner-suitable guide on installing Python 3 which you may find useful.

If you require more granular control of your python versions you may find pyenv more suitable.

Windows

Lightbus is not currently tested for deployment on Windows, so your millage may vary. The Hitchhiker's Guide to Python covers installing Python 3 on Windows.

1.2. Installing Lightbus

At time of writing we were yet to have an official release. Please install via git in the mean-time.

$ pip3 install lightbus

Installing using git

This will clone the bleeding-edge version Lightbus and install it ready to use. This is useful if you need the latest (albeit unstable) changes, or if you wish to modify the Lightbus source.

$ pip install https://github.com/adamcharnock/lightbus.git#egg=lightbus

1.3. Installing Redis

Lightbus relies on Redis as its primary transport. Specifically, Lightbus relies on the new Redis 'streams' feature in order to provide robust message handling. This will be available in Redis 5.0, due around mid-2018. Until then you should build Redis from source as follows:

# Download
$ wget https://github.com/antirez/redis/archive/5.0-rc4.zip

# Extact
$ tar -zxf 5.0-rc4.zip

# Compile (requires xcode on mac)
$ cd redis-5.0-rc4
$ make

# Start redis server
$ ./src/redis-server

1.4. Check it works

You should now have:

  1. Python 3.6 or above installed
  2. Lightbus installed
  3. Redis installed and running

You check check everything is setup correctly by starting up lightbus:

$ lightbus run

Lightbus should start without errors and wait for messages. You can exit using Ctrl+C.