A Python package for managing backup profiles with configuration management.
This package provides:
- Modern Python packaging with
pyproject.toml - Type hints and static type checking with mypy
- Code linting with ruff
- Testing with pytest
- Dependency management with uv
- Backup profile management with YAML configuration
- Python 3.10 or higher
- uv package manager
Clone the repository and install dependencies:
git clone https://github.com/AlexAndrewsAI/backup-keepass-unlock.git
cd backup-keepass-unlock
uv syncThe package includes a CLI tool built with typer:
# Run all profiles in a config file
uv run python3 -m backup_keepass_unlock.cli run tests/backup.yml
# Run a specific backup profile
uv run python3 -m backup_keepass_unlock.cli run tests/backup.yml --profile test2
# Run backups but skip if they were run in the last hour (3600 seconds)
uv run python3 -m backup_keepass_unlock.cli run tests/backup.yml --ignore-recent 3600The --ignore-recent flag (given in seconds) allows you to skip backups that were recently completed. This is useful for automated tasks (like crontabs) to prevent redundant backups if the script runs too frequently.
Before running tests, initialize the borg repository for testing:
mkdir -p tests/borg
borg init --encryption=repokey tests/borgWhen prompted for a password, use: b1
uv sync --devThis installs all dependencies and dev tools (pytest, ruff, mypy).
# Run all tests
uv run pytest
# Run with verbose output
uv run pytest -v
# Show print statements during tests
uv run pytest -s
# Manually run a single test backup profile
uv run python3 -m backup_keepass_unlock.cli run tests/backup.yml --profile test-backup# Lint code
uv run ruff check backup_keepass_unlock tests
# Type check
uv run mypy backup_keepass_unlockbackup-keepass-unlock/
├── .gitignore
├── AGENTS.md
├── pyproject.toml
├── README.md
├── uv.lock
├── backup_keepass_unlock/
│ ├── __init__.py
│ ├── backup.py
│ └── cli.py
└── tests/
├── __init__.py
├── backup.yml
├── borg/
├── dir/
├── test.kdbx
└── test_backup.py
- Type hints: Full type annotations for better IDE support and mypy compatibility
- Backup profile management: YAML-based configuration for backup profiles
- CLI interface: Command-line tool for managing and running backups
- Testing: Comprehensive test suite with pytest
- Code quality: Automated linting with ruff and type checking with mypy
- ✅ Type hints: All functions and classes use type annotations
- ✅ Docstrings: Clear descriptions of modules, classes, and functions
- ✅ Project structure: Proper package layout with separation of concerns
- ✅ Testing: Comprehensive test coverage with pytest
- ✅ Linting: Code quality checks with ruff
- ✅ Dependency management: Explicit dependencies in pyproject.toml
- ✅ Python versions: Supports Python 3.10+
This software is intended for personal use and is provided "as is", without any warranty of any kind, express or implied. While efforts have been made to ensure security, there is no guarantee that this software is free of security vulnerabilities. Use it at your own risk.
MIT
This is a template repository. Feel free to use it as a starting point for your own projects.
AlexAndrewsAI alex.andrews.ai@protonmail.com