Fetch'n'Backup - Simple two-step backup tool with rsync
Project description
fnb — Fetch'n'Backup
fnb is a simple two-step backup tool, powered by rsync.
It gives you two handy commands:
fetch (to pull from remote), and
backup (to save to somewhere safe).
Under the hood? Just good old rsync — no magic, just sharp automation.
- Simple config. Sharp execution. Safe data.
- Use them one by one, or
syncthem all in one go.
🚀 Features
- Fetch — Retrieve data from a remote server to your local machine
- Backup — Save local data to external storage
- Sync — Run Fetch and Backup together in one go
- Init — Generate an initial config file (
fnb.toml)
⚙️ Installation and Setup
- Python 3.12 or higher is required.
- Setup the project using
uv
uv venv
uv pip install -e .
🧰 コマンド例
# Initialize configuration files (rfb.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
# Run Fetch → Backup in one go
fnb sync TARGET_LABEL
🔧 設定ファイル
config.toml
各処理対象のディレクトリごとに
fetch / backup
の設定を持ちます。
[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" # <- ローカル操作
source = "./local/backup/path/" # <- fetchのtargetパス
target = "./cloud/backup/path/"
options = ["-auvz", "--delete"]
enabled = true
設定ファイルの優先順位(高 → 低)
./fnb.toml← プロジェクトローカル設定~/.config/fnb/config.toml← グローバルユーザー設定(XDG準拠)C:\Users\ユーザー名\AppData\Local\fnb\config.toml← グローバルユーザー設定(Windowsの場合)./config/*.toml← 設定の分割・統合用(開発/運用向け)
🔐 Authentication
SSH password input can be automated using pexpect.
You can also define connection settings in a .env file if needed.
Run fnb init env to create the initial .env file.
🧪 Development
Python3- version 3.12 or higheruv- package managementTyper- CLI frameworkPydantic- config modelingpexpect- SSH automationpython-dotenv- environment variable supportpytest- testing framework (83% coverage)mkdocs-material- documentationpre-commit- run checks before each commitruff- fast Python linter and formattercommitizen- conventional commit tagging and changelog automation
Test Coverage
Current test coverage is 83% with comprehensive error handling and integration testing:
- backuper.py: 83% - Backup operation failure scenarios
- fetcher.py: 85% - SSH authentication and fetch failures
- cli.py: 99% - CLI command error scenarios
- reader.py: 89% - Configuration reading and validation
- gear.py: 87% - SSH automation with pexpect
- env.py: 68% - Environment variable handling
Integration Testing
Complete integration test suite with 23 tests (100% success rate):
- CLI Workflow Integration: 7 tests covering init → status → fetch/backup/sync workflows
- Multi-Module Integration: 6 tests verifying config → reader → gear → operation flows
- Sync Workflow Integration: 6 tests for complete fetch-then-backup sequences
- End-to-End Integration: 2 tests simulating realistic user workflows
- Test Infrastructure: Strategic mocking, external dependency isolation, reliable deterministic testing
🪪 License
MIT
🛠️ Contributing
This project is maintained in two repositories:
- 🛠️ Development, Issues, Merge Requests: GitLab
- 🌏 Public Mirror and Discussions: GitHub
Please use GitLab for development contributions, bug reports, and feature requests. For documentation viewing and community discussions, feel free to visit the GitHub mirror.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fnb-0.6.1.tar.gz.
File metadata
- Download URL: fnb-0.6.1.tar.gz
- Upload date:
- Size: 108.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16bc25144bc47e5c480bd6cf329df063b8ed6049ecbdf6566118035cd06a2982
|
|
| MD5 |
399d80c90f9f31462cda485aef6987c2
|
|
| BLAKE2b-256 |
519dc52455357a87d0fcb53e845086a85efe52ba2c9c6838882dc7ab1289903e
|
File details
Details for the file fnb-0.6.1-py3-none-any.whl.
File metadata
- Download URL: fnb-0.6.1-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8d976cdc51189ae5131e301a8e8c446fbf264050fa275f7bf019e8f5b22b97a
|
|
| MD5 |
beb49aa43b20022acfa46d731f6ecc02
|
|
| BLAKE2b-256 |
c2e0ad623129e0d0f87289611c2c22f827c130e30955eb19f232c065c3539697
|