I've rewritten my first #Python project, a small CLI #backup #program utilising #rsync, #rclone, #VeraCrypt etc. I'm sure there are many ways it could be improved, but it's my beginner's effort and works well for my own needs.
Please feel free to critique, share, modify, collaborate and all that good stuff:
https://gitlab.com/5am/backup
@syntax
Tip 1:
Design your programs so that you can always run them unmodified.
In this case that means externalizing 'sd_id', 'ssd_id', 'vc_pass'.
It could be provided by running your program with (named) parameters or by reading a config file or by reading environment variables.
If you must use hardcoded values, define them (as constants) at the top of the file.
Tip 2:
Add documentation and/or help text
Tip 3:
When you do the same thing multiple times, extract it into its own function.
@FreePietje
Thanks for all your tips, much appreciated.
@syntax
YW :)
Just found out that the chapter about DRY is available online: https://media.pragprog.com/titles/tpp20/dry.pdf
I've bought quite a few books at pragprog, including "The Pragmatic Programmer", as they're (really) good and DRM free :)