winebox 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. {winebox-0.1.2 → winebox-0.1.4}/PKG-INFO +37 -1
  2. {winebox-0.1.2 → winebox-0.1.4}/README.md +32 -0
  3. winebox-0.1.4/docs/_static/screenshots/cellar.png +0 -0
  4. winebox-0.1.4/docs/_static/screenshots/checkin.png +0 -0
  5. winebox-0.1.4/docs/_static/screenshots/dashboard.png +0 -0
  6. winebox-0.1.4/docs/_static/screenshots/search.png +0 -0
  7. {winebox-0.1.2 → winebox-0.1.4}/docs/index.md +9 -5
  8. winebox-0.1.4/docs/screenshots/cellar.png +0 -0
  9. winebox-0.1.4/docs/screenshots/checkin.png +0 -0
  10. winebox-0.1.4/docs/screenshots/dashboard.png +0 -0
  11. winebox-0.1.4/docs/screenshots/login.png +0 -0
  12. {winebox-0.1.2 → winebox-0.1.4}/docs/user-guide.md +68 -4
  13. {winebox-0.1.2 → winebox-0.1.4}/pyproject.toml +5 -1
  14. winebox-0.1.4/tasks.py +454 -0
  15. winebox-0.1.4/tests/test_checkin_e2e.py +342 -0
  16. winebox-0.1.4/tests/test_wines.py +385 -0
  17. {winebox-0.1.2 → winebox-0.1.4}/uv.lock +343 -1
  18. {winebox-0.1.2 → winebox-0.1.4}/winebox/__init__.py +1 -1
  19. winebox-0.1.4/winebox/config.py +78 -0
  20. {winebox-0.1.2 → winebox-0.1.4}/winebox/main.py +48 -1
  21. {winebox-0.1.2 → winebox-0.1.4}/winebox/models/user.py +2 -0
  22. winebox-0.1.4/winebox/routers/auth.py +204 -0
  23. winebox-0.1.4/winebox/routers/wines.py +482 -0
  24. winebox-0.1.4/winebox/services/image_storage.py +219 -0
  25. {winebox-0.1.2 → winebox-0.1.4}/winebox/services/ocr.py +37 -0
  26. winebox-0.1.4/winebox/services/vision.py +278 -0
  27. {winebox-0.1.2 → winebox-0.1.4}/winebox/static/css/style.css +545 -0
  28. winebox-0.1.4/winebox/static/favicon.svg +22 -0
  29. winebox-0.1.4/winebox/static/index.html +502 -0
  30. {winebox-0.1.2 → winebox-0.1.4}/winebox/static/js/app.js +583 -8
  31. winebox-0.1.2/tasks.py +0 -223
  32. winebox-0.1.2/tests/test_wines.py +0 -212
  33. winebox-0.1.2/winebox/config.py +0 -43
  34. winebox-0.1.2/winebox/routers/auth.py +0 -90
  35. winebox-0.1.2/winebox/routers/wines.py +0 -287
  36. winebox-0.1.2/winebox/services/image_storage.py +0 -90
  37. winebox-0.1.2/winebox/static/index.html +0 -271
  38. {winebox-0.1.2 → winebox-0.1.4}/.github/workflows/ci.yml +0 -0
  39. {winebox-0.1.2 → winebox-0.1.4}/.github/workflows/publish.yml +0 -0
  40. {winebox-0.1.2 → winebox-0.1.4}/.gitignore +0 -0
  41. {winebox-0.1.2 → winebox-0.1.4}/.python-version +0 -0
  42. {winebox-0.1.2 → winebox-0.1.4}/LICENSE +0 -0
  43. {winebox-0.1.2 → winebox-0.1.4}/docs/api-reference.md +0 -0
  44. {winebox-0.1.2 → winebox-0.1.4}/docs/conf.py +0 -0
  45. {winebox-0.1.2 → winebox-0.1.4}/tests/__init__.py +0 -0
  46. {winebox-0.1.2 → winebox-0.1.4}/tests/conftest.py +0 -0
  47. {winebox-0.1.2 → winebox-0.1.4}/tests/test_ocr.py +0 -0
  48. {winebox-0.1.2 → winebox-0.1.4}/tests/test_search.py +0 -0
  49. {winebox-0.1.2 → winebox-0.1.4}/tests/test_transactions.py +0 -0
  50. {winebox-0.1.2 → winebox-0.1.4}/winebox/cli/__init__.py +0 -0
  51. {winebox-0.1.2 → winebox-0.1.4}/winebox/cli/server.py +0 -0
  52. {winebox-0.1.2 → winebox-0.1.4}/winebox/cli/user_admin.py +0 -0
  53. {winebox-0.1.2 → winebox-0.1.4}/winebox/database.py +0 -0
  54. {winebox-0.1.2 → winebox-0.1.4}/winebox/models/__init__.py +0 -0
  55. {winebox-0.1.2 → winebox-0.1.4}/winebox/models/inventory.py +0 -0
  56. {winebox-0.1.2 → winebox-0.1.4}/winebox/models/transaction.py +0 -0
  57. {winebox-0.1.2 → winebox-0.1.4}/winebox/models/wine.py +0 -0
  58. {winebox-0.1.2 → winebox-0.1.4}/winebox/routers/__init__.py +0 -0
  59. {winebox-0.1.2 → winebox-0.1.4}/winebox/routers/cellar.py +0 -0
  60. {winebox-0.1.2 → winebox-0.1.4}/winebox/routers/search.py +0 -0
  61. {winebox-0.1.2 → winebox-0.1.4}/winebox/routers/transactions.py +0 -0
  62. {winebox-0.1.2 → winebox-0.1.4}/winebox/schemas/__init__.py +0 -0
  63. {winebox-0.1.2 → winebox-0.1.4}/winebox/schemas/transaction.py +0 -0
  64. {winebox-0.1.2 → winebox-0.1.4}/winebox/schemas/wine.py +0 -0
  65. {winebox-0.1.2 → winebox-0.1.4}/winebox/services/__init__.py +0 -0
  66. {winebox-0.1.2 → winebox-0.1.4}/winebox/services/auth.py +0 -0
  67. {winebox-0.1.2 → winebox-0.1.4}/winebox/services/wine_parser.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winebox
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Wine Cellar Management Application with OCR label scanning
5
5
  Project-URL: Homepage, https://github.com/jdrumgoole/winebox
6
6
  Project-URL: Repository, https://github.com/jdrumgoole/winebox
@@ -22,6 +22,7 @@ Classifier: Topic :: Home Automation
22
22
  Requires-Python: >=3.11
23
23
  Requires-Dist: aiofiles>=23.0.0
24
24
  Requires-Dist: aiosqlite>=0.19.0
25
+ Requires-Dist: anthropic>=0.40.0
25
26
  Requires-Dist: bcrypt<4.1.0,>=4.0.0
26
27
  Requires-Dist: fastapi>=0.109.0
27
28
  Requires-Dist: jinja2>=3.1.0
@@ -32,6 +33,7 @@ Requires-Dist: pydantic>=2.0.0
32
33
  Requires-Dist: pytesseract>=0.3.10
33
34
  Requires-Dist: python-jose[cryptography]>=3.3.0
34
35
  Requires-Dist: python-multipart>=0.0.6
36
+ Requires-Dist: slowapi>=0.1.9
35
37
  Requires-Dist: sqlalchemy>=2.0.0
36
38
  Requires-Dist: uvicorn[standard]>=0.27.0
37
39
  Provides-Extra: dev
@@ -40,6 +42,8 @@ Requires-Dist: httpx>=0.26.0; extra == 'dev'
40
42
  Requires-Dist: invoke>=2.2.0; extra == 'dev'
41
43
  Requires-Dist: myst-parser>=2.0.0; extra == 'dev'
42
44
  Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
45
+ Requires-Dist: pytest-playwright>=0.4.0; extra == 'dev'
46
+ Requires-Dist: pytest-xdist>=3.5.0; extra == 'dev'
43
47
  Requires-Dist: pytest>=8.0.0; extra == 'dev'
44
48
  Requires-Dist: sphinx>=7.0.0; extra == 'dev'
45
49
  Description-Content-Type: text/markdown
@@ -173,6 +177,38 @@ Images are served via the API at `/api/images/{filename}`.
173
177
 
174
178
  **Note:** The `data/` directory is excluded from git (see `.gitignore`). Make sure to back up this directory to preserve your wine collection data.
175
179
 
180
+ ## Label Scanning
181
+
182
+ WineBox uses AI-powered label scanning to extract wine information from photos.
183
+
184
+ ### Claude Vision (Recommended)
185
+
186
+ For best results, configure Claude Vision by setting your Anthropic API key:
187
+
188
+ ```bash
189
+ export ANTHROPIC_API_KEY=your-api-key
190
+ # or
191
+ export WINEBOX_ANTHROPIC_API_KEY=your-api-key
192
+ ```
193
+
194
+ Claude Vision provides intelligent label analysis that:
195
+ - Handles decorative and artistic fonts
196
+ - Understands wine-specific terminology
197
+ - Extracts structured data (winery, vintage, grape variety, region, etc.)
198
+ - Works with curved or angled text
199
+
200
+ ### Tesseract OCR (Fallback)
201
+
202
+ If no Anthropic API key is configured, WineBox falls back to Tesseract OCR. This requires Tesseract to be installed on your system:
203
+
204
+ ```bash
205
+ # macOS
206
+ brew install tesseract
207
+
208
+ # Ubuntu/Debian
209
+ sudo apt-get install tesseract-ocr
210
+ ```
211
+
176
212
  ## Authentication
177
213
 
178
214
  WineBox requires authentication for all API endpoints (except `/health`).
@@ -127,6 +127,38 @@ Images are served via the API at `/api/images/{filename}`.
127
127
 
128
128
  **Note:** The `data/` directory is excluded from git (see `.gitignore`). Make sure to back up this directory to preserve your wine collection data.
129
129
 
130
+ ## Label Scanning
131
+
132
+ WineBox uses AI-powered label scanning to extract wine information from photos.
133
+
134
+ ### Claude Vision (Recommended)
135
+
136
+ For best results, configure Claude Vision by setting your Anthropic API key:
137
+
138
+ ```bash
139
+ export ANTHROPIC_API_KEY=your-api-key
140
+ # or
141
+ export WINEBOX_ANTHROPIC_API_KEY=your-api-key
142
+ ```
143
+
144
+ Claude Vision provides intelligent label analysis that:
145
+ - Handles decorative and artistic fonts
146
+ - Understands wine-specific terminology
147
+ - Extracts structured data (winery, vintage, grape variety, region, etc.)
148
+ - Works with curved or angled text
149
+
150
+ ### Tesseract OCR (Fallback)
151
+
152
+ If no Anthropic API key is configured, WineBox falls back to Tesseract OCR. This requires Tesseract to be installed on your system:
153
+
154
+ ```bash
155
+ # macOS
156
+ brew install tesseract
157
+
158
+ # Ubuntu/Debian
159
+ sudo apt-get install tesseract-ocr
160
+ ```
161
+
130
162
  ## Authentication
131
163
 
132
164
  WineBox requires authentication for all API endpoints (except `/health`).
@@ -6,7 +6,7 @@ Welcome to WineBox, a wine cellar management application with OCR label scanning
6
6
 
7
7
  WineBox helps you manage your wine collection by:
8
8
 
9
- - **Scanning wine labels** using OCR to automatically extract wine details
9
+ - **Scanning wine labels** using Claude Vision AI (with Tesseract OCR fallback) to automatically extract wine details
10
10
  - **Tracking inventory** with check-in and check-out functionality
11
11
  - **Searching your cellar** by vintage, grape variety, region, and more
12
12
  - **Maintaining history** of all bottle movements
@@ -23,10 +23,14 @@ cd winebox
23
23
  # Install dependencies
24
24
  uv sync --all-extras
25
25
 
26
- # Install Tesseract OCR (macOS)
26
+ # Set up Claude Vision (recommended for better label scanning)
27
+ # Add your Anthropic API key to .env file:
28
+ echo "WINEBOX_ANTHROPIC_API_KEY=your-api-key-here" > .env
29
+
30
+ # Install Tesseract OCR as fallback (macOS)
27
31
  brew install tesseract
28
32
 
29
- # Install Tesseract OCR (Ubuntu/Debian)
33
+ # Install Tesseract OCR as fallback (Ubuntu/Debian)
30
34
  sudo apt-get install tesseract-ocr
31
35
  ```
32
36
 
@@ -70,8 +74,8 @@ api-reference
70
74
  ### Check-In Process
71
75
 
72
76
  1. Upload front label image (required) and back label (optional)
73
- 2. OCR automatically extracts text from the labels
74
- 3. Wine parser identifies: vintage, winery, grape variety, region, country
77
+ 2. Claude Vision AI (or Tesseract OCR fallback) automatically analyzes the labels
78
+ 3. Form fields are instantly populated with: wine name, vintage, winery, grape variety, region, country, alcohol %
75
79
  4. Review and edit auto-detected values
76
80
  5. Specify quantity of bottles
77
81
  6. Wine is added to your cellar with a CHECK_IN transaction
Binary file
@@ -27,16 +27,25 @@ The check-in process adds bottles to your cellar inventory.
27
27
  2. **Upload the front label image** (required):
28
28
  - Click the file input or drag and drop an image
29
29
  - Supported formats: JPG, PNG, GIF, WebP
30
+ - Form fields are automatically populated as soon as the image is uploaded
30
31
  3. **Upload the back label image** (optional):
31
32
  - Back labels often contain additional details
33
+ - Scanning updates with information from both labels
32
34
  4. **Review auto-detected values**:
33
- - The OCR system will attempt to extract wine details
34
- - Edit any incorrect values
35
+ - Claude Vision AI (or Tesseract OCR fallback) extracts wine details
36
+ - A toast notification shows which scanning engine was used
37
+ - Edit any incorrect values as needed
38
+ - View raw label text in the collapsible "Raw Label Text" section
35
39
  5. **Set the quantity**:
36
40
  - Enter the number of bottles you're adding
37
41
  6. **Add notes** (optional):
38
42
  - Where you purchased it, price, occasion, etc.
39
43
  7. Click **Check In Wine**
44
+ 8. **Review in confirmation dialog**:
45
+ - A confirmation dialog appears with all editable fields
46
+ - Make any final adjustments to wine details
47
+ - View raw label text by expanding the "Raw Label Text" section
48
+ - Click **Confirm** to save or **Cancel** to return to the form
40
49
 
41
50
  ### Using the API
42
51
 
@@ -150,13 +159,15 @@ Shows the last 10 transactions with quick details.
150
159
 
151
160
  ### Taking Good Label Photos
152
161
 
153
- For best OCR results:
162
+ For best scanning results with Claude Vision:
154
163
 
155
164
  1. **Good lighting**: Natural light or well-lit room
156
165
  2. **Flat surface**: Lay the bottle on its side or hold label flat
157
166
  3. **Focus**: Ensure text is sharp and readable
158
167
  4. **Full label**: Capture the entire label in frame
159
- 5. **High resolution**: Higher resolution improves OCR accuracy
168
+ 5. **High resolution**: Higher resolution improves accuracy
169
+
170
+ Claude Vision provides intelligent label analysis that understands wine label context. If the Anthropic API key is not configured, the app falls back to Tesseract OCR.
160
171
 
161
172
  ### Organizing Your Cellar
162
173
 
@@ -172,3 +183,56 @@ Your data is stored in:
172
183
  - **Images**: `data/images/`
173
184
 
174
185
  Back up these files regularly to preserve your cellar records.
186
+
187
+ ## Development
188
+
189
+ ### Running Tests
190
+
191
+ WineBox has both unit tests and end-to-end (E2E) browser tests.
192
+
193
+ ```bash
194
+ # Run all tests (unit + E2E)
195
+ invoke test
196
+
197
+ # Run only unit tests (fast, no server required)
198
+ invoke test-unit
199
+
200
+ # Run only E2E tests (requires running server)
201
+ invoke test-e2e
202
+
203
+ # Run E2E tests with more workers for faster execution
204
+ invoke test-e2e --workers 8
205
+ ```
206
+
207
+ **Note**: E2E tests use Playwright for browser automation and create unique test users for parallel execution. The server must be running (`invoke start-background`) before running E2E tests.
208
+
209
+ ### Invoke Tasks
210
+
211
+ Common development tasks:
212
+
213
+ ```bash
214
+ # Server management
215
+ invoke start # Start server in foreground
216
+ invoke start-background # Start server in background
217
+ invoke stop # Stop the server
218
+ invoke restart # Restart the server
219
+ invoke status # Check server status
220
+ invoke logs # View server logs
221
+
222
+ # Database management
223
+ invoke init-db # Initialize database
224
+ invoke purge --force # Delete database and images
225
+ invoke purge-wines --force # Delete wines but keep users
226
+
227
+ # User management
228
+ invoke add-user <username> --password <pass>
229
+ invoke remove-user <username> --force
230
+ invoke list-users
231
+ invoke disable-user <username>
232
+ invoke enable-user <username>
233
+ invoke passwd <username> --password <newpass>
234
+
235
+ # Documentation
236
+ invoke docs-build # Build Sphinx documentation
237
+ invoke docs-serve # Build and serve docs locally
238
+ ```
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "winebox"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Wine Cellar Management Application with OCR label scanning"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -36,6 +36,8 @@ dependencies = [
36
36
  "passlib>=1.7.4",
37
37
  "bcrypt>=4.0.0,<4.1.0",
38
38
  "python-jose[cryptography]>=3.3.0",
39
+ "anthropic>=0.40.0",
40
+ "slowapi>=0.1.9",
39
41
  ]
40
42
 
41
43
  [project.urls]
@@ -47,6 +49,8 @@ Issues = "https://github.com/jdrumgoole/winebox/issues"
47
49
  dev = [
48
50
  "pytest>=8.0.0",
49
51
  "pytest-asyncio>=0.23.0",
52
+ "pytest-playwright>=0.4.0",
53
+ "pytest-xdist>=3.5.0",
50
54
  "httpx>=0.26.0",
51
55
  "invoke>=2.2.0",
52
56
  "sphinx>=7.0.0",