buylog 0.1.7__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.
buylog-0.1.7/PKG-INFO ADDED
@@ -0,0 +1,385 @@
1
+ Metadata-Version: 2.4
2
+ Name: buylog
3
+ Version: 0.1.7
4
+ Summary: A purchasing support tool with CLI and TUI interfaces for vendor quote management.
5
+ Keywords: purchasing,quotes,vendor-management,price-tracking,cli,tui,textual
6
+ Author: Shakeeb Alireza
7
+ Author-email: Shakeeb Alireza <shakfu@users.noreply.github.com>
8
+ License-Expression: MIT
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: End Users/Desktop
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Office/Business
17
+ Classifier: Topic :: Utilities
18
+ Classifier: Typing :: Typed
19
+ Requires-Dist: sqlalchemy>=2.0.40
20
+ Requires-Dist: tabulate>=0.9.0
21
+ Requires-Dist: textual>=7.3.0
22
+ Requires-Dist: textual-dev>=1.8.0
23
+ Requires-Dist: pyperclip>=1.9.0
24
+ Requires-Dist: requests>=2.32.0
25
+ Requires-Dist: beautifulsoup4>=4.12.0
26
+ Maintainer: Shakeeb Alireza
27
+ Maintainer-email: Shakeeb Alireza <shakfu@users.noreply.github.com>
28
+ Requires-Python: >=3.13
29
+ Project-URL: Changelog, https://github.com/shakfu/buylog/blob/main/CHANGELOG.md
30
+ Project-URL: Homepage, https://github.com/shakfu/buylog
31
+ Project-URL: Issues, https://github.com/shakfu/buylog/issues
32
+ Project-URL: Repository, https://github.com/shakfu/buylog
33
+ Description-Content-Type: text/markdown
34
+
35
+ # buylog
36
+
37
+ A Python tool to help you keep track of what you buy and want to buy.
38
+
39
+ ## Features
40
+
41
+ - **Command Line Interface (CLI)** - Full CRUD operations for managing brands, products, vendors, and quotes
42
+ - **Text User Interface (TUI)** - Interactive terminal UI built with Textual
43
+ - **Data Persistence** - SQLAlchemy ORM with SQLite support
44
+ - **Multi-currency Support** - Forex rate tracking with automatic currency conversion
45
+ - **Quote Analysis** - Best price highlighting, price history tracking, and price alerts
46
+ - **Service Layer** - Business logic separation with validation and error handling
47
+ - **Audit Logging** - Track entity creation, updates, and deletions
48
+ - **Testing** - pytest-based test suite with factory pattern
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ # Clone the repository
54
+ git clone https://github.com/shakfu/buylog
55
+ cd buylog
56
+
57
+ # Install dependencies
58
+ uv sync
59
+
60
+ # Or install with development dependencies
61
+ uv sync --group dev
62
+ ```
63
+
64
+ ## Usage
65
+
66
+ ### Command Line Interface
67
+
68
+ The CLI supports comprehensive CRUD operations:
69
+
70
+ ```sh
71
+ # Add entities
72
+ buylog add --brand apple
73
+ buylog add --brand apple --product iphone-14
74
+ buylog add --vendor amazon.com --currency USD
75
+ buylog add --vendor amazon.com --product iphone-14 --quote 600
76
+
77
+ # Add forex rates
78
+ buylog add-fx --code EUR --usd-per-unit 1.085
79
+ buylog add-fx --code GBP --usd-per-unit 1.27 --date 2025-01-15
80
+
81
+ # Add quotes with shipping and tax
82
+ buylog add --vendor amazon.com --product iphone-14 --quote 600 --shipping 10.00 --tax-rate 8.5
83
+
84
+ # List entities
85
+ buylog list brands
86
+ buylog list products
87
+ buylog list vendors
88
+ buylog list quotes
89
+ buylog list brands --filter apple
90
+
91
+ # Search across entities
92
+ buylog search iphone
93
+
94
+ # Update entities
95
+ buylog update brand apple --new-name Apple
96
+ buylog update product iphone-14 --new-name "iPhone 14"
97
+
98
+ # Delete entities
99
+ buylog delete brand --name apple
100
+ buylog delete product --name iphone-14
101
+ buylog delete vendor --name amazon.com
102
+ buylog delete quote --id 1
103
+
104
+ # Seed database with sample data
105
+ buylog seed
106
+
107
+ # Price alerts
108
+ buylog alert add "iPhone 15 Pro" 900 # Create alert when price drops to $900
109
+ buylog alert list # List all alerts
110
+ buylog alert list --triggered # List triggered alerts only
111
+ buylog alert deactivate 1 # Deactivate alert by ID
112
+
113
+ # Price history
114
+ buylog history --product "iPhone 15 Pro" # View price history for a product
115
+ buylog history --quote-id 1 # View price history for a specific quote
116
+
117
+ # Price comparison
118
+ buylog compare --product "iPhone 15 Pro" # Compare prices for a specific product
119
+ buylog compare --search "iPhone" # Compare all products matching search term
120
+ buylog compare --category "Mobile Phones" # Compare all products in a category
121
+ buylog compare --brand "Apple" # Compare all products from a brand
122
+
123
+ # Product categories
124
+ buylog category set "iPhone 15 Pro" "Mobile Phones" # Set product category
125
+ buylog category list # List all categories
126
+
127
+ # Purchase lists
128
+ buylog purchase-list create "My List" --description "Weekend shopping"
129
+ buylog purchase-list add "My List" 123 # Add quote to list
130
+ buylog purchase-list remove "My List" 123 # Remove quote from list
131
+ buylog purchase-list show "My List" # Show list contents
132
+ buylog purchase-list all # List all purchase lists
133
+ buylog purchase-list delete "My List" # Delete a list
134
+
135
+ # Quote status tracking
136
+ buylog status set 123 considering # Set quote status
137
+ buylog status set 123 ordered # Mark as ordered
138
+ buylog status set 123 received # Mark as received
139
+ buylog status list ordered # List quotes by status
140
+
141
+ # Notes
142
+ buylog note add product 1 "Great product!" # Add note to product
143
+ buylog note add vendor 1 "Fast shipping" # Add note to vendor
144
+ buylog note list product 1 # List notes for product
145
+ buylog note delete 1 # Delete note by ID
146
+
147
+ # Tags
148
+ buylog tag add "sale" product 1 # Tag a product
149
+ buylog tag add "priority" quote 123 # Tag a quote
150
+ buylog tag remove "sale" product 1 # Remove tag
151
+ buylog tag list # List all tags
152
+ buylog tag list --entity-type product --entity-id 1 # List tags for entity
153
+ buylog tag search "sale" # Find entities by tag
154
+
155
+ # Watchlist
156
+ buylog watchlist add "iPhone 15" --target-price 800 # Add to watchlist
157
+ buylog watchlist list # List active watchlist
158
+ buylog watchlist list --all # Include inactive items
159
+ buylog watchlist update 1 --target-price 750 # Update target price
160
+ buylog watchlist remove 1 # Remove from watchlist
161
+
162
+ # Import data
163
+ buylog import quotes data.csv # Import quotes from CSV
164
+ buylog import quotes data.json # Import quotes from JSON
165
+ buylog import quotes data.csv --no-create # Don't create missing entities
166
+
167
+ # Export data
168
+ buylog export quotes --format csv --file quotes.csv # Export to CSV
169
+ buylog export quotes --format markdown --file report.md # Export to Markdown
170
+ buylog export quotes --filter "iPhone" # Export filtered quotes
171
+ buylog export products --file products.csv # Export products
172
+ buylog export vendors --file vendors.csv # Export vendors
173
+
174
+ # Backup and restore
175
+ buylog backup # Create timestamped backup
176
+ buylog backup --output my-backup.db # Custom backup path
177
+ buylog restore my-backup.db # Restore from backup
178
+ buylog restore my-backup.db --no-backup # Restore without backing up current
179
+ buylog backups # List available backups
180
+
181
+ # Find and merge duplicates
182
+ buylog duplicates vendors # Find similar vendors
183
+ buylog duplicates vendors --threshold 0.7 # Custom similarity threshold
184
+ buylog duplicates products # Find similar products
185
+ buylog duplicates merge-vendors 1 2 3 # Merge vendors 2,3 into vendor 1
186
+ buylog duplicates merge-products 1 2 3 # Merge products 2,3 into product 1
187
+
188
+ # Clipboard support
189
+ buylog clipboard quote 123 # Copy quote to clipboard
190
+ buylog clipboard product "iPhone 15 Pro" # Copy product to clipboard
191
+ buylog clipboard vendor "Amazon US" # Copy vendor to clipboard
192
+
193
+ # Vendor URL management
194
+ buylog vendor-url set "Amazon US" "https://amazon.com" # Set vendor URL
195
+ buylog vendor-url open "Amazon US" # Open vendor URL in browser
196
+ buylog vendor-url clear "Amazon US" # Clear vendor URL
197
+
198
+ # Receipt attachments
199
+ buylog receipt attach 123 receipt.pdf # Attach receipt to quote
200
+ buylog receipt open 123 # Open attached receipt
201
+ buylog receipt detach 123 # Remove receipt from quote
202
+ buylog receipt list # List quotes with receipts
203
+
204
+ # Web scraping
205
+ buylog scrape url "https://example.com/product" # Scrape price from URL
206
+ buylog scrape quote "https://example.com/product" --vendor "Amazon US" --product "iPhone 15" # Create quote from URL
207
+ ```
208
+
209
+ ### Text User Interface (TUI)
210
+
211
+ Launch the interactive TUI:
212
+
213
+ ```bash
214
+ buylog tui
215
+ ```
216
+
217
+ The TUI provides:
218
+ - Tabbed interface for Brands, Products, Vendors, Quotes, Forex rates, Alerts, Lists, and Watchlist
219
+ - DataTables with row selection
220
+ - Modal forms for adding entities
221
+ - Search/filter functionality
222
+ - **Quote Analysis Features**:
223
+ - Best prices highlighted in green
224
+ - Total cost calculation (with discount, shipping, tax)
225
+ - Price trend indicators (^ up, v down, - stable, * new)
226
+ - Sparkline mini-graphs showing price history
227
+ - Triggered alerts highlighted in yellow
228
+ - **Status column** with color coding (considering=cyan, ordered=yellow, received=green)
229
+ - **Workflow Features**:
230
+ - **Lists tab** - View and manage purchase lists
231
+ - **Watchlist tab** - Monitor products with target prices
232
+ - Set quote status with `t` key
233
+ - Add to watchlist with `w` key
234
+ - **Integration Features**:
235
+ - **URL column** in Vendors tab showing link indicators
236
+ - Copy to clipboard with `y` key (quotes, products, vendors)
237
+ - Open vendor URL with `o` key (on Vendors tab)
238
+ - **Quick Filters** for quotes by vendor, brand, or price range
239
+ - **Inline Editing** - Edit entities directly with `e` key
240
+ - **Column Sorting** - Click headers or press number keys to sort
241
+ - **Price Comparison** - Compare prices with `c` key (select type: Product/Search/Category/Brand)
242
+ - Keyboard shortcuts:
243
+ - `q` - Quit
244
+ - `a` - Add new entity
245
+ - `c` - Compare prices
246
+ - `d` - Delete selected entity
247
+ - `e` - Edit selected entity
248
+ - `f` - Filter quotes
249
+ - `o` - Open vendor URL (vendors tab)
250
+ - `r` - Refresh data
251
+ - `s` or `/` - Focus search
252
+ - `t` - Set quote status
253
+ - `w` - Add to watchlist
254
+ - `y` - Copy to clipboard
255
+ - `Ctrl+1-8` - Switch tabs directly
256
+ - `h/l` - Previous/next tab (vim-style)
257
+ - `j/k` - Move cursor down/up (vim-style)
258
+ - `1-7` - Sort by column number
259
+
260
+ ## Development
261
+
262
+ ### Running Tests
263
+
264
+ ```bash
265
+ # Run all tests
266
+ make test
267
+ # or
268
+ uv run pytest
269
+
270
+ # Run with coverage report
271
+ make coverage
272
+ # or
273
+ uv run pytest --cov-report=html:cov_html --cov-report=term-missing --cov=buylog
274
+ ```
275
+
276
+ ### Generate ER Diagram
277
+
278
+ ```bash
279
+ make diagram
280
+ # or
281
+ uv run python src/buylog/models.py
282
+
283
+ # Output: doc/er_model.svg
284
+ ```
285
+
286
+ ### Clean Build Artifacts
287
+
288
+ ```bash
289
+ make clean
290
+ ```
291
+
292
+ ## Architecture
293
+
294
+ ### Project Structure
295
+
296
+ ```
297
+ buylog/
298
+ ├── src/buylog/ # Main package
299
+ │ ├── models.py # SQLAlchemy ORM models
300
+ │ ├── cli.py # CLI interface
301
+ │ ├── tui.py # Textual TUI interface
302
+ │ ├── services.py # Business logic layer
303
+ │ ├── config.py # Configuration management
304
+ │ ├── audit.py # Audit logging
305
+ │ └── cache.py # Caching utilities
306
+ ├── tests/ # Test suite
307
+ │ ├── conftest.py # pytest fixtures
308
+ │ ├── factories.py # Factory Boy test data
309
+ │ ├── test_models.py # Model tests
310
+ │ ├── test_services.py # Service layer tests
311
+ │ └── test_quote_analysis.py # Quote analysis feature tests
312
+ ├── doc/ # Documentation
313
+ │ └── er_model.svg # Auto-generated ER diagram
314
+ └── pyproject.toml # Project dependencies
315
+ ```
316
+
317
+ ### Data Model
318
+
319
+ The core domain models:
320
+
321
+ - **Vendor** - Selling entities with currency, discount codes, and brand relationships
322
+ - **Brand** - Manufacturing entities linked to products and vendors
323
+ - **Product** - Items with brand associations that can be quoted by vendors
324
+ - **Quote** - Price quotes from vendors with shipping, tax, status, and total cost calculation
325
+ - **QuoteHistory** - Price change tracking for quotes (create/update events)
326
+ - **PriceAlert** - Price threshold alerts for products
327
+ - **Forex** - Currency exchange rates for multi-currency support
328
+ - **PurchaseList** - Named shopping lists grouping quotes
329
+ - **Note** - Freeform notes attachable to any entity (polymorphic)
330
+ - **Tag** - Categorization tags with optional color
331
+ - **EntityTag** - Junction table for tagging any entity
332
+ - **Watchlist** - Product monitoring with target prices
333
+
334
+ Key relationships:
335
+ - Many-to-many between Vendors and Brands (via `vendor_brand` junction table)
336
+ - One-to-many from Brand to Products
337
+ - One-to-many from Vendor and Product to Quotes
338
+ - One-to-many from Quote to QuoteHistory
339
+ - One-to-many from Product to PriceAlert
340
+ - Many-to-many between PurchaseList and Quotes (via `purchase_list_quote` junction table)
341
+ - One-to-many from Product to Watchlist
342
+
343
+ See the auto-generated ER diagram: `doc/er_model.svg`
344
+
345
+ ### Service Layer
346
+
347
+ Business logic is separated into service classes:
348
+ - `BrandService` - Brand CRUD with validation
349
+ - `ProductService` - Product management with eager loading
350
+ - `VendorService` - Vendor operations
351
+ - `QuoteService` - Quote management with currency conversion, best price detection, price updates, and status tracking
352
+ - `QuoteHistoryService` - Price history tracking and trend computation
353
+ - `PriceAlertService` - Price alert creation, triggering, and management
354
+ - `ComparisonService` - Price comparison by product, search, category, or brand
355
+ - `PurchaseListService` - Purchase list CRUD, add/remove quotes
356
+ - `NoteService` - Note CRUD for any entity type
357
+ - `TagService` - Tag management and entity tagging
358
+ - `WatchlistService` - Watchlist management with target prices
359
+ - `AuditService` - Entity change tracking
360
+
361
+ ## Technologies
362
+
363
+ - **Python 3.13+** - Core language
364
+ - **SQLAlchemy 2.0+** - ORM and database abstraction
365
+ - **Textual** - Modern terminal UI framework
366
+ - **pytest** - Testing framework
367
+ - **Factory Boy** - Test data generation
368
+ - **uv** - Fast Python package manager
369
+ - **eralchemy** - ER diagram generation
370
+ - **tabulate** - CLI table formatting
371
+
372
+ ## Configuration
373
+
374
+ The application uses a configuration system via `config.py`:
375
+ - Database path: `~/.buylog/buylog.db` (configurable via `BUYER_DB_PATH`)
376
+ - Log level: `INFO` by default (configurable via `BUYER_LOG_LEVEL`)
377
+ - Logging: Configured for both file and console output
378
+
379
+ ## License
380
+
381
+ MIT
382
+
383
+ ## Contributing
384
+
385
+ Feedback, bug reports and code contributions are welcome!