Skip to main content

BOM

BOM is a simple Django app to manage a bill of materials. It supports multiple part numbering schemes, tracking component sourcing information, estimates costs, and contains smart integrations with Mouser to pull in the latest component pricing and Google Drive for part file management. BOM is written in Python 3 and Django.

See a live example.

BOM can be added to an existing (or new) Django project, or stand alone on its own, which can be more convenient if you're interested in tweaking the tool.

If you already have a django project, you can skip to Add Django Bom To Your App, otherwise Start From Scratch: Add to new Django project to add it to a new django project, or Start From Scratch: Use as standalone Django project.

Table of contents

Start From Scratch: Add to a new Django project

  1. Create and activate a virtual environment (Python 3.10+):
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
  1. Install Django and set up your project:
pip install django
django-admin startproject mysite
cd mysite
python manage.py migrate
python manage.py createsuperuser # make a user for your development environment
  1. Continue on to Add Django Bom To Your App.

Add Django Bom To Your App

django-bom is a reusable django application. If you don't already have a django project, you can follow some quick steps below to get up and running, or read about creating your first django app here.

pip install django-bom
  1. Add "bom" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
    ...
    'bom',
    'social_django', # to enable google drive sync in bom
    'djmoney', # for currency
    'djmoney.contrib.exchange', # for currency
    'materializecssform',
]
  1. Update your URLconf in your project urls.py like this::
path('bom/', include('bom.urls')),

And don't forget to import include:

from django.conf.urls import include
  1. Update your settings.py to add the bom context processor 'bom.context_processors.bom_config', to your TEMPLATES variable, and create a new empty dictionary BOM_CONFIG.
TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'bom.context_processors.bom_config',
            ],
        },
    },
]

and

BOM_CONFIG = {'standalone_mode': False}
  1. Run python manage.py migrate to create the bom models.

  2. Start the development server python manage.py runserver and visit http://127.0.0.1:8000/admin/ to manage the bom (you'll need the Admin app enabled).

  3. Visit http://127.0.0.1:8000/bom/ to begin.

Start From Scratch: Use as a standalone Django project

  1. Clone the repo and create a virtual environment:
git clone https://github.com/mpkasp/django-bom.git
cd django-bom
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
  1. Install dependencies and start the server:
pip install -e .
cp bom/local_settings.py.example bom/local_settings.py
python manage.py migrate
python manage.py runserver

Customize Base Template

The base template can be customized to your pleasing. Just add the following configuration to your settings.py:

BOM_CONFIG = {
    'base_template': 'base.html',
}

where base.html is your base template.

Importing and exporting

Every export is a valid import: edit a CSV that BOM gave you and upload it on the Import page (/import/). Rows that match existing records update the fields they provide, blank cells leave values alone, and nothing is deleted except BOM lines you replace. Every import is previewed first and saved only when you confirm it.

Type Row identity Creates Export
Parts part_number, else manufacturer_part_number parts, revisions, manufacturer parts, one vendor price per row Export all parts
Vendor prices manufacturer part + seller + minimum_order_quantity price breaks and vendors, never parts Export all vendor prices
Bill of materials part_number or manufacturer_part_number per line, nested by level parts and revisions; syncs each listed sub-assembly's lines indented BOM export

The Import page detects the type from the file's columns or lets you pick one; /import/?type=parts|prices|bom preselects it, and &parent=<part number> fills in the assembly a BOM import goes into. The former upload-parts/, upload-bom/ and upload-parts-help/ URLs redirect there.

Integrations

Mouser Integration

For part matching, make sure to add your Mouser api key. You can get your key here.

Google Drive Integration

Make sure to add the following to your settings.py:

AUTHENTICATION_BACKENDS = (
    'social_core.backends.google.GoogleOpenId',
    'social_core.backends.google.GoogleOAuth2',
    'social_core.backends.google.GoogleOAuth',
    'django.contrib.auth.backends.ModelBackend',
)

SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = ['email', 'profile', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/plus.login']
SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = {
    'access_type': 'offline',
    'approval_prompt': 'auto'
}

And if you're using https on production add:

SOCIAL_AUTH_REDIRECT_IS_HTTPS = not DEBUG

FIXER

Fixer.io is used to handle exchange rate calculations. This is helpful if you may be purchasing parts from another currency (especially via Mouser) and you still need to estimate your part costs.

To set this up you just need to add your API key to local_settings.py as shown in the example.

To update rates, migrate and run python manage.py update_rates. Some day we will need to add a (celerybeat?) task to update rates on a schedule. Explained more here.

MCP Server

django-bom ships an MCP server so AI clients (Claude Code, Claude Desktop, Cursor, ...) can read and build BOMs in a user's organization. Design notes live in docs/mcp-server-design.md.

Run it standalone with an ASGI server; Django is served alongside it:

uv run uvicorn bom.asgi:application

The server listens at /mcp (Streamable HTTP, stateless). In a host project, mount bom.mcp.asgi.build_mcp_app() and enter bom.mcp.asgi.mcp_lifespan from the host app's lifespan.

Every request needs a bearer token. Create one under Settings > API Tokens (the plaintext is shown once), or issue one for a user from the command line (the plaintext is printed once):

uv run python manage.py create_api_token <username> --name "Claude Code" --scopes read,write

A token acts as that user in their organization: role permissions still apply, and a read-only token can never write. Connect a client with the token in the Authorization header, e.g.:

claude mcp add --transport http indabom http://localhost:8000/mcp --header "Authorization: Bearer <token>"

Hosts can gate access (e.g. by subscription) with BOM_CONFIG['mcp_access_check'], a callable or its dotted path, (organization, user, scopes) -> error message or None, that runs before every write.

Changes and token levels

Every MCP edit is a Change: a bundle of staged items reviewed at /changes/ and applied together (design: docs/changes-design.md). Token scopes set the level: read; read,write can only stage and submit changes for review (propose); read,write,apply can also apply them (create_api_token --scopes read,write,apply). Write tools take an optional change_id to stage into a change from start_change; without it a propose-level token submits a one-item change request and an apply-level token applies it at once. Edits to Released or In Review revisions make the change an Engineering Change Order (ECO): applying it creates a new Draft revision of each edited part (copying its assembly and properties) for a person to release, and it requires a second person to apply, as do protections in ChangeSettings (including a cost-delta threshold). The review page shows validation, impact (assemblies that use the edited parts) and the unit-cost effect at 100 units, and can rebase a stale change or revert an applied one. Hosts can switch the feature with BOM_CONFIG['changes_review_enabled'], BOM_CONFIG['mcp_apply_enabled'] and BOM_CONFIG['eco_enabled'] (callables of the organization or dotted paths; all default on), and set BOM_CONFIG['site_url'] so change URLs returned to MCP clients are absolute.

People can stage their own edits too: Start a change on the Changes page opens a draft, and while it is active a banner shows "Editing in Change #N" and creating a part, adding or editing a BOM line, and adding manufacturer or vendor parts stage items instead of saving, ready to submit or apply from the review page. Admins set the protections (always on for Released and In Review revisions; optionally the primary manufacturer part and a cost-delta threshold) in Settings > Organization.

After an applied Engineering Change Order, Draft parent assemblies are moved to the new revision automatically and the review page's Cascade panel offers a new Draft revision of each Released parent that still uses the old one. The part page has a Changes tab (the part's history: every submitted change that touches it, applied first) and a Compare with... select that opens /part/<id>/diff/<rev_a>/<rev_b>/, a diff of two revisions' fields, properties and BOM lines. get_change returns the change's impact (affected assemblies and cost delta).

Contributing

Contributions welcome! Before contributing your work please read the contributing readme.

Also reach out to mike@indabom.com to discuss features, and join our slack channel.

Installation Pitfalls

Windows

Sqlite

You may get an error during your pip install -r requirements.txt related to sqlite. This may be fixed by installing Visual C++ for python...

Cryptography

Sometimes you'll have issues installing cryptography, if this is the case you may just need to set up some environment variables. This stackoverflow may help.

Metadata

Release files for django-bom 1.324

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-bom 1.324
File Size Uploaded Provenance Actions
django_bom-1.324.tar.gz 734.2 kB With provenance Details for django_bom-1.324.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-bom 1.324
File Interpreter ABI Platform Actions
django_bom-1.324-py3-none-any.whl Python 3 none any Details for django_bom-1.324-py3-none-any.whl

Total release size: 1.6 MB

Release files / django_bom-1.324.tar.gz

Download URL django_bom-1.324.tar.gz
Size 734.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1fd630af3567a4b2bd1cbb22768810075c7836489004c5a9ef51575a89331ce4
BLAKE2b-256 checksum
How to use checksums
e5c55df1fad5c6f490e47a8c464d76572f86460dbe93dfa05bb516215a90b0bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / django_bom-1.324-py3-none-any.whl

Download URL django_bom-1.324-py3-none-any.whl
Size 830.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0ea2a7da7a34990914aa206ec7466bc67a5a4860a8d6598ba258c2a26f8af1b
BLAKE2b-256 checksum
How to use checksums
4f311623f5eb4ed9573bf3dac497373375ed12d062ed20c78e5b249933f9c9dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for django-bom 1.324

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_bom-1.324.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.324 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page