You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+92Lines changed: 92 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,97 @@
1
1
# Changelog
2
2
3
+
## [0.9.7] - 2025-12-10
4
+
5
+
### Philosophy Change
6
+
7
+
Version 0.9.6 introduced SQLite for file tracking, blocked multiple workers, and added complex configuration. This was overengineered. func-to-web should be simple, fast, and reliable.
8
+
9
+
0.9.7 returns to simplicity with filesystem-based tracking, multiple workers support, and sensible defaults.
10
+
11
+
---
12
+
13
+
### Removed
14
+
15
+
-**SQLite Database**
16
+
- No more database files or locks
17
+
- File metadata encoded directly in filenames
18
+
- Format: `{uuid}___{timestamp}___{filename}`
19
+
20
+
-**Parameters Removed**
21
+
-`db_location` - no longer needed
22
+
-`cleanup_hours` - now hardcoded to 1 hour
23
+
24
+
-**Workers Limitation**
25
+
-`workers > 1` no longer blocked
26
+
- Scale vertically without restrictions
27
+
28
+
### Added
29
+
30
+
-**Automatic Upload Cleanup**
31
+
- New parameter: `auto_delete_uploads` (default: `True`)
32
+
- Uploaded files deleted after function completes
33
+
- Disable with `auto_delete_uploads=False` if needed
34
+
35
+
-**Directory Configuration**
36
+
- New parameter: `uploads_dir` (default: `"./uploads"`)
37
+
- New parameter: `returns_dir` (default: `"./returned_files"`)
38
+
39
+
### Changed
40
+
41
+
-**File Retention**
42
+
- Returned files deleted 1 hour after creation (hardcoded)
43
+
- No download tracking needed
44
+
- Cleanup runs every hour automatically
45
+
46
+
-**Multiple Workers**
47
+
- Now supported like any other Uvicorn option
48
+
- Each worker runs independent cleanup
49
+
- File operations are atomic, no conflicts
50
+
51
+
-**Architecture**
52
+
- Removed `db_manager.py` module
53
+
- Simplified `file_handler.py`
54
+
- Faster startup (no database initialization)
55
+
56
+
### Fixed
57
+
58
+
- Database lock errors eliminated
59
+
- Race conditions eliminated
60
+
- Improved startup performance
61
+
62
+
### Documentation
63
+
64
+
- Updated all docs to remove SQLite references
65
+
- Removed `db_location` and `cleanup_hours` from examples
0.9.6 was overengineered. 0.9.7 is simple again: no database, automatic cleanup, multiple workers supported. Filesystem operations are fast, atomic, and sufficient.
If a file is manually deleted from disk but still exists in the database, the system automatically detects this and cleans up the broken reference when someone tries to download it.
123
+
If a file is manually deleted from disk, the system automatically detects this when someone tries to download it and returns a "File expired" error.
run(process_image) # auto_delete_uploads=True by default
99
+
```
92
100
93
-
| OS | Automatic Cleanup | When |
94
-
|----|-------------------|------|
95
-
|**Linux**| ✅ Yes | On restart (and often after 10 days) |
96
-
|**macOS**| ✅ Yes | On restart (and after 3 days unused) |
97
-
|**Windows**| ⚠️ Maybe | Only if Storage Sense is enabled (disabled by default) |
101
+
**Disable auto-delete** if you need files to persist:
102
+
```python
103
+
run(process_image, auto_delete_uploads=False)
104
+
```
105
+
106
+
**Configure upload directory:**
107
+
```python
108
+
run(
109
+
process_image,
110
+
uploads_dir="/path/to/uploads",
111
+
auto_delete_uploads=True
112
+
)
113
+
```
98
114
99
-
**Warning for Windows users:** Files in `%TEMP%` can accumulate indefinitely unless you manually run Disk Cleanup or enable Storage Sense.
115
+
## File Cleanup for Uploaded Files
116
+
117
+
**By default**, func-to-web **automatically cleans up** uploaded files after processing (`auto_delete_uploads=True`). This is the recommended behavior.
118
+
119
+
**If you disable auto-delete** (`auto_delete_uploads=False`), files remain in the uploads directory **indefinitely** until you manually delete them. The OS will **not** clean them automatically.
100
120
101
121
### Cleanup Options
102
122
103
-
**Option 1: Let the OS handle it** (simple, but unreliable on Windows)
123
+
**Option 1: Use auto-delete (default, recommended)**
104
124
```python
105
125
defprocess_image(image: ImageFile):
106
126
img = Image.open(image)
107
-
return img.filter(ImageFilter.BLUR)
108
-
# File remains in temp directory
127
+
result = img.filter(ImageFilter.BLUR)
128
+
return result
129
+
# File automatically deleted after processing
130
+
131
+
run(process_image) # auto_delete_uploads=True by default
109
132
```
110
133
111
-
**Option 2: Manual cleanup** (recommended for production)
- You need to access files after the function completes
147
+
- Multiple functions need to process the same file
148
+
- You're implementing your own cleanup logic
149
+
150
+
**If auto-delete is disabled**, you must manually clean up:
125
151
```python
126
152
import os
153
+
from pathlib import Path
127
154
128
-
defprocess_image(image: ImageFile):
129
-
withopen(image, 'rb') as f:
130
-
data = f.read()
131
-
os.unlink(image) # Delete immediately after reading
132
-
# Process data in memory...
155
+
# Manual cleanup script
156
+
uploads_dir = Path("./uploads")
157
+
forfilein uploads_dir.glob("upload_*"):
158
+
os.unlink(file)
133
159
```
134
160
135
-
**Recommendation:**For production applications, especially on Windows, implement manual cleanup (Option 2) to avoid disk space issues.
161
+
**Recommendation:**Use the default `auto_delete_uploads=True` unless you have a specific reason to preserve uploaded files.
136
162
137
163
### Returned Files (Different Behavior)
138
164
139
-
Files you **return** using `FileResponse` are handled differently and **are** automatically cleaned up by func-to-web after 24 hours (configurable). See [File Downloads](downloads.md) for details.
165
+
Files you **return** using `FileResponse` are handled differently and **are** automatically cleaned up by func-to-web after 1 hour (hardcoded). See [File Downloads](downloads.md) for details.
0 commit comments