Skip to content

Latest commit

 

History

History
95 lines (66 loc) · 3.12 KB

dev-environment-setup.md

File metadata and controls

95 lines (66 loc) · 3.12 KB

Environment Setup

The goal of this document is to describe how to setup your development environment.

Sections

Python Setup

Install Python (v3.7)

  • 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.

Virtual Environment

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.

Setup Python virtual environment via VirtualEnv

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.

Setup Python virtual environment via PyEnv

This approach is for Mac users:

  • Install pyenv virtualenv with brew install pyenv-virtualenv
    • You need to have pyenv installed first
  • 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
  • To activate the environment you can run pyenv activate <name_of_virtualenv>
  • To deactivate pyenv deactivate

Read more about PyEnv VirtualEnv Usage.

Project Requirements

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

Linting

Flake8 is the linter this project uses. To run the linter enter this command in your CLI:

flake8 .