Skip to main content

Barkup is a Python-based CLI tool for automating personal backups to local and cloud storage with support for Google Drive.

Project description

Barkup

CI

Barkup is a Python-based CLI tool for automating personal backups to local and cloud storage (Google Drive), with incremental, hash-checked copies and a config-driven workflow.

Motivation

Barkup started because I needed a reliable way to automatically back up the photos from my final year at university — and the ones I'll keep taking at conferences and elsewhere — to somewhere safe like Google Drive. I soon realized the same approach covers my eBooks and other files too. Barkup is the result: a small, config-driven CLI I built for myself, and my first personal project on boot.dev.

Quick Start

# Clone and install
git clone https://github.com/abu-bilaall/barkup
cd barkup
uv sync

# Scaffold a config, then edit it
uv run barkup init
# writes ~/.config/barkup/config.toml — set [general].sources and [local].destination, then run

# Run your first backup
uv run barkup run

# List what's backed up
uv run barkup list

Once installed, the barkup command is available via uv run barkup. You can also install the console script directly (uv pip install -e .), or install from PyPI once published (pip install barkup).

Usage

Configuration

Barkup loads and deep-merges config from these locations, lowest to highest priority:

  1. /etc/barkup/config.toml (system)
  2. ~/.config/barkup/config.toml (user; respects XDG_CONFIG_HOME)
  3. ./barkup.config.toml (current directory)
  4. --config <PATH> (CLI flag — highest priority)

A minimal config:

[general]
profile_name = "default"
dry_run = false
sources = ["/home/you/Documents", "/home/you/Pictures"]
compression = false
exclude = ["*.tmp", ".git", "node_modules"]

[local]
destination = "/mnt/backups"
exclude = [".tmp*"]

[[cloud_providers]]
provider = "google_drive"
enabled = false
# credentials_file = "/home/you/.barkup/google_drive.json"
# remote_folder = "Backups/Barkup"
  • [general] sets defaults for sources, compression, and exclude.
  • [local] and [[cloud_providers]] override those defaults; their exclude lists merge and deduplicate with the general list.
  • compression is a placeholder for the upcoming ZIP feature.
  • See config.example.toml in the repo for the full annotated example (including [advanced] temp_dir).

Commands

Global option: --config <PATH> (use a custom config file for any command).

Command Options Description
barkup init --force Create the default config at the user config path (overwrite with --force).
barkup run --name <PROFILE>, --yes Run a backup. --name selects the profile; --yes is accepted for automation compatibility (no-op; dry-run is preview-only and never copies).
barkup list --name <PROFILE> List backed-up files (original path, backup path, size, last backup). Filter by profile.
barkup status --name <PROFILE> Show backup statistics for a profile (or all profiles).
barkup verify --name <PROFILE> Recalculate hashes of the backup copies and compare with stored state; reports OK / missing / mismatched. Exits non-zero if any problem is found.
barkup restore <path> --to <DEST>, --all, --name <PROFILE>, --yes Restore a single file (or --all for the whole set). --to restores to a custom location (preserves directory structure); --name selects the profile. Restoring onto an existing original requires --yes. --all requires --name.
barkup profiles List all backup profiles with file counts, total size, and last-backup time.
barkup prune --name <PROFILE>, --delete-backups, --yes Dry run lists orphan records; with --yes, remove DB records whose source files no longer exist. --delete-backups also deletes the backup files.

Examples:

uv run barkup run --name default --yes
uv run barkup restore /mnt/backups/Documents/notes.txt --to ~/restore
uv run barkup restore --all --name default --to ~/restore-all
uv run barkup verify

How I use Barkup

I run Barkup unattended as a scheduled job (cron) rather than by hand. My setup:

  1. barkup init to scaffold ~/.config/barkup/config.toml.
  2. Point [general].sources at ~/Pictures and ~/Documents; set [local].destination to an external drive; enable the google_drive provider with a credentials file and a remote_folder.
  3. Run it daily via cron with barkup run (the --yes flag is accepted for automation compatibility).

The config is the single source of truth, so adjust sources, destinations, and schedule to taste.

Contributing

  • Requires Python 3.12+ and uv.

  • Install dev dependencies and run tests:

    uv sync
    uv run pytest -v
    
  • Lint/format: uv run ruff check . and uv run black --check ..

  • Run the app during development: ./main.sh or uv run src/main.py.

  • Workflow: feature branches are opened against dev; PR titles follow [Feature NN] - <summary> (see .github/PULL_REQUEST_TEMPLATE.md). Keep changes focused and tests deterministic.

License

Released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

barkup-0.2.0.tar.gz (83.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

barkup-0.2.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file barkup-0.2.0.tar.gz.

File metadata

  • Download URL: barkup-0.2.0.tar.gz
  • Upload date:
  • Size: 83.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for barkup-0.2.0.tar.gz
Algorithm Hash digest
SHA256 02e8592ecc08f94f0f3022cdcea221ae59e05222ff2e5f9de38182b1c1bf06a6
MD5 4e05c8a29fe718f7798717361e41d5d7
BLAKE2b-256 52c7a3aab7f03d4ea14772fb66ce44453d933c77c359afd79115cebd2607d1ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for barkup-0.2.0.tar.gz:

Publisher: release.yml on abu-bilaall/barkup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file barkup-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: barkup-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for barkup-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05d759ffb9a50e2b9b2c58f7a5ab494c653cddf9af08dacfbbd72f6fdb47abc0
MD5 50b0538ab4c6b6d8d2bf6a7d9e0894e6
BLAKE2b-256 e38302c1e029a890210be1378750da72dbf43b031fba4afb701e8e890cd0aba6

See more details on using hashes here.

Provenance

The following attestation bundles were made for barkup-0.2.0-py3-none-any.whl:

Publisher: release.yml on abu-bilaall/barkup

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page