Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 1.72 KB

File metadata and controls

57 lines (38 loc) · 1.72 KB

Please read the following instructions for setting up python and virtual environments.

This will ensure a reproducible and industry standard method for dealing with Python projects.

Python Environment Setup

This project relies on virtual environments (venv) and requirements.txt (managed by pipreqs) for consistent dependency management.

1. Create Virtual Environment (Run Only Once):

This step only needs to be done the very first time you set up the project.

# macOS/Linux
python3 -m venv venv

# Windows
python -m venv venv

2. Activate Virtual Environment (Run Every Time You Start Working):

You'll need to activate the virtual environment each time you begin working on the project in a new terminal session.

# macOS/Linux
source venv/bin/activate

# Windows
venv\Scripts\activate

(venv) will appear at the beginning of your terminal prompt when activated.

3. Generate or Install Dependencies:

  • Initial Setup / New Dependency: After activating the venv, generate or update requirements.txt from the project root:

    pip install pipreqs
    pipreqs . --force --encoding=utf8
  • Existing requirements.txt: If the file exists, install dependencies:

    pip install -r requirements.txt

4. Updating Dependencies:

Whenever you install a new package (pip install <package>) within the activated virtual environment, update requirements.txt:

# if you installed a package recently (you can install them normally using pip).
pipreqs . --force --encoding=utf8

Key Point: Remember to activate your virtual environment every time you start working on the project. The virtual environment only needs to be created once.