I’ve just released resticpy, a minimal Python wrapper for the restic CLI.
I know some other authors have created Python wrappers, but those solutions all act as wrapper scripts rather than expose an API. I wanted a solution that provided a nice API so that a developer could decide how they wanted to use restic, so that’s what resticpy is.
It’s easy to get started with resticpy:
printf "mysecretpass" > password.txt pip install resticpy
import restic restic.repository = '/tmp/backup1' restic.password_file = 'password.txt' # Initialize a repo restic.init() # Back up a file restic.backup(paths=['some-file.txt']) # Restore the backup to a new location restic.restore(snapshot_id='latest', target_dir='~/restored')
- The API is fully documented with plenty of example code
- The API semantics closely mirror the CLI semantics, so they should be intuitive to anyone familiar with restic
- The code is thoroughly unit tested (95% coverage)
- The code includes continuous integration that automatically exercises the code through the unit tests and end-to-end tests against the real restic binaries
- The code is open-source, licensed under the permissive MIT license
I’m currently using resticpy for my daily backup script, and I hope it can be useful to others. I’m happy to answer any questions or take any feedback.