Backup Utils
A Python utility for creating timestamped backups of Python scripts and projects.
Installation
pip install fstrent_bkitup
Usage
Backing up a single script
Place this at the very top of your script, right after your imports:
# your_script.py
import sys
import os
# ... your other imports ...
from fstrent_bkitup import backup_script
# Create backup before running the script
backup_script(__file__)
# Rest of your script below
def main():
# your code here
pass
if __name__ == "__main__":
main()
Backing up a project
For backing up multiple files or entire directories, use backup_project:
# your_script.py
import sys
import os
# ... your other imports ...
from fstrent_bkitup import backup_project
# Create backup of script and project files before running
backup_project(
__file__, # current script
additional_paths=[
'lib', # backup entire lib directory
'config.json', # backup specific files
'src' # backup src directory
],
output_dir='backups' # where to store the zip files
)
# Rest of your script below
def main():
# your code here
pass
if __name__ == "__main__":
main()
Features
- Create timestamped backups of individual Python scripts
- Create ZIP archives of entire projects including specified directories and files
- Preserve file metadata
- Configurable output directory
Backup Naming
- Single script backups:
original_name_YYYYMMDD_HHMMSS.py - Project backups:
original_name_YYYYMMDD_HHMMSS.zip
Examples
Basic Script Backup
from fstrent_bkitup import backup_script as bks
# Creates a backup in ./bkups/myscript_20240320_143022.py
bks(__file__)
# Or specify custom backup directory
bks(__file__, output_dir='my_backups')
Project Backup with Multiple Paths
from fstrent_bkitup import backup_project as bkp
# Creates a zip file in ./bkups/myscript_20240320_143022.zip
bkp(
__file__,
additional_paths=[
'lib',
'config',
'data/important.csv'
]
)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fstrent_bkitup-0.1.4.tar.gz
(4.7 kB
view details)
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 fstrent_bkitup-0.1.4.tar.gz.
File metadata
- Download URL: fstrent_bkitup-0.1.4.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc441f00c4d6b2af653ef7dede2373ef725fef70b46cd1ce3fb28027d528e5ba
|
|
| MD5 |
20f81f9b96139b4df3d826a3ae47b50d
|
|
| BLAKE2b-256 |
75bdecadb4cd82f18c395e5642fcf7dca2f57f375059193e4fa873455e0db434
|
File details
Details for the file fstrent_bkitup-0.1.4-py3-none-any.whl.
File metadata
- Download URL: fstrent_bkitup-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f9e0ba7b72d6ee71ff49a5f9ba537009533182cc5af6cb40bc958916670f657
|
|
| MD5 |
11f57dfcacdda3ff281519eea0aa4d94
|
|
| BLAKE2b-256 |
cfebb8f3785fa3b31fdfec5f6d6405914aef6279a90ee9d009f4276e0d4996b5
|