Skip to main content

fnb — Fetch'n'Backup

PyPI version Python 3.12+ License: MIT

fnb is a simple backup tool, powered by rsync. It gives you three handy commands: fetch (to pull from remote), backup (to save to somewhere safe), and upload (to push to remote).

Under the hood? Just good old rsync — no magic, just sharp automation.

  • Simple config. Sharp execution. Safe data.
  • Run fetch, backup, or upload on their own, or sync fetch + backup in one go.

🚀 Features

  1. Fetch — Retrieve data from a remote server to your local machine
  2. Backup — Save local data to external storage
  3. Upload — Push local data to a remote server
  4. Sync — Run Fetch and Backup together in one go
  5. Init — Generate an initial config file (fnb.toml)
  6. Structured Logging — Built-in logging with configurable verbosity levels and file output

⚙️ Installation

pip install fnb
# または
uv pip install fnb

From Source

git clone https://gitlab.com/qumasan/fnb.git
cd fnb
uv sync --all-groups
uv run fnb --help

Requirements: Python 3.12 or higher is required.

See the full Installation Guide for more options, including running from source without installing.


🧰 Quick Start

# Initialize configuration files (fnb.toml and .env files)
fnb init

# Check the current config
fnb status

# Fetch: remote -> local
fnb fetch TARGET_LABEL

# Backup: local -> external
fnb backup TARGET_LABEL

# Upload: local -> remote
fnb upload TARGET_LABEL

# Run Fetch → Backup in one go
fnb sync TARGET_LABEL

# Check version
fnb version

🔧 Configuration

fnb uses TOML configuration files with sections for fetch, backup, and upload operations:

[fetch.SECTION_NAME]
label = "TARGET_LABEL"
summary = "Fetch data from remote server"
host = "user@remote-host"
source = "~/path/to/source/"
target = "./local/backup/path/"
options = ["-auvz", "--delete", '--rsync-path="~/.local/bin/rsync"']
enabled = true

[backup.SECTION_NAME]
label = "TARGET_LABEL"
summary = "Backup data to cloud storage"
host = "none"          # Local operation
source = "./local/backup/path/"  # Output from fetch
target = "./cloud/backup/path/"
options = ["-auvz", "--delete"]
enabled = true

[upload.SECTION_NAME]
label = "TARGET_LABEL"
summary = "Upload data to remote server"
host = "user@remote-host"          # host describes the target here, not the source
source = "./local/backup/path/"
target = "~/path/to/destination/"
options = ["-auvz", "--delete"]
enabled = true

Configuration File Priority (highest to lowest)

  1. ./fnb.toml — Project-local configuration
  2. ~/.config/fnb/config.toml — Global user configuration (XDG standard)
  3. C:\Users\username\AppData\Local\fnb\config.toml — Windows global configuration

📊 Logging

fnb includes built-in structured logging powered by loguru. All CLI commands support --log-level, --verbose (same as --log-level DEBUG), and --quiet (same as --log-level WARNING).

fnb fetch TARGET_LABEL --verbose
fnb backup TARGET_LABEL --quiet
fnb upload TARGET_LABEL --quiet
fnb sync TARGET_LABEL --log-level DEBUG

User-facing messages go to stdout; debug/technical logs go to stderr and are also saved to a rotating log file:

  • macOS: ~/Library/Logs/fnb/fnb.log
  • Linux: ~/.local/share/fnb/fnb.log
  • Windows: %APPDATA%\qumasan\fnb\Logs\fnb.log

Set FNB_DISABLE_FILE_LOGGING=1 to disable file logging.


🔐 Authentication

SSH password input can be automated using pexpect. You can also define connection settings (e.g. FNB_PASSWORD_*, FNB_TIMEOUT) in a .env file if needed. Run fnb init env to create the initial .env file.

For a one-off connection, use --ask-password on fetch/upload/sync to type the password interactively (input hidden) instead of --ssh-password VALUE, which the shell records to history the moment you type it:

fnb fetch TARGET_LABEL --ask-password

On macOS, fnb also checks the Keychain for a fnb-{host} password item before falling back to FNB_PASSWORD_DEFAULT, so you can avoid storing passwords in plain text:

security add-generic-password -s "fnb-user@remote-host" -a "user@remote-host" -w "your-password"

On any platform, fnb can also read a GPG-encrypted password file from ~/.config/fnb/passwords/{host}.gpg (or default.gpg):

mkdir -p ~/.config/fnb/passwords
echo -n "your-password" | gpg --symmetric -o ~/.config/fnb/passwords/user_remote_host.gpg

See the Security Guide for details and other authentication options (SSH keys, dotenvx encryption).


🪪 License

MIT


  • 🛠️ Development, Issues, Merge Requests: GitLab — please use GitLab for development contributions, bug reports, and feature requests
  • 🌏 Public Mirror and Discussions: GitHub
  • 📦 PyPI Package: fnb
  • 📖 Documentation: ReadTheDocs — installation, configuration, Contributor Guide, and Maintainer Guide
  • 📝 Release Notes: docs/releases/

See CLAUDE.md for detailed development guidelines (testing, linting, release workflow).

Metadata

Release files for fnb 0.19.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 fnb 0.19.0
File Size Uploaded Provenance
fnb-0.19.0.tar.gz 1.5 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fnb 0.19.0
File Interpreter ABI Platform
fnb-0.19.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.6 MB

Release files / fnb-0.19.0.tar.gz

Download URL fnb-0.19.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
03df4bf73f41c391aff3699554afbbc3da28cc804a177085a912d925a2641f35
BLAKE2b-256 checksum
How to use checksums
f6af83794a4327bafdab8301aa41383914e2bd34b9ca580822e807d786b2ed92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fnb-0.19.0-py3-none-any.whl

Download URL fnb-0.19.0-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b1a6c23d402e5d41999b08a99a801d843a6dfc6305158cb0b43b08851c5615a
BLAKE2b-256 checksum
How to use checksums
f0207fda2e1ee8eaddbfc1ef1cfece6348c65d1a66a3c9111edf13281e74f813
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fnb 0.19.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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