Skip to content

marmidr/boomer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BOM and PnP verifier

The purpose of this project is to help an electronic manufacturer in preparation of the new [PCB](Printed Circuit Board) elements.

It reads the [BOM](Bill Of Materials) and the accompanying [PnP](Pick And Place) files, performing cross-checking to ensure if those files contents matches.

Project selection: sshot1

BOM preview: sshot2

PnP preview: sshot3

Report: sshot4

The following checks are performed:

  • BOM contains element that is missing in the PnP file
  • PnP contains reference to element that is not present in the BOM
  • Part comment (value) differs between BOM and PnP files
  • Checks if the center of any two components in PnP file are closer that 3mm (120mils)

Supported formats

  • BOM
    • .xls
    • .xlsx
    • .ods
    • .csv
  • PnP
    • .xls
    • .xlsx
    • .ods
    • any other extension - considered as a CSV file

NOTE

If xls/xlsx/ods file contains several sheets, only the first one will be used.

Prerequisites

Python

Python for Windows with addons. Remember to check these options:

  • pip
  • tcl\tk
  • Add Python to environment variables

Minimum required version is Python 3.9.

Libraries

To install required libraries, open the PowerShell and:

# .xls reader, .xlsx reader, .ods reader, UI lib, natural sorting, http requests, image formats
pip install xlrd openpyxl odfpy customtkinter natsort requests pillow
# using local copy of fixed:
#   tkhtmlview - HTML widgets,
#   klembord - clipboard

How to run

From PowerShell:

python.exe src/app.py

To get colored logs, use Linux-like terminal, eg. MSys2, but still using the Windows installation of the Python:

$ /c/Program\ Files/Python39/python.exe src/app.py

msys2con

Trouble shooting

  • ModuleNotFoundError: No module named 'tkinter'

    tkinter was not installed together with the Python - follow the instructions here.

  • ERROR: Cannot load BOM: 'utf-8' codec can't decode byte

    Only UTF-8 files are accepted; if the BOM or PnP file uses ANSI or WINDOWS encoding, use Notepad++ or other editor to change the encoding to UTF-8

Unit tests

Uses pytest:

pip install pytest
cd tests
# run all
pytest
# run single test
pytest test_csv_reader.py::test_no_file
# print everything
pytest -s

Tests coverage

Uses Coverage:

pip install coverage
cd tests
coverage run -m pytest
coverage report --omit "test_*"
# Name                 Stmts   Miss  Cover
# ----------------------------------------
# src/csv_reader.py       48      9    81%
# src/ods_reader.py       24      1    96%
# src/text_grid.py        49     27    45%
# src/xls_reader.py       24      1    96%
# src/xlsx_reader.py      23      0   100%
# ----------------------------------------
# TOTAL                  243     38    84%
coverage html --omit "test_*"
# open tests\htmlcov\index.html