Installation of the Development Environment
It is highly recommended to set up a virtual environment for the backend development. The following procedure uses the venv module for this purpose (it is included in the standard Python library since version 3.3).
- Install the latest stable Python 3 version, if it is not already on your system.
$ sudo apt-get install python3 $ sudo apt-get install python3-pip
Clone the project in a directory of your choice:
$ git clone email@example.com:labs/resolvers-yang.git
Create the virtual environment:
$ python3 -m venv resolvers-yang
Activate the virtual environment:
$ cd resolvers-yang $ source bin/activate
Install required standard packages inside the virtual environment:
$ pip install -r requirements.txt
If you are prompted to upgrade pip, you can do that, too.
When inside the virtual environment, the shell prompt should change to something like
To leave the virtual environment, just do
The virtual environment can be entered anytime later by executing step 4. The steps preceding it need to be performed just once.
The setup described above has a few consequences that have to be kept in mind:
- Any project files that need to go to
bin(executable Python scripts),
libhave to be added as exceptions to
.gitignore, for example
- After adding a new Python module dependency, it is necessary to run
and commit the new content of
$ make deps
As an additional test suite, all doctest snippets that are embedded in documentation can be executed:
$ cd docs $ make doctest
Documentation can be built locally by running
$ make html