Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: use virtual env for installation #167

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is the companion repo for running examples against the `luma.emulator <http

Installation instructions
-------------------------
Assuming you are using a Raspberry Pi (running Debian Jessie or newer), follow the pre-requisites &
Assuming you are using a Raspberry Pi (running Raspberry Pi OS), follow the pre-requisites &
instructions in the above repositories to wire up your display, then from a command-line::

$ sudo usermod -a -G i2c,spi,gpio pi
Expand All @@ -30,18 +30,24 @@ Log out and in again and clone this repository::
$ git clone https://github.com/rm-hull/luma.examples.git
$ cd luma.examples

Finally, install the luma libraries using::
Next, create a `virtual environment <https://docs.python.org/3/library/venv.html>`__::

$ sudo -H pip install -e .
$ python3 -m venv ~/luma-env
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to use:

python3 -m venv .venv
.venv/bin/activate

I think IDEs like vscode and tools like pyenv will sniff out a .venv directory and will auto-activate it.

Is there any reason not to stick to that convention?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or are you aiming to pull all the dependencies for all sub-projects into one place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to stick to that convention?

I didn't know that IDEs like vscode and tools like pyenv will sniff out a .venv directory and will auto-activate it, but maybe I'm just old-skool :-/

Copy link
Collaborator Author

@thijstriemstra thijstriemstra Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to stick to that convention?

I like to know where my virtual envs live, explicitly, in this case ~/luma-env, and since I didn't know about that convention (and new users wont either i'd guess) I chose this.


This creates a virtual environment in the home directory called ``luma-env``
and a Python executable at ``~/luma-env/bin/python``.

Finally, install the luma libraries using in the virtual environment with::

$ ~/luma-env/bin/python -m pip install -e .

Running the examples
--------------------
After cloning the repository, enter the ``examples`` directory and try running
one of the following examples listed below. For example::

cd examples
python3 3d_box.py
~/luma-env/bin/python 3d_box.py

========================= ================================================================
Example Description
Expand Down Expand Up @@ -92,7 +98,7 @@ By default, all the examples will asume I2C port 1, address ``0x3C`` and the
specified on the command line – each program can be invoked with a ``--help``
flag to show the options::

$ python3 examples/demo.py --help
$ ~/luma-env/bin/python examples/demo.py --help
usage: demo.py [-h] [--config CONFIG] [--display DISPLAY] [--width WIDTH]
[--height HEIGHT] [--rotate ROTATION] [--interface INTERFACE]
[--i2c-port I2C_PORT] [--i2c-address I2C_ADDRESS]
Expand Down Expand Up @@ -257,13 +263,13 @@ and screen capture functionality:
After `installing luma.emulator <https://luma-emulator.readthedocs.io/en/latest/install.html>`_
you can invoke the demos with::

$ python3 examples/clock.py --display pygame
$ ~/luma-env/bin/python examples/clock.py --display pygame

or::

$ python3 examples/clock.py --display gifanim
$ ~/luma-env/bin/python examples/clock.py --display gifanim

$ python3 examples/starfield.py --display capture
$ ~/luma-env/bin/python examples/starfield.py --display capture

Documentation
-------------
Expand Down