Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Instruction on configure_repo.py script


Owner: Vadim Rudakov, rudakow.wadim@gmail.com Version: 0.1.0 Birth: 2026-01-27 Last Modified: 2026-01-27


1. Architectural Overview: The SVA Principle

This script automates repository setup for development by running dependency installation, configuring git hooks, setting permissions, and creating convenience symlinks.

It replaces the legacy configure_repo.sh bash script with a Python implementation that provides better error handling, dry-run support, and testability.

It adheres to the Smallest Viable Architecture (SVA) principle.

2. Key Capabilities & Logic

A. Setup Operations

The script performs four sequential operations:

OperationDescription
UV SyncRuns uv sync to install/update dependencies from lockfile
Pre-commit InstallRuns uv run pre-commit install to configure git hooks
Aider ConfigCopies tools/configs/aider.conf.yml to .aider.conf.yml if target missing
Script PermissionsMakes all .sh and .py files executable recursively
SymlinksCreates symlinks in ~/bin for all files in tools/scripts/

B. Skip Flags

Operations can be selectively skipped:

FlagEffect
--skip-uv-syncSkips both uv sync and pre-commit install
--skip-symlinksSkips symlink creation in ~/bin

3. Technical Architecture

The script is organized into specialized classes to maintain clarity:

ClassResponsibility
UvSyncRunnerExecute uv sync and pre-commit install commands
AiderConfigCopierCopy aider configuration file with existence checks
ScriptPermissionsFind and make .sh/.py files executable
SymlinkCreatorCreate symlinks in target bin directory
ReporterOutput formatting and exit code handling
ConfigureRepoCLIArgument parsing and main orchestration

4. Operational Guide

Configuration Reference

  • Primary Script: tools/scripts/configure_repo.py

  • Legacy Script: tools/scripts/configure_repo.sh (deprecated)

  • Aider Source: tools/configs/aider.conf.yml

  • Aider Target: .aider.conf.yml (repository root)

Command Line Interface

configure_repo.py [--skip-uv-sync] [--skip-symlinks] [--verbose] [--dry-run] [--bin-dir DIR]
ArgumentDescriptionDefault
--skip-uv-syncSkip dependency and hook installationFalse
--skip-symlinksSkip symlink creationFalse
--verboseShow detailed progressFalse
--dry-runPreview operations without executionFalse
--bin-dirTarget directory for symlinks~/bin

Exit Codes:

  • 0 = Setup completed successfully

  • 1 = Setup failed (e.g., uv sync error)

Manual Execution Commands

Run these from the repository root using uv for consistent environment resolution:

TaskCommand
Full Setupuv run tools/scripts/configure_repo.py
With Verbose Outputuv run tools/scripts/configure_repo.py --verbose
Dry Run Previewuv run tools/scripts/configure_repo.py --dry-run --verbose
Skip UV Syncuv run tools/scripts/configure_repo.py --skip-uv-sync
Custom Bin Diruv run tools/scripts/configure_repo.py --bin-dir=/usr/local/bin

Examples

cd ../../../
ls
  1. Preview what would be done:

env -u VIRTUAL_ENV uv run tools/scripts/configure_repo.py --dry-run --verbose
  1. Run setup skipping symlinks:

env -u VIRTUAL_ENV uv run tools/scripts/configure_repo.py --skip-symlinks --skip-uv-sync --verbose

5. Test Suite Documentation

The script is accompanied by a comprehensive test suite (test_configure_repo.py) that ensures reliability across different patterns and edge cases.

Test Classes and Coverage

Test ClassPurpose
TestUvSyncRunnerCommand execution, failure handling, dry-run mode
TestAiderConfigCopierSource/target existence checks, copy operations
TestScriptPermissionsPermission changes, file type filtering, nested dirs
TestSymlinkCreatorSymlink creation/update, directory handling
TestReporterExit codes, verbose/quiet output
TestConfigureRepoCLIIntegration tests for CLI flags and full runs

Key Test Scenarios

  • UvSyncRunner: Command success/failure, dry-run skips execution

  • AiderConfigCopier: Source exists/missing, target exists/missing, dry-run

  • ScriptPermissions: .py/.sh files made executable, directories skipped

  • SymlinkCreator: New symlinks, existing symlinks updated, missing bin dir created

  • ConfigureRepoCLI: All flag combinations, full setup integration

Running the Tests

To run the full suite, execute from the repository root:

$ uv run pytest tools/tests/test_configure_repo.py
env -u VIRTUAL_ENV uv run pytest tools/tests/test_configure_repo.py -q
env -u VIRTUAL_ENV uv run pytest tools/tests/test_configure_repo.py --cov=tools/scripts/configure_repo --cov-report=term-missing -q