Skip to main content

pybackup-engine

Production-grade backup engine for files and databases — with a built-in web dashboard, user login system, and pluggable database backends.

PyPI version Python 3.10+ License: MIT Tests


Features

Feature Detail
Backup engines Files, PostgreSQL (pg_dump), MySQL (mysqldump), MongoDB (mongodump), MS SQL Server (sqlcmd)
Web dashboard Built-in pure Python HTTP server — no Flask, FastAPI or Django
Login system PBKDF2 password hashing, session tokens, admin/viewer roles
User management Create, list, delete users via CLI or web UI
Change password Users can change their own password in the dashboard
Database backends SQLite (default), PostgreSQL, MySQL, MongoDB, MSSQL — like Django's DATABASES
CLI run, serve, verify, checksum, config-check, user add/list/delete
Fonts Space Grotesk headings · Inter body
Theme Dark / Light toggle

Install

pip install pybackup-engine

With optional database backend support:

pip install pybackup-engine[postgresql]   # psycopg2-binary
pip install pybackup-engine[mysql]        # PyMySQL
pip install pybackup-engine[mongodb]      # pymongo
pip install pybackup-engine[mssql]        # pyodbc
pip install pybackup-engine[all]          # all backends

Quick Start

1. Create the first admin user

pybackup user add --username admin --role admin

2. Write a config

# pybackup.yaml
version: 1

global:
  backup_root: /backups
  retention_days: 7
  compress: true

# Internal metadata database (SQLite by default, switch to postgres/mysql/etc)
database:
  backend: sqlite
  name: /var/lib/pybackup/pybackup.db

postgresql:
  enabled: true
  jobs:
    - name: prod-db
      host: localhost
      database: myapp
      username: backup_user
      password: ${PGPASSWORD}

files:
  enabled: true
  jobs:
    - name: configs
      source: /etc/myapp
      exclude: ["*.log", "*.tmp"]

3. Run backups

pybackup run --config pybackup.yaml

4. Start the dashboard

pybackup serve --port 8200

Open http://localhost:8200 → login with your admin credentials.


CLI Reference

pybackup run           -c config.yaml [--dry-run]
pybackup serve         [--host 0.0.0.0] [--port 8200] [-c config.yaml]
pybackup verify        FILE --checksum SHA256 [--algorithm sha256]
pybackup checksum      FILE [--algorithm sha256]
pybackup config-check  -c config.yaml

pybackup user add          --username USER --role admin|viewer
pybackup user list
pybackup user delete       --username USER
pybackup user set-password --username USER

Database Backends

Inspired by Django's DATABASES setting — just change the backend: value:

# SQLite (default, zero config)
database:
  backend: sqlite
  name: /var/lib/pybackup/pybackup.db

# PostgreSQL
database:
  backend:  postgresql
  host:     localhost
  port:     5432
  name:     pybackup
  user:     pybackup_user
  password: ${DB_PASSWORD}

# MySQL / MariaDB
database:
  backend:  mysql
  host:     localhost
  name:     pybackup
  user:     pybackup_user
  password: ${MYSQL_PASSWORD}

# MongoDB
database:
  backend:  mongodb
  host:     localhost
  name:     pybackup
  user:     pybackup_user
  password: ${MONGO_PASSWORD}

# MS SQL Server
database:
  backend:  mssql
  host:     localhost
  name:     pybackup
  user:     sa
  password: ${MSSQL_PASSWORD}

REST API

All endpoints under /api/ — authenticated via Authorization: Bearer <token>:

Method Path Auth Description
POST /api/auth/login Public Login, returns session token
POST /api/auth/logout Session Logout
GET /api/auth/me Session Current user info
POST /api/auth/change-password Session Change own password
GET /api/users Admin List all users
POST /api/users Admin Create user
DELETE /api/users/:id Admin Delete user
GET /api/stats Session Dashboard statistics
GET /api/runs Session Paginated run list
POST /api/runs Session Create a run entry
GET /api/runs/:id Session Run detail + files
DELETE /api/runs/:id Admin Delete a run
GET /api/settings Session Get settings
POST /api/settings Session Update settings

Project Structure

pybackup/
├── cli.py                    # Click CLI (run/serve/verify/user)
├── auth.py                   # PBKDF2 passwords, session tokens, UserDB
├── constants.py
├── config/loader.py          # YAML + env var expansion
├── engine/
│   ├── base.py               # BaseBackupEngine (prepare/run/finalize)
│   ├── files.py              # File/dir backup with tar.gz support
│   ├── mongo.py / postgres.py / mysql.py / mssql.py
│   ├── verify.py             # SHA-256/512 checksums
│   └── manifest.py           # JSON sidecar manifests
├── db/
│   ├── database.py           # SQLite implementation
│   └── backends/
│       ├── __init__.py       # get_database() factory
│       ├── postgres_backend.py
│       ├── mysql_backend.py
│       ├── mongo_backend.py
│       └── mssql_backend.py
├── server/
│   ├── httpserver.py         # Pure stdlib ThreadingHTTPServer + Router
│   └── handlers.py           # All REST API handlers
└── static/
    ├── login.html            # Login page
    ├── index.html            # SPA dashboard
    ├── css/app.css           # Space Grotesk + Inter · dark/light
    └── js/app.js             # Vanilla JS SPA

Security

  • Passwords hashed with PBKDF2-HMAC-SHA256 (600,000 iterations, 32-byte salt)
  • Session tokens are cryptographically random 32-byte hex strings
  • Sessions expire after 8 hours
  • Database credentials resolved from environment variables (${VAR} syntax)
  • Constant-time password comparison to prevent timing attacks

License

MIT © PyBackup Contributors

Metadata

Release files for pybackup-engine 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybackup-engine 2.1.0
File Size Uploaded
pybackup_engine-2.1.0.tar.gz 68.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pybackup-engine 2.1.0
File Interpreter ABI Platform
pybackup_engine-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 141.5 kB

Release files / pybackup_engine-2.1.0.tar.gz

Download URL pybackup_engine-2.1.0.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
757015d7d57ebb8a56541a4daa5a619c059abc5dbe68a52b5f18cb381d2f3747
BLAKE2b-256 checksum
How to use checksums
38fef45d95f514a388bc901268e52d3f4ecb726bd8e52898991ed31789d03f18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / pybackup_engine-2.1.0-py3-none-any.whl

Download URL pybackup_engine-2.1.0-py3-none-any.whl
Size 72.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c65f94012c00068129e8775fd1d77c1d4407f989037b4671d8e96bdf1d490e44
BLAKE2b-256 checksum
How to use checksums
aacacb219787af0fc6ad041dcd72d0c1d4ba8e573e14d1b93caea63c4e55b739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page