Published on Jan. 2, 2024
Go homeMy scripts to rule them all
All the following scripts are contained within a scripts folder within the project root.
The install script.
#!/usr/bin/env bash
SOURCE_DIR="$(realpath $(dirname $0))"
PROJECT_DIR="$(dirname $SOURCE_DIR)"
VENV_DIR="${PROJECT_DIR}/.venv"
set -e
python -m venv --prompt my-project "${VENV_DIR}"
${VENV_DIR}/bin/pip install -U pip==23.3.2 pip-tools==7.3.0
${VENV_DIR}/bin/pip-sync ${PROJECT_DIR}/requirements.dev.txt
$VENV_DIR/bin/pip install -e .
${VENV_DIR}/bin/tailwindcss_install
The lock script.
#!/usr/bin/env bash
SOURCE_DIR="$(realpath $(dirname $0))"
PROJECT_DIR="$(dirname $SOURCE_DIR)"
VENV_DIR="${PROJECT_DIR}/.venv"
set -e
cd $PROJECT_DIR
# Compile production requirements
${VENV_DIR}/bin/pip-compile \
--quiet \
--strip-extras \
--output-file requirements.prod.txt \
--resolver=backtracking \
pyproject.toml
# Compile development requirements
${VENV_DIR}/bin/pip-compile \
--quiet \
--extra development \
--strip-extras \
--constraint requirements.prod.txt \
--output-file requirements.dev.txt \
--resolver=backtracking \
pyproject.toml
The upgrade script.
#!/bin/bash
python -m piptools compile \
--upgrade \
--quiet \
--output-file requirements.prod.txt \
--resolver=backtracking \
--strip-extras \
pyproject.toml
python -m piptools compile \
--upgrade \
--quiet \
--extra dev \
--output-file requirements.dev.txt \
--resolver=backtracking \
--strip-extras \
pyproject.toml