Skip to content

Instantly share code, notes, and snippets.

@therealzanfar
Last active May 13, 2023 13:37
Show Gist options
  • Save therealzanfar/573a9df732b7fbe503f32344233d3c4f to your computer and use it in GitHub Desktop.
Save therealzanfar/573a9df732b7fbe503f32344233d3c4f to your computer and use it in GitHub Desktop.
Legacy shell script to (re)create a Python virtual environment PLEASE READ NOTE

This gist remains for historical reaons, however, I can no longer recommend using it.

The pracitce of using requirements.txt and simple pip dependencies is outdated and deprecated. All new projects should use a tool that supports the pyproject.toml integrated format and keeps locked versions for specified and child dependencies. My current choice is Poetry.

#!/bin/bash
VENV=".venv";
PYTHON="python3.10";
"${PYTHON}" -m venv "${VENV}";
"${VENV}/bin/${PYTHON}" -m pip install --upgrade wheel pip;
"${VENV}/bin/${PYTHON}" -m pip install -r requirements.txt;
# This is only an example, delete the below specifications before adding your own
requests~=2.30
# Dev Requirements
black
ruff
mypy
pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment