Skip to content

Commit a7694bb

Browse files
committed
refactor: rename imapbackup38.py to imapbackup.py and drop Python 2.x support
1 parent 76103a6 commit a7694bb

File tree

9 files changed

+743
-1540
lines changed

9 files changed

+743
-1540
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33

44
# Allow only what the image actually needs
5-
!imapbackup38.py
5+
!imapbackup.py
66
!Dockerfile
77
!.dockerignore
88
!LICENSE

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ RUN useradd -r -u 10001 -m app \
3030

3131
# Copy ONLY the requested script
3232
WORKDIR /app
33-
COPY imapbackup38.py /app/imapbackup38.py
34-
RUN chmod +x /app/imapbackup38.py
33+
COPY imapbackup.py /app/imapbackup.py
34+
RUN chmod +x /app/imapbackup.py
3535

3636
USER app
3737

@@ -41,10 +41,10 @@ VOLUME ["/data"]
4141

4242
# OCI labels
4343
LABEL org.opencontainers.image.title="imapbackup" \
44-
org.opencontainers.image.description="IMAP incremental backup tool packaged as a container. Runs imapbackup38.py only." \
44+
org.opencontainers.image.description="IMAP incremental backup tool packaged as a container" \
4545
org.opencontainers.image.licenses="MIT" \
4646
org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}" \
4747
org.opencontainers.image.revision="${GIT_SHA}"
4848

4949
# Use tini as entrypoint and forward args to the script
50-
ENTRYPOINT ["tini","--","/app/imapbackup38.py"]
50+
ENTRYPOINT ["tini","--","/app/imapbackup.py"]

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Somewhat to my surprise it was considered useful by quite a few people throughou
2323

2424
## Requirements
2525

26-
Python 2.x : `imapbackup.py` should work on Python 2.5 or any other 2.x version without any extra dependencies whatsoever.
27-
Python 3.x : `imapbackup38.py` requires python 3.8 and above.
26+
Python 3.x : `imapbackup.py` requires Python 3.6 and above (tested with 3.8+).
27+
28+
For Python 2.x support, see older versions of this repository.
2829

2930
## Contributing
3031

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ sudo yum install gnupg
5353
brew install gnupg
5454

5555
# Run backup
56-
python3 imapbackup38.py \
56+
python3 imapbackup.py \
5757
-s imap.example.com \
5858
-u user@example.com \
5959
-e

docs/backup-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ docker run --rm \
234234

235235
## Kubernetes
236236

237-
Run scheduled backups and ad-hoc restores in Kubernetes using the Docker image. The container entrypoint is `/app/imapbackup38.py`, so you pass flags as container args.
237+
Run scheduled backups and ad-hoc restores in Kubernetes using the Docker image. The container entrypoint is `/app/imapbackup.py`, so you pass flags as container args.
238238

239239
### Prerequisites
240240

@@ -357,7 +357,7 @@ spec:
357357
command: ["sh","-c"]
358358
args:
359359
- >-
360-
/app/imapbackup38.py
360+
/app/imapbackup.py
361361
-s imap.example.com -u user@example.com -p @/secrets/password -e --nospinner
362362
--s3-upload --s3-endpoint=https://s3.example.com --s3-bucket=email-backups
363363
--s3-access-key "$S3_ACCESS_KEY" --s3-secret-key "$S3_SECRET_KEY"

