From c0e5e5f6cf2333eab976e066629e25209d920c85 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Mon, 10 May 2021 17:09:20 -0700 Subject: [PATCH] Add docs for configuring a virtualenv. --- Developer's-Guide.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Developer's-Guide.md b/Developer's-Guide.md index 88c45a1..7866026 100644 --- a/Developer's-Guide.md +++ b/Developer's-Guide.md @@ -18,7 +18,7 @@ The original UI was different, and the mission generation process was different * [Python 3.8.1+](https://www.python.org/downloads/) * A code Editor for Python. I recommend [PyCharm Community Edition](https://www.jetbrains.com/pycharm/download/#section=windows), you can add plugin for Lua. -When you install Python, make sure to install pip for dependencies management. +When you install Python, make sure to install pip for dependencies management. This should come preinstalled. ## Checkout the repository code with git @@ -27,16 +27,24 @@ When you install Python, make sure to install pip for dependencies management. * **master** : Should be even with current release version * **develop** : Current version being worked on, might be unstable -## Installing dependencies +## Creating a Python virtual environment -Run +A Python virtual environment (virtualenv) is a local copy of the Python distribution for a specific project. This allows you to install the project dependencies local to the environment rather than globally on your system, which makes it easier to reset your environment if something goes wrong. + +To create and use a virtualenv, run: ``` +python -m venv env +.\env\Scripts\activate pip install -r requirements.txt pre-commit install ``` -In order to install required Python dependencies. +The first line creates the virtualenv to the directory `env`. The second line replaces the `python` for the current shell with the one in the virtualenv. The third line installs the project's dependencies. The final line installs the pre-commit hooks to run the auto-formatter on commit. + +Whenever you open a new terminal, you'll need to re-run `.\env\Scripts\activate`. + +If you're using PyCharm, you can configure the project to use your virtualenv in the project settings: ![virtualenv project settings](https://user-images.githubusercontent.com/315852/117738890-e6890800-b1b1-11eb-9eec-1796af594e79.png). ## Running from sources