Metadata-Version: 2.5
Name: resticbackups3
Version: 0.1.0
Summary: restic + S3-compatible storage (Cloudflare R2 first): init once, then back up from cron
License-Expression: MIT
License-File: LICENSE
Classifier: Environment :: Console
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: System :: Archiving :: Backup
Requires-Python: >=3.12
Requires-Dist: rich>=15
Provides-Extra: dev
Requires-Dist: pytest-xdist>=3.8; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: tzdata; extra == 'dev'
Description-Content-Type: text/markdown

# resticbackups3 (`rbs3`)

A command-line tool that turns [restic](https://restic.net/) and S3-compatible storage
(Cloudflare R2 first) into "init once, then back up from cron":

```
rbs3 init <profile>
rbs3 backup <profile> --mail
rbs3 cronjob <profile> "0 4 * * *" --mail --silent
```

**Status: early development.** `rbs3 init` saves a profile; backups come next.

## Create a profile

```
rbs3 init <profile> --env-file creds.env --config settings.toml
```

Credentials can come from an env file (`--env-file`), this shell's environment (`--env-var`),
flags (`--restic-password=…`) or prompts. They combine, with flags first, then the env file,
then the environment, and anything still missing is asked for. Prefer the env file or the prompts:
secrets given as flags end up in shell history.

| Key | Required |
|---|---|
| `RESTIC_REPOSITORY` | yes, `s3:https://<account>.r2.cloudflarestorage.com/<bucket>[/<prefix>]` |
| `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `RESTIC_PASSWORD` | yes |
| `AWS_DEFAULT_REGION` | no, default `auto` |
| `SMTP_SERVER` | no; empty means no email reports |
| `SMTP_PORT`, `SMTP_SECURITY` (`starttls`/`ssl`) | defaults 587 / starttls |
| `SMTP_USER`, `SMTP_PASSWORD`, `MAIL_TO` | when `SMTP_SERVER` is set |
| `MAIL_FROM` | no, default `SMTP_USER` |

Without `--config`, the settings are asked for one by one. The profile is saved as
`/etc/resticbackups3/<profile>/.env` (root only, 0600) and `config.toml` (0644). After that you
may delete your own copies, but keep `RESTIC_PASSWORD` in a password manager: without it no
backup can be restored.

## Install

Needs Linux, Python 3.12 or newer, and restic 0.16 or newer.

| Tool | Install | Update |
|---|---|---|
| pipx | `pipx install resticbackups3` | `pipx upgrade resticbackups3` |
| uv | `uv tool install resticbackups3` | `uv tool upgrade resticbackups3` |
| pip (in a venv) | `pip install resticbackups3` | `pip install --upgrade resticbackups3` |

Run `rbs3` as your normal user; it asks for sudo itself when it needs it.

## Development

```
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]" ruff mypy
git config core.hooksPath .githooks   # blocks commits containing strings from notes/deny-list.txt
ruff check . && ruff format --check . && mypy && pytest -n auto
```

Pull request titles follow [Conventional Commits](https://www.conventionalcommits.org/); a merged
`feat:` or `fix:` publishes a release.

## License

MIT
