2025-11-30 18:48:21 -05:00
2025-11-30 18:48:21 -05:00
2025-11-30 18:48:21 -05:00
2025-11-30 18:48:21 -05:00
2025-11-30 18:48:21 -05:00

EEnventory - Electronics Component Inventory Helper

A command-line tool for managing your electronics component inventory for PCB projects. This tool helps you track parts, subtract BOMs when building PCBs, load Digikey orders, and identify what parts you need to order.

Problem Statement

I make a lot of PCBs and keep an inventory system for all of my components. It's tedious to keep a running count of all of my parts every time I receive a new Digikey order or build a PCB. Often times I just order the entire BOM for my PCB even though I know I'm ordering duplicates of some things, because I don't want to go individually count if I have enough.

This tool solves these problems by automating inventory management through CSV files.

Prerequisites

  1. I keep a single Inventory.csv file that contains every part I would use in a PCB. Every part gets an internal part number for my reference. The CSV also lists the Digikey part number and quantity I have on hand. The key point is that I only have to count everything once at the beginning.

  2. I keep a KiCad schematic symbol library updated with all inventoried parts, including the internal part number field, and the Digikey part number. Whatever CAD software you would use just needs to be able to include these extra fields in your schematic BOM when you export it.

Features

1. Check What You Need to Order

Before ordering parts, use the check command to verify if you have everything needed for a BOM. If parts are missing, the tool generates a missing_parts.csv file listing exactly what you need to order. You can import this file directly into Digikey to create a cart with your needed parts.

2. Load Digikey Orders

When you receive a Digikey order, use the add command to bulk-load all parts into your inventory. When you download the CSV of your order from Digikey after it has been placed, this tool can import it directly. The tool matches parts by Digikey part number and automatically adds quantities to existing inventory entries.

3. Subtract BOMs When Building PCBs

When you build a PCB, use the deductbom command to automatically subtract all parts from your inventory. When I export a BOM containing these field using Kicad, this tool can import it directly. That means if I build a PCB, I can deduct all of the parts I used with a single action based on the BOM. The tool will show you what's being deducted and ask for confirmation before making changes.

Installation

This is a Rust project. To build and install:

cargo build --release

The binary will be in target/release/inventory. You can add it to your PATH or use it directly.

Commands

add - Add Parts from Digikey Order

Load parts from a Digikey order CSV file into your inventory.

inventory add <inventory_path> <received_parts_path>

Example:

inventory add inventory.csv ~/Downloads/DK_PRODUCTS_96012156.csv

The tool will:

  • Match parts by Digikey part number
  • Add quantities to existing inventory entries
  • Show you what's changing before committing

deduct - Deduct a Single Part

Remove a specific quantity of a single part from inventory.

inventory deduct <inventory_path> <part_number> <quantity>

Example:

inventory deduct inventory.csv RES-1000 5

deductbom - Deduct a BOM

Subtract all parts from a Bill of Materials (BOM) CSV file from your inventory.

inventory deductbom <inventory_path> <bom_path>

The tool will:

  • Check that all parts are available in sufficient quantities
  • Show you what's being deducted
  • Ask for confirmation before updating inventory

check - Check BOM Availability

Verify if you have all parts needed for a BOM. If parts are missing, generates a missing_parts.csv file. You can import this csv directly into Digikey to order a cart with these parts.

inventory check <inventory_path> <bom_path>

Example:

inventory check inventory.csv my_pcb_bom.csv

If parts are missing, the tool will:

  • Print "You are missing some parts."
  • Generate missing_parts.csv with the exact quantities you need to order

If all parts are available, it prints "BOM is available."

Inventory File Format

Your inventory CSV file should have the following columns (flexible naming is supported):

  • Internal P/N (or Part Number, PN, internal_pn) - Your internal part number (required)
  • Manufacturer P/N (or Manufacturer Part Number, manufacturer_pn) - Optional
  • Digikey P/N (or Digikey PN, DigiKey Part #, digikey_pn) - Optional, but required for add command
  • Value (or value) - Component value (e.g., "10k", "100uF") - Optional
  • Description (or description) - Optional
  • Quantity (or Qty, quantity) - Current quantity on hand
  • Notes (or notes) - Optional

BOM File Format

The rules for reading a BOM follow the same rules as a regular inventory: It's a CSV with the same header requirements.

Digikey Order CSV Format

For the add command, the CSV should have:

  • DigiKey Part # (or Digikey P/N, Digikey PN, digikey_pn) - Required
  • Quantity (or Qty, quantity) - Required

The tool matches these parts to your inventory by Digikey part number.

How It Works

  1. Part Matching:

    • For add: Parts are matched by Digikey part number
    • For deductbom and check: Parts are matched by Internal P/N
  2. Safety Features:

    • All changes are shown before committing
    • You must confirm changes with 'y' before inventory is updated
    • Errors prevent partial updates (all-or-nothing for batch operations)
  3. Error Handling:

    • If a part isn't found, the operation fails
    • If quantities are insufficient, the operation fails with clear error messages
    • Multiple errors are collected and reported together

Example Workflow

  1. Initial Setup: Create your inventory CSV file with all your parts and their current quantities.

  2. Receiving a Digikey Order:

    inventory add inventory.csv ~/Downloads/DK_PRODUCTS_96012156.csv
    

    Review the changes and confirm with 'y'.

  3. Planning a Build:

    inventory check inventory.csv my_pcb_bom.csv
    

    If parts are missing, order them using missing_parts.csv.

  4. After Building a PCB:

    inventory deductbom inventory.csv my_pcb_bom.csv
    

    Review what was deducted and confirm.

Description
No description provided
Readme 31 KiB
Languages
Rust 100%