Add docs for configuring a virtualenv.

Dan Albert 2021-05-10 17:09:20 -07:00
parent a0716c4baf
commit c0e5e5f6cf

@ -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