Name | fnb JSON |
Version |
0.9.0
JSON |
| download |
home_page | None |
Summary | Fetch'n'Backup - Simple two-step backup tool with rsync |
upload_time | 2025-08-21 06:28:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.12 |
license | MIT |
keywords |
backup
cli
fetch
rsync
sync
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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 `sync` them all 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. **Sync** — Run Fetch and Backup together in one go
4. **Init** — Generate an initial config file (`fnb.toml`)
---
## ⚙️ Installation and Setup
### From PyPI (Recommended)
```bash
# Install from PyPI
pip install fnb
# Or using uv
uv add fnb
```
### From Source
- Python 3.12 or higher is required.
- Setup the project using `uv`
```bash
git clone https://gitlab.com/qumasan/fnb.git
cd fnb
uv venv
uv pip install -e .
```
---
## 🧰 コマンド例
```bash
# 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
# Run Fetch → Backup in one go
fnb sync TARGET_LABEL
```
---
## 🔧 設定ファイル
**config.toml**
各処理対象のディレクトリごとに
`fetch` / `backup`
の設定を持ちます。
```toml
[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
```
### 設定ファイルの優先順位(高 → 低)
1. `./fnb.toml` ← プロジェクトローカル設定
2. `~/.config/fnb/config.toml` ← グローバルユーザー設定(XDG準拠)
3. `C:\Users\ユーザー名\AppData\Local\fnb\config.toml` ← グローバルユーザー設定(Windowsの場合)
4. `./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 higher
- `uv` - package management
- `Typer` - CLI framework
- `Pydantic` - config modeling
- `pexpect` - SSH automation
- `python-dotenv` - environment variable support
- `pytest` - testing framework (83% coverage)
- `mkdocs-material` - documentation
- `pre-commit` - run checks before each commit
- `ruff` - fast Python linter and formatter
- `commitizen` - conventional commit tagging and changelog automation
### Version Management
This project uses automated semantic versioning with GitLab releases:
```bash
# Preview version bump
task bump-dry
# Execute version bump and changelog update
task bump
# Create GitLab release
task release
# Complete release workflow (test → format → bump → release)
task release-full
```
**Current Version**: v0.8.0 - [View Release](https://gitlab.com/qumasan/fnb/-/releases/0.8.0)
### CI/CD Pipeline
GitLab CI/CD pipeline provides automated testing, building, and deployment:
**Stages:**
- `test`: Unit tests, code quality, integration tests (separate job)
- `build`: Package building with `uv build`
- `deploy-test`: TestPyPI deployment (manual, tags only)
- `deploy-prod`: PyPI deployment (manual, tags only)
**Required CI Variables for Deployment:**
```bash
# GitLab Settings → CI/CD → Variables
TESTPYPI_API_TOKEN # TestPyPI API token for testing releases
PYPI_API_TOKEN # PyPI API token for production releases
```
**Local CI Simulation:**
```bash
# Run tests as they run in CI (unit tests only)
task test-ci
# Run integration tests only
task test-integration
# Simulate complete CI pipeline locally
task ci-local
```
### 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](https://gitlab.com/qumasan/fnb)
- 🌏 Public Mirror and Discussions: GitHub
- 📦 PyPI Package: [fnb](https://pypi.org/project/fnb/) (v0.8.0)
- 📖 Documentation: [GitLab Pages](https://qumasan.gitlab.io/fnb/)
Please use **GitLab** for development contributions, bug reports, and feature requests.
For documentation viewing and community discussions, feel free to visit the GitHub mirror.
### Development Workflow
See [CLAUDE.md](./CLAUDE.md) for detailed development guidelines including:
- Testing and coverage requirements (83%+)
- Version management and release workflow
- GitLab integration best practices
Raw data
{
"_id": null,
"home_page": null,
"name": "fnb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "backup, cli, fetch, rsync, sync",
"author": null,
"author_email": "\"Shota Takahashi (KMI)\" <shotakaha@kmi.nagoya-u.ac.jp>",
"download_url": "https://files.pythonhosted.org/packages/ef/14/0e45d77bf04c822b97cc51c03d5d26195a8a12d86867a8f9aac695bd5d2a/fnb-0.9.0.tar.gz",
"platform": null,
"description": "# fnb \u2014 Fetch'n'Backup\n\n**fnb** is a simple two-step backup tool, powered by `rsync`.\nIt gives you two handy commands:\n`fetch` (to pull from remote), and\n`backup` (to save to somewhere safe).\n\nUnder the hood? Just good old `rsync` \u2014 no magic, just sharp automation.\n\n- Simple config. Sharp execution. Safe data.\n- Use them one by one, or `sync` them all in one go.\n\n---\n\n## \ud83d\ude80 Features\n\n1. **Fetch** \u2014 Retrieve data from a remote server to your local machine\n2. **Backup** \u2014 Save local data to external storage\n3. **Sync** \u2014 Run Fetch and Backup together in one go\n4. **Init** \u2014 Generate an initial config file (`fnb.toml`)\n\n---\n\n## \u2699\ufe0f Installation and Setup\n\n### From PyPI (Recommended)\n\n```bash\n# Install from PyPI\npip install fnb\n\n# Or using uv\nuv add fnb\n```\n\n### From Source\n\n- Python 3.12 or higher is required.\n- Setup the project using `uv`\n\n```bash\ngit clone https://gitlab.com/qumasan/fnb.git\ncd fnb\nuv venv\nuv pip install -e .\n```\n\n---\n\n## \ud83e\uddf0 \u30b3\u30de\u30f3\u30c9\u4f8b\n\n```bash\n# Initialize configuration files (fnb.toml and .env files)\nfnb init\n\n# Check the current config\nfnb status\n\n# Fetch: remote -> local\nfnb fetch TARGET_LABEL\n\n# Backup: local -> external\nfnb backup TARGET_LABEL\n\n# Run Fetch \u2192 Backup in one go\nfnb sync TARGET_LABEL\n```\n\n---\n\n## \ud83d\udd27 \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\n\n**config.toml**\n\n\u5404\u51e6\u7406\u5bfe\u8c61\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3054\u3068\u306b\n`fetch` / `backup`\n\u306e\u8a2d\u5b9a\u3092\u6301\u3061\u307e\u3059\u3002\n\n```toml\n[fetch.SECTION_NAME]\nlabel = \"TARGET_LABEL\"\nsummary = \"Fetch data from remote server\"\nhost = \"user@remote-host\"\nsource = \"~/path/to/source/\"\ntarget = \"./local/backup/path/\"\noptions = [\"-auvz\", \"--delete\", '--rsync-path=\"~/.local/bin/rsync\"']\nenabled = true\n\n[backup.SECTION_NAME]\nlabel = \"TARGET_LABEL\"\nsummary = \"Backup data to cloud storage\"\nhost = \"none\" # <- \u30ed\u30fc\u30ab\u30eb\u64cd\u4f5c\nsource = \"./local/backup/path/\" # <- fetch\u306etarget\u30d1\u30b9\ntarget = \"./cloud/backup/path/\"\noptions = [\"-auvz\", \"--delete\"]\nenabled = true\n```\n\n### \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u512a\u5148\u9806\u4f4d\uff08\u9ad8 \u2192 \u4f4e\uff09\n\n1. `./fnb.toml` \u2190 \u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30ed\u30fc\u30ab\u30eb\u8a2d\u5b9a\n2. `~/.config/fnb/config.toml` \u2190 \u30b0\u30ed\u30fc\u30d0\u30eb\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\uff08XDG\u6e96\u62e0\uff09\n3. `C:\\Users\\\u30e6\u30fc\u30b6\u30fc\u540d\\AppData\\Local\\fnb\\config.toml` \u2190 \u30b0\u30ed\u30fc\u30d0\u30eb\u30e6\u30fc\u30b6\u30fc\u8a2d\u5b9a\uff08Windows\u306e\u5834\u5408\uff09\n4. `./config/*.toml` \u2190 \u8a2d\u5b9a\u306e\u5206\u5272\u30fb\u7d71\u5408\u7528\uff08\u958b\u767a/\u904b\u7528\u5411\u3051\uff09\n\n---\n\n## \ud83d\udd10 Authentication\n\nSSH password input can be automated using `pexpect`.\nYou can also define connection settings in a `.env` file if needed.\nRun `fnb init env` to create the initial `.env` file.\n\n---\n\n## \ud83e\uddea Development\n\n- `Python3` - version 3.12 or higher\n- `uv` - package management\n- `Typer` - CLI framework\n- `Pydantic` - config modeling\n- `pexpect` - SSH automation\n- `python-dotenv` - environment variable support\n- `pytest` - testing framework (83% coverage)\n- `mkdocs-material` - documentation\n- `pre-commit` - run checks before each commit\n- `ruff` - fast Python linter and formatter\n- `commitizen` - conventional commit tagging and changelog automation\n\n### Version Management\n\nThis project uses automated semantic versioning with GitLab releases:\n\n```bash\n# Preview version bump\ntask bump-dry\n\n# Execute version bump and changelog update\ntask bump\n\n# Create GitLab release\ntask release\n\n# Complete release workflow (test \u2192 format \u2192 bump \u2192 release)\ntask release-full\n```\n\n**Current Version**: v0.8.0 - [View Release](https://gitlab.com/qumasan/fnb/-/releases/0.8.0)\n\n### CI/CD Pipeline\n\nGitLab CI/CD pipeline provides automated testing, building, and deployment:\n\n**Stages:**\n- `test`: Unit tests, code quality, integration tests (separate job)\n- `build`: Package building with `uv build`\n- `deploy-test`: TestPyPI deployment (manual, tags only)\n- `deploy-prod`: PyPI deployment (manual, tags only)\n\n**Required CI Variables for Deployment:**\n```bash\n# GitLab Settings \u2192 CI/CD \u2192 Variables\nTESTPYPI_API_TOKEN # TestPyPI API token for testing releases\nPYPI_API_TOKEN # PyPI API token for production releases\n```\n\n**Local CI Simulation:**\n```bash\n# Run tests as they run in CI (unit tests only)\ntask test-ci\n\n# Run integration tests only\ntask test-integration\n\n# Simulate complete CI pipeline locally\ntask ci-local\n```\n\n### Test Coverage\n\nCurrent test coverage is **83%** with comprehensive error handling and integration testing:\n\n- **backuper.py**: 83% - Backup operation failure scenarios\n- **fetcher.py**: 85% - SSH authentication and fetch failures\n- **cli.py**: 99% - CLI command error scenarios\n- **reader.py**: 89% - Configuration reading and validation\n- **gear.py**: 87% - SSH automation with pexpect\n- **env.py**: 68% - Environment variable handling\n\n### Integration Testing\n\nComplete integration test suite with **23 tests (100% success rate)**:\n\n- **CLI Workflow Integration**: 7 tests covering init \u2192 status \u2192 fetch/backup/sync workflows\n- **Multi-Module Integration**: 6 tests verifying config \u2192 reader \u2192 gear \u2192 operation flows\n- **Sync Workflow Integration**: 6 tests for complete fetch-then-backup sequences\n- **End-to-End Integration**: 2 tests simulating realistic user workflows\n- **Test Infrastructure**: Strategic mocking, external dependency isolation, reliable deterministic testing\n\n## \ud83e\udeaa License\n\nMIT\n\n## \ud83d\udee0\ufe0f Contributing\n\nThis project is maintained in two repositories:\n\n- \ud83d\udee0\ufe0f Development, Issues, Merge Requests: [GitLab](https://gitlab.com/qumasan/fnb)\n- \ud83c\udf0f Public Mirror and Discussions: GitHub\n- \ud83d\udce6 PyPI Package: [fnb](https://pypi.org/project/fnb/) (v0.8.0)\n- \ud83d\udcd6 Documentation: [GitLab Pages](https://qumasan.gitlab.io/fnb/)\n\nPlease use **GitLab** for development contributions, bug reports, and feature requests.\nFor documentation viewing and community discussions, feel free to visit the GitHub mirror.\n\n### Development Workflow\n\nSee [CLAUDE.md](./CLAUDE.md) for detailed development guidelines including:\n- Testing and coverage requirements (83%+)\n- Version management and release workflow\n- GitLab integration best practices\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Fetch'n'Backup - Simple two-step backup tool with rsync",
"version": "0.9.0",
"project_urls": null,
"split_keywords": [
"backup",
" cli",
" fetch",
" rsync",
" sync"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "5afb75b2a05258db290ba7c136f2c4d70c9f94101689edee3859882189053b86",
"md5": "1034410c5c8266771c997e81d9f76287",
"sha256": "f591e3c6f3d645fa342f2b95b83923d95f6936cd7540ed6cbb5f066017325845"
},
"downloads": -1,
"filename": "fnb-0.9.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1034410c5c8266771c997e81d9f76287",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 20764,
"upload_time": "2025-08-21T06:28:12",
"upload_time_iso_8601": "2025-08-21T06:28:12.001402Z",
"url": "https://files.pythonhosted.org/packages/5a/fb/75b2a05258db290ba7c136f2c4d70c9f94101689edee3859882189053b86/fnb-0.9.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ef140e45d77bf04c822b97cc51c03d5d26195a8a12d86867a8f9aac695bd5d2a",
"md5": "9a6a13eb6f67045c3826026157ad45ea",
"sha256": "264508db06ff4e39e0527408d94b95e429fb10bb5bff5fa012a1217ed1117ebf"
},
"downloads": -1,
"filename": "fnb-0.9.0.tar.gz",
"has_sig": false,
"md5_digest": "9a6a13eb6f67045c3826026157ad45ea",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 112562,
"upload_time": "2025-08-21T06:28:12",
"upload_time_iso_8601": "2025-08-21T06:28:12.874622Z",
"url": "https://files.pythonhosted.org/packages/ef/14/0e45d77bf04c822b97cc51c03d5d26195a8a12d86867a8f9aac695bd5d2a/fnb-0.9.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 06:28:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "fnb"
}