A GMP-friendly CLI tool to manage lab reagent inventory, track expiration dates, and maintain data integrity.
- Add reagents/consumables with name, CAS number, lot, expiry date, quantity, and location
- List all inventory in a formatted table
- Search by name or CAS number
- Show items expiring within a specified number of days
- Update item details
- Remove items by ID
- Inventory statistics (total items, expiring soon, per location)
- Automatic backup of inventory file on every modification (preserves previous state as
.bak) - Atomic writes prevent data corruption
Requirements: Python 3.8 or higher.
git clone https://github.com/yourusername/lab-inventory-tracker.git
cd lab-inventory-tracker
# Optionally make the script executable
chmod +x main.pyRun directly with Python:
python main.py --help
python main.py add --name "Sodium Chloride" --cas 7647-14-5 --lot L12345 --expiry 2027-06-30 --quantity "500 g" --location "Cabinet A"
python main.py list
python main.py search "chloride"
python main.py expiring --days 60
python main.py update --id 1 --quantity "450 g"
python main.py remove --id 2
python main.py statsData is stored in ~/.lab_inventory/inventory.json. The previous version is kept as inventory.json.bak.
- Atomic file saving prevents partial writes.
- Backup ensures recoverability.
- Consistent data format aids audits.
MIT