docs/gpg-key-import.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN apt-get update && \
2626
rm -rf /var/lib/apt/lists/*
2727

2828
# Copy application
29-
COPY imapbackup38.py /usr/local/bin/imapbackup
29+
COPY imapbackup.py /usr/local/bin/imapbackup
3030
RUN chmod +x /usr/local/bin/imapbackup
3131

3232
# Copy and import GPG public key (safe to include in image)
@@ -48,7 +48,7 @@ RUN apt-get update && \
4848
rm -rf /var/lib/apt/lists/*
4949

5050
# Copy application
51-
COPY imapbackup38.py /usr/local/bin/imapbackup
51+
COPY imapbackup.py /usr/local/bin/imapbackup
5252
RUN chmod +x /usr/local/bin/imapbackup
5353

5454
# Copy public key (will be auto-imported on first run)
@@ -245,7 +245,7 @@ Simple file-based approach:
245245
gpg --armor --export backup@example.com > ~/keys/backup-public.asc
246246

247247
# Use it in backup
248-
python3 imapbackup38.py \
248+
python3 imapbackup.py \
249249
-s imap.example.com \
250250
-u user@example.com \
251251
-e \

docs/python-setup.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pip install -r requirements.txt
3232
sudo apt install gnupg # Ubuntu/Debian
3333

3434
# Run backup
35-
python3 imapbackup38.py -s imap.example.com -u user@example.com -e
35+
python3 imapbackup.py -s imap.example.com -u user@example.com -e
3636

3737
# Deactivate when done
3838
deactivate
@@ -155,7 +155,7 @@ aws --version
155155
gpg --version
156156

157157
# Test the script
158-
python3 imapbackup38.py --help
158+
python3 imapbackup.py --help
159159
```
160160

161161
## Running Backups
@@ -167,7 +167,7 @@ python3 imapbackup38.py --help
167167
source venv/bin/activate
168168

169169
# Run backup
170-
python3 imapbackup38.py \
170+
python3 imapbackup.py \
171171
-s imap.example.com \
172172
-u user@example.com \
173173
-e
@@ -181,7 +181,7 @@ deactivate
181181
```bash
182182
source venv/bin/activate
183183

184-
python3 imapbackup38.py \
184+
python3 imapbackup.py \
185185
-s imap.example.com \
186186
-u user@example.com \
187187
-e \
@@ -199,7 +199,7 @@ deactivate
199199
```bash
200200
source venv/bin/activate
201201

202-
python3 imapbackup38.py \
202+
python3 imapbackup.py \
203203
-s imap.example.com \
204204
-u user@example.com \
205205
-e \
@@ -226,7 +226,7 @@ deactivate
226226
source /path/to/imapbackup/venv/bin/activate
227227

228228
# Run backup
229-
python3 /path/to/imapbackup/imapbackup38.py \
229+
python3 /path/to/imapbackup/imapbackup.py \
230230
-s imap.example.com \
231231
-u user@example.com \
232232
-p @/root/.imap_password \
@@ -267,7 +267,7 @@ After=network.target
267267
Type=oneshot
268268
User=backupuser
269269
WorkingDirectory=/home/backupuser/imapbackup
270-
ExecStart=/home/backupuser/imapbackup/venv/bin/python3 /home/backupuser/imapbackup/imapbackup38.py -s imap.example.com -u user@example.com -p @/home/backupuser/.imap_password -e -d /backups/email
270+
ExecStart=/home/backupuser/imapbackup/venv/bin/python3 /home/backupuser/imapbackup/imapbackup.py -s imap.example.com -u user@example.com -p @/home/backupuser/.imap_password -e -d /backups/email
271271

272272
[Install]
273273
WantedBy=multi-user.target
@@ -435,11 +435,11 @@ chmod -R u+rwX venv/
435435
```bash
436436
# ✓ Good
437437
source venv/bin/activate
438-
python3 imapbackup38.py ...
438+
python3 imapbackup.py ...
439439

440440
# ✗ Bad (pollutes system Python)
441441
sudo pip install awscli
442-
python3 imapbackup38.py ...
442+
python3 imapbackup.py ...
443443
```
444444

445445
### 2. Pin Dependency Versions
@@ -480,7 +480,7 @@ chmod 600 .env
480480

481481
# Load in script
482482
source .env
483-
python3 imapbackup38.py -s "$IMAP_SERVER" -u "$IMAP_USER" ...
483+
python3 imapbackup.py -s "$IMAP_SERVER" -u "$IMAP_USER" ...
484484
```
485485

486486
### 5. Separate Development and Production

0 commit comments

Comments
 (0)