The goal of this document is to describe how to setup your development environment.
-
Windows: https://www.python.org/downloads/windows/
-
For x64 machines, install
x86-64
version of Python. -
Once Python is installed, add the following to your environment variables:
Variable Value %PYTHON_HOME% {Folder path of your installed Python directory} Path %PYTHON_HOME% Path %PYTHON_HOME%\Scripts -
Verify Python is properly installed with the following:
$ python -V Python {version}
-
-
Mac: it is recommend to use
pyenv
to setup and manage python:brew install pyenv
pyenv install {version}
pyenv global {version}
- Running
which python
should point to the .pyenv path e.g.Users/USERNAME/.pyenv/shims/python
Read more about PyEnv.
Do not run python commands without activating the Python virtual environment. You can use either method to setup a virtual environment, pick the approach you prefer.
You do not need both VirtualEnv and PyEnv.
Read more about virtual environments.
This approach works on both Windows and Mac:
- Windows
- Navigate inside your Python project directory.
pip install virtualenv
python -m virtualenv venv
- To activate:
source venv/Scripts/activate
- To deactivate:
deactivate
- Mac
- Navigate inside your Python project directory.
pip install virtualenv
virtualenv venv
source venv/bin/activate
Read more about VirtualEnv.
This approach is for Mac users:
- Install pyenv virtualenv with
brew install pyenv-virtualenv
- You need to have
pyenv
installed first
- You need to have
- Run
pyenv virtualenv
, specifying the Python version you want and the name of the virtualenv directory- E.g.
pyenv virtualenv 3.7.0 my-virtual-env-3.7.0
- E.g.
- To activate the environment you can run
pyenv activate <name_of_virtualenv>
- To deactivate
pyenv deactivate
Read more about PyEnv VirtualEnv Usage.
Once you have your python environment setup, make sure to install any dependencies your project requires.
- Navigate to your projects folder
- Run
pip install -r requirements.txt
Flake8 is the linter this project uses. To run the linter enter this command in your CLI:
flake8 .