From 7401dabe5b0bbbb730da22416c95fcfa046c0b12 Mon Sep 17 00:00:00 2001 From: Felipe Monteiro Date: Sun, 16 Sep 2018 13:44:02 -0600 Subject: [PATCH] docs: Include venv workflow guide under "Developer Workflow" This patch set includes information to the "Developer Workflow" guide in order to enable developers to more quickly test local code changes. Rather than, after each local code change, rebuilding the Pegleg image and overriding the ``IMAGE`` environment variable so ``tools/pegleg.sh`` uses the latest code changes, it is possible to use a virtual environment for much faster development. Change-Id: Ie115744c5b473fcebc8d98f7c850e0c835c49afa --- doc/source/developer-overview.rst | 32 +++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/doc/source/developer-overview.rst b/doc/source/developer-overview.rst index 7db0eed6..d75d3689 100644 --- a/doc/source/developer-overview.rst +++ b/doc/source/developer-overview.rst @@ -72,7 +72,7 @@ Pegleg strives to conform to the `Airship coding conventions`_. Python ------ -The Pegleg code base lives under ``/src/bin/pegleg``. Pegleg supports py35 +The Pegleg code base lives under ``pegleg``. Pegleg supports py35 and py36 interpreters. Docker @@ -88,10 +88,38 @@ Pegleg, as a containerized CLI, uses Docker via ``tools/pegleg.sh`` to execute CLI commands. Commands can also be executed using the ``Makefile`` target: ``run_pegleg``. +Virtual Environment +------------------- + +Rather than, after each local code change, rebuilding the Pegleg image and +overriding the ``IMAGE`` environment variable so ``tools/pegleg.sh`` uses +the latest code changes, it is possible to use a virtual environment for +much faster development. + +This can achieved by issuing the following commands (from the root Pegleg +directory): + +.. code-block:: console + + # Quick way of building a venv and installing all required dependencies into + # it. + tox -e py35 --notest + source .tox/py35/bin/activate + pip install -e . + + # Now is it possible to run the Pegleg CLI to test local changes: + pegleg + + # Or run unit tests: + pytest -k + +Note that after setting up the virtual environment, one only needs to source it +in order to re-run unit tests or Pegleg CLI commands, to test local changes. + Testing ======= -All Pegleg tests are nested under ``/src/bin/pegleg/tests``. +All Pegleg tests are nested under ``tests``. Pegleg comes equipped with a number of `tox`_ targets for running unit tests, as well as `pep8`_ and `Bandit`_ checks.