winebox 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,283 @@
1
+ Metadata-Version: 2.4
2
+ Name: winebox
3
+ Version: 0.1.0
4
+ Summary: Wine Cellar Management Application with OCR label scanning
5
+ Project-URL: Homepage, https://github.com/jdrumgoole/winebox
6
+ Project-URL: Repository, https://github.com/jdrumgoole/winebox
7
+ Project-URL: Issues, https://github.com/jdrumgoole/winebox/issues
8
+ Author-email: Joe Drumgoole <joe@joedrumgoole.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: cellar,fastapi,inventory,ocr,wine
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Framework :: FastAPI
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Home Automation
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: aiofiles>=23.0.0
24
+ Requires-Dist: aiosqlite>=0.19.0
25
+ Requires-Dist: bcrypt<4.1.0,>=4.0.0
26
+ Requires-Dist: fastapi>=0.109.0
27
+ Requires-Dist: jinja2>=3.1.0
28
+ Requires-Dist: passlib>=1.7.4
29
+ Requires-Dist: pillow>=10.0.0
30
+ Requires-Dist: pydantic-settings>=2.0.0
31
+ Requires-Dist: pydantic>=2.0.0
32
+ Requires-Dist: pytesseract>=0.3.10
33
+ Requires-Dist: python-jose[cryptography]>=3.3.0
34
+ Requires-Dist: python-multipart>=0.0.6
35
+ Requires-Dist: sqlalchemy>=2.0.0
36
+ Requires-Dist: uvicorn[standard]>=0.27.0
37
+ Provides-Extra: dev
38
+ Requires-Dist: greenlet>=3.0.0; extra == 'dev'
39
+ Requires-Dist: httpx>=0.26.0; extra == 'dev'
40
+ Requires-Dist: invoke>=2.2.0; extra == 'dev'
41
+ Requires-Dist: myst-parser>=2.0.0; extra == 'dev'
42
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
43
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
44
+ Requires-Dist: sphinx>=7.0.0; extra == 'dev'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # WineBox
48
+
49
+ A wine cellar management application with OCR label scanning.
50
+
51
+ ## Features
52
+
53
+ - **Label Scanning**: Upload wine label images for automatic text extraction via OCR
54
+ - **Inventory Tracking**: Check-in and check-out bottles with full history
55
+ - **Smart Parsing**: Automatically identifies vintage, grape variety, region, and more
56
+ - **Search**: Find wines by any criteria
57
+ - **Web Interface**: Simple, mobile-friendly interface
58
+
59
+ ## Quick Start
60
+
61
+ ### Prerequisites
62
+
63
+ - Python 3.11+
64
+ - [Tesseract OCR](https://github.com/tesseract-ocr/tesseract)
65
+
66
+ ### Installation
67
+
68
+ **From PyPI:**
69
+ ```bash
70
+ pip install winebox
71
+ ```
72
+
73
+ **From source:**
74
+ ```bash
75
+ # Clone the repository
76
+ git clone https://github.com/jdrumgoole/winebox.git
77
+ cd winebox
78
+
79
+ # Install dependencies
80
+ uv sync --all-extras
81
+
82
+ # Install Tesseract OCR
83
+ # macOS:
84
+ brew install tesseract
85
+
86
+ # Ubuntu/Debian:
87
+ sudo apt-get install tesseract-ocr
88
+ ```
89
+
90
+ ### Running the Server
91
+
92
+ ```bash
93
+ # Development mode with auto-reload
94
+ invoke start --reload
95
+
96
+ # Background mode
97
+ invoke start-background
98
+
99
+ # Check status
100
+ invoke status
101
+
102
+ # Stop server
103
+ invoke stop
104
+ ```
105
+
106
+ ### Access the Application
107
+
108
+ - **Web Interface**: http://localhost:8000/static/index.html
109
+ - **API Documentation**: http://localhost:8000/docs
110
+ - **Health Check**: http://localhost:8000/health
111
+
112
+ ## Usage
113
+
114
+ ### Check In Wine
115
+
116
+ 1. Navigate to the Check In page
117
+ 2. Upload front label image (required)
118
+ 3. Optionally upload back label image
119
+ 4. Review/edit auto-detected wine details
120
+ 5. Set quantity and add notes
121
+ 6. Click "Check In Wine"
122
+
123
+ ### Check Out Wine
124
+
125
+ 1. Go to the Cellar view
126
+ 2. Click "Check Out" on a wine card
127
+ 3. Enter quantity to remove
128
+ 4. Add optional notes (tasting notes, occasion)
129
+ 5. Confirm checkout
130
+
131
+ ### Search
132
+
133
+ Use the Search page to find wines by:
134
+ - Text search (name, winery, region)
135
+ - Vintage year
136
+ - Grape variety
137
+ - Region or country
138
+ - Stock status
139
+
140
+ ## API
141
+
142
+ Full REST API available at `/api`:
143
+
144
+ | Endpoint | Method | Description |
145
+ |----------|--------|-------------|
146
+ | `/api/wines/checkin` | POST | Add wine to cellar |
147
+ | `/api/wines/{id}/checkout` | POST | Remove wine from cellar |
148
+ | `/api/wines` | GET | List all wines |
149
+ | `/api/wines/{id}` | GET | Get wine details |
150
+ | `/api/cellar` | GET | Current inventory |
151
+ | `/api/cellar/summary` | GET | Cellar statistics |
152
+ | `/api/transactions` | GET | Transaction history |
153
+ | `/api/search` | GET | Search wines |
154
+
155
+ See `/docs` for interactive API documentation.
156
+
157
+ ## Data Storage
158
+
159
+ ### Database
160
+
161
+ The SQLite database is stored at `data/winebox.db` by default. This can be configured via the `WINEBOX_DATABASE_URL` environment variable.
162
+
163
+ ### Images
164
+
165
+ Wine label images are stored in the `data/images/` directory by default. Each image is saved with a UUID filename to avoid conflicts.
166
+
167
+ | Item | Default Location | Environment Variable |
168
+ |------|------------------|---------------------|
169
+ | Database | `data/winebox.db` | `WINEBOX_DATABASE_URL` |
170
+ | Images | `data/images/` | `WINEBOX_IMAGE_STORAGE_PATH` |
171
+
172
+ Images are served via the API at `/api/images/{filename}`.
173
+
174
+ **Note:** The `data/` directory is excluded from git (see `.gitignore`). Make sure to back up this directory to preserve your wine collection data.
175
+
176
+ ## Authentication
177
+
178
+ WineBox requires authentication for all API endpoints (except `/health`).
179
+
180
+ ### Creating Users
181
+
182
+ Use the `winebox-admin` command to manage users:
183
+
184
+ ```bash
185
+ # Create an admin user
186
+ uv run winebox-admin add admin --email admin@example.com --admin --password yourpassword
187
+
188
+ # Create a regular user
189
+ uv run winebox-admin add username --email user@example.com --password yourpassword
190
+
191
+ # List all users
192
+ uv run winebox-admin list
193
+
194
+ # Disable/enable a user
195
+ uv run winebox-admin disable username
196
+ uv run winebox-admin enable username
197
+
198
+ # Change password
199
+ uv run winebox-admin passwd username --password newpassword
200
+
201
+ # Remove a user
202
+ uv run winebox-admin remove username
203
+ ```
204
+
205
+ ### Server Management
206
+
207
+ Use the `winebox-server` command to manage the server:
208
+
209
+ ```bash
210
+ # Start server (foreground)
211
+ uv run winebox-server start --foreground
212
+
213
+ # Start server (background)
214
+ uv run winebox-server start
215
+
216
+ # Stop server
217
+ uv run winebox-server stop
218
+
219
+ # Restart server
220
+ uv run winebox-server restart
221
+
222
+ # Check status
223
+ uv run winebox-server status
224
+ ```
225
+
226
+ ### API Authentication
227
+
228
+ The API uses JWT bearer tokens. To authenticate:
229
+
230
+ 1. POST to `/api/auth/token` with `username` and `password` (form-urlencoded)
231
+ 2. Include the returned token in subsequent requests: `Authorization: Bearer <token>`
232
+
233
+ Tokens expire after 24 hours.
234
+
235
+ ## Development
236
+
237
+ ### Running Tests
238
+
239
+ ```bash
240
+ # Run all tests
241
+ invoke test
242
+
243
+ # With verbose output
244
+ invoke test --verbose
245
+
246
+ # With coverage
247
+ invoke test --coverage
248
+ ```
249
+
250
+ ### Project Structure
251
+
252
+ ```
253
+ winebox/
254
+ ├── winebox/ # Application package
255
+ │ ├── main.py # FastAPI app
256
+ │ ├── models/ # Database models
257
+ │ ├── schemas/ # API schemas
258
+ │ ├── routers/ # API endpoints
259
+ │ ├── services/ # Business logic
260
+ │ └── static/ # Web interface
261
+ ├── tests/ # Test suite
262
+ ├── docs/ # Documentation
263
+ └── tasks.py # Build tasks
264
+ ```
265
+
266
+ ### Building Documentation
267
+
268
+ ```bash
269
+ invoke docs-build
270
+ invoke docs-serve
271
+ ```
272
+
273
+ ## Tech Stack
274
+
275
+ - **FastAPI**: Web framework
276
+ - **SQLAlchemy**: ORM
277
+ - **SQLite**: Database
278
+ - **Tesseract**: OCR engine
279
+ - **Vanilla JS**: Frontend (no frameworks)
280
+
281
+ ## License
282
+
283
+ MIT License
@@ -0,0 +1,34 @@
1
+ winebox/__init__.py,sha256=bAd30zPrCJ2BYtbyxoRUvXt6m6Z4ivEOSdT3HD5uyos,75
2
+ winebox/config.py,sha256=IJ9NzNyX0_g7ji3EmVxZRRL0csB7N5iGxsYStO25hI8,1007
3
+ winebox/database.py,sha256=jTdf9mb48D8644THo6Mx6lHCKDFlAZ18P8Dvuk2eROI,1128
4
+ winebox/main.py,sha256=wlXrBwMvJQhG3g8mmOGWp-QbEEbR805SaElBryR61t0,2398
5
+ winebox/cli/__init__.py,sha256=FOUoclklBXVfsfON3ohA8v_coJ9p5LSbVYvTucyXieg,29
6
+ winebox/cli/server.py,sha256=aN4znSvQRCZFZlQ1gcGag7OCFngwzUJdi084ZdNrnNI,8416
7
+ winebox/cli/user_admin.py,sha256=xwkd4-YN9uL6hX7-AuiDUNekG7x45l1lKor7AsOUxds,8549
8
+ winebox/models/__init__.py,sha256=2avQWHx53-5Z6jnzFlhh5u10Dw99w7en2nqCXEbwqRI,312
9
+ winebox/models/inventory.py,sha256=VLxpEIdYbD-oG9OfIGkHKDKm-cbSSo_aZGx66wRqR7Y,1324
10
+ winebox/models/transaction.py,sha256=9k1AAK0unYNseDubTaiFnGUGDVtuOqrjNUjIDukFDbc,1812
11
+ winebox/models/user.py,sha256=VP7NvbQDJMygTtt9Q5zPiBmtvtOCW5Cvaidi8zXDp98,1570
12
+ winebox/models/wine.py,sha256=R40TTRunPcTG4_D8kEWhopM2k6ne_awET7ctY4fk-HE,2503
13
+ winebox/routers/__init__.py,sha256=TEjBLPCkG007ItXMONZ2TsjOxl_TvHis1v84IOkXm1A,167
14
+ winebox/routers/auth.py,sha256=7rmld-TOIHmCMJfQKuQfkZFoNAAZd0zuj-mKqmAbHeg,2446
15
+ winebox/routers/cellar.py,sha256=QSyAnPQ2hiNaoojLk-5hJy95OnG8RMHOD0h5LV6bAWM,3404
16
+ winebox/routers/search.py,sha256=aIqwsjnB9e-D84VVcuye-01V_9WBUjFKzXNsX0gkRak,4971
17
+ winebox/routers/transactions.py,sha256=K0UDIJbVSTjV7NdI_CS0pvoTflH3Yp89DmneyFyl9ok,2055
18
+ winebox/routers/wines.py,sha256=4Jp1IGDCH2_jJfeAvy1ItfaNmmagUv20r_NTNmEYnew,9385
19
+ winebox/schemas/__init__.py,sha256=R4j1wdV1F-6kA45rHA8NUP2cqxBmLb2CMklo8tFjzGQ,357
20
+ winebox/schemas/transaction.py,sha256=GV_AZGeuFp_nOkg902UUhrHGwB1DxcQmGoG82m1UccI,899
21
+ winebox/schemas/wine.py,sha256=xHWDiV5bvEJuLPN2qWgOhqVMOTdlDSmfan5mtEy3Nvw,2301
22
+ winebox/services/__init__.py,sha256=rlAd5FBcqZJ7rsrFqR8MwTqGJVerlQHVUleEmoIaz1Y,277
23
+ winebox/services/auth.py,sha256=RDXP26hL3cGGxKcniXWMZ0sPUP6ew4LLMnfo4dv4P2E,3854
24
+ winebox/services/image_storage.py,sha256=ftiX54dVuDT0DVLpyBOL9N7zhZkapI0l1TFknfPedno,2393
25
+ winebox/services/ocr.py,sha256=X9lk1dkcH7xRrfYU5ArOakW4qavlRHQIkDD9nbPtzz4,3881
26
+ winebox/services/wine_parser.py,sha256=n5ldv2x2XsTfpK3acYDyMNyZHdJ_8WQU0keOql14MJ0,10456
27
+ winebox/static/index.html,sha256=57uWE1XQXIjP5a1lXMLqwZR2l7w5QaVMH5Qpp0DC4A0,12900
28
+ winebox/static/css/style.css,sha256=xzDVgl0-zT4yLtHWsuU3ASk0YImMnMGP5a8vKpYK6gA,19561
29
+ winebox/static/js/app.js,sha256=GabcNGSn7yQv7_KC7Ew5VjHmdiCjeAWxK2YtTkktVTc,23557
30
+ winebox-0.1.0.dist-info/METADATA,sha256=NsuThjFE0TKjf6SVbFuktb-7VcB5kIuBht9jYk7-k6s,7150
31
+ winebox-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
32
+ winebox-0.1.0.dist-info/entry_points.txt,sha256=XY-GMf023m8Iof3rmokkITONECm8gCOVkTX0rCkze30,103
33
+ winebox-0.1.0.dist-info/licenses/LICENSE,sha256=3popbhCShFhWVwTLKeQE-JNDYuPOYfmCiz-LoQpizTA,1070
34
+ winebox-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ winebox-admin = winebox.cli.user_admin:main
3
+ winebox-server = winebox.cli.server:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Joe Drumgoole
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.