/
Python Repository

Python Repository

Overview

Instructions on setting up and using a Python repository.

Usage

Activate the virtual environment (see below for instructions) and follow the instructions provided by the README.

Development

Activate the virtual environment, and follow the instructions:

Setup

This is only needed to be done once before doing anything.

Install Git if it has not already been installed: Git

  • Windows: Use the Windows Credential Manager if you do not want to use SSH keys

Install Python 3.8 if it has not already been installed: Welcome to Python.org

  • The version matters, do not use any other version! 3.8.n, n is not important

Find the Git link in the repository:

  1. In GitHub, in the repository front page, click on the green button on the right with <> Code

  2. In the dropdown:

    1. Windows: Use the HTTPS link

    2. Linux: Use the SSH link

Clone repository to local:

git clone [repository link] cd [repository name] git submodule update --init --recursive --remote

Create and activate the virtual environment (see below for instructions).

Update pip: pip install --upgrade pip

Install the required Python packages: Instructions found in the README.

  • Often you will see: pip install -r requirements.txt . Do NOT blindly run this command! Every repository is different in how to install packages.

Virtual Environment

The Python virtual environment is a mechanism to isolate Python environments between projects. This is especially useful for dependencies that require specific versions of Python and/or packages.

Creation and Deletion

Autonomy uses venv as the name for virtual environments. Do not use any other name! If you already have a virtual environment with a different name, please delete the directory from your local repository.

Create the virtual environment in the top level directory of the local repository: python3 -m venv venv/

Activate

Activate the environment:

  • Windows command prompt: venv\Scripts\activate.bat

  • Windows Powershell: venv\Scripts\Activate.ps1

  • Linux and MacOS: source venv/bin/activate

(venv) is now prefixed, which means you are now in the environment.

Ensure the correct version of Python is installed: python --version

  • Should be Python 3.8

Deactivate

When you are done, deactivate the environment if you are using the same terminal for another repository:

  • Windows command prompt: venv\Scripts\deactivate.bat

  • Windows Powershell, Linux, and MacOS: deactivate

 

Related content

Autonomy Bootcamp
Autonomy Bootcamp
More like this
2023-2024 Airside System Architecture
2023-2024 Airside System Architecture
Read with this
Autonomy Github Starting Guide
Autonomy Github Starting Guide
More like this
Pathing Repository
Pathing Repository
Read with this
Python setup and virtual environment
Python setup and virtual environment
More like this
Implementing Features with Git
Implementing Features with Git
Read with this