Project Scripts
The scripts directory contains scripts that can be used for various common project actions. These scripts are intended to be run from the project root directory.
Main Scripts
Run Script
scripts/run.sh
The run.sh script is the main entry point for running project scripts. It provides both interactive and non-interactive modes for executing various project actions.
Available Actions
test: Run tests with coveragesecurity: Check for security vulnerabilities using banditlint: Lint the code using flake8format: Format code with black and sort imports with isortmkdocs: Manage MkDocs documentation siteinstall: Install project dependenciessetup-hooks: Set up pre-commit hookspre-commit: Run pre-commit hooks
Usage
Interactive Mode:
This will display a menu to select an action.Non-Interactive Mode:
Examples:
# Run tests
bash scripts/run.sh test
# Start documentation server
bash scripts/run.sh mkdocs serve
# Format code
bash scripts/run.sh format
Install Script
scripts/install.sh
Installs project dependencies and sets up the development environment.
Options
-a,--all: Install all dependencies including documentation dependencies-h,--help: Show help message
Usage
# Interactive installation
bash scripts/install.sh
# Install all dependencies
bash scripts/install.sh --all
Action Scripts
The scripts/actions/ directory contains individual scripts for specific tasks:
Test Script
scripts/actions/test.sh
Runs linting and tests with coverage reporting.
Security Script
scripts/actions/security.sh
Checks for security vulnerabilities using bandit.
Lint Script
scripts/actions/lint.sh
Lints the code using flake8.
Format Script
scripts/actions/format.sh
Formats code with black and sorts imports with isort.
MkDocs Script
scripts/actions/mkdocs.sh
Manages the MkDocs documentation site with multiple commands.
Commands
serve: Start development server (default)build: Build static sitedeploy: Deploy to GitHub Pagesclean: Clean build directoryhelp: Show help message
Usage
# Start development server
bash scripts/actions/mkdocs.sh serve
# Build static site
bash scripts/actions/mkdocs.sh build
# Deploy to GitHub Pages
bash scripts/actions/mkdocs.sh deploy
# Clean build directory
bash scripts/actions/mkdocs.sh clean
Pre-commit Script
scripts/actions/pre-commit.sh
Runs pre-commit hooks on staged files or all files.
Options
--all: Run pre-commit on all files-h,--help: Show help message
Usage
# Run on staged files
bash scripts/actions/pre-commit.sh
# Run on all files
bash scripts/actions/pre-commit.sh --all
Setup Hooks Script
scripts/actions/setup-hooks.sh
Sets up pre-commit hooks for development.
Options
--all: Run pre-commit on all files after setup-h,--help: Show help message
Usage
# Basic setup
bash scripts/actions/setup-hooks.sh
# Setup and run on all files
bash scripts/actions/setup-hooks.sh --all
Common Functions
scripts/actions/common.sh
Contains shared functions used by action scripts:
check_dependency: Checks if a dependency is available and offers to install it
Development Workflow
Initial Setup
# Install dependencies
bash scripts/install.sh --all
# Set up pre-commit hooks
bash scripts/actions/setup-hooks.sh --all
Daily Development
# Format code
bash scripts/run.sh format
# Run tests
bash scripts/run.sh test
# Check security
bash scripts/run.sh security