1. Installation

If you get stuck...

It is really useful to hear from people who have encountered a problem or got stuck. Hearing from you means we can improve our documentation and error messages.

If you get stuck drop then please drop an email to adam@adamcharnock.com, visit the Lightbus discord server, or call me (Adam) on +442032896620.

The more information you can include the better (problem description, screenshots, and code are all useful)

1.1. Preface: Installing Python 3.7 (or above)

Lightbus requires Python 3.7 or newer. This is available for all major operating systems.

Python 3.7 on macOS

You can check your current version of Python as follows:

$ python3 --version
Python 3.7.2

You need version 3.7 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.7 using Homebrew – This is the easiest option, you will install that latest version of Python 3.
  2. Install Python 3.7 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.7 manually – Not recommended

Python 3.7 on Linux

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

$ python3 --version
Python 3.7.2

You need version 3.7 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

$ 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

You will need Redis (version 5 or above) in order to use Lightbus.

You can install Redis on macOS by either:

  1. Using Homebrew (brew install redis), or
  2. Using docker (docker run --rm -p 6379:6379 -d redis)

1.4. Check it works

You should now have:

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

You can check everything is setup correctly by starting up lightbus. First create a file name bus.py which contains:

# Create a bus.py file with the following contents
import lightbus

bus = lightbus.create()

Now run the command:

$ lightbus run

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

This Lightbus process isn't setup to do anything yet, but its a start!

1.5 Next

Now you are up and running, take a look at the quick start tutorial.