A utility for creating timestamped backups of Python scripts and projects
Project description
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
# Creates a backup like: myscript_20240320_143022.py
backup_script(__file__)
Project Backup with Multiple Paths
from fstrent_bkitup import backup_project
# Creates a zip file containing your script and all specified paths
# Example: myscript_20240320_143022.zip
backup_project(
__file__,
additional_paths=[
'lib',
'config',
'data/important.csv'
],
output_dir='backups'
)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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.2.tar.gz.
File metadata
- Download URL: fstrent_bkitup-0.1.2.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 |
383cbe0390cba4f9550784276cbe19e9a84474eecc35fbf7e34cbe09b6f87651
|
|
| MD5 |
b3f119b466abbaba927e8e5aea709f30
|
|
| BLAKE2b-256 |
b962559ac448856bdea4f4986ec6d70cc2adfa1989a9bd57862e4405d5cb6650
|
File details
Details for the file fstrent_bkitup-0.1.2-py3-none-any.whl.
File metadata
- Download URL: fstrent_bkitup-0.1.2-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 |
07e771631ab0724e7b81a90ddfc8d5aabfd2e82098647470d5c22583c869d5b7
|
|
| MD5 |
5b7ae8cad7e3f62c1dde0d03e93010e5
|
|
| BLAKE2b-256 |
077ef3863a5009fcb30915b5a598b0a753ad536bf6ec9f0aadb19bd248afa05c
|