Skip to main content

Python library for creating a database of hardware components for manufacturing

Project description

OpenPartsLibrary

OpenPartsLibrary is a Python library designed to serve as a centralized parts database for Bill of Materials (BOM), Product Data Management (PDM), and Product Lifecycle Management (PLM) systems. It provides structured data models and APIs for managing components, part metadata, sourcing, and lifecycle states. OpenPartsLibrary streamlines integration with engineering workflows, enabling consistent part usage and traceability across design and manufacturing processes.

Quickstart

Install the openpartslibrary via pip

pip install openpartslibrary

A minimal OpenPartsLibrary application looks something like this:

from openpartslibrary.db import PartsLibrary

pl = PartsLibrary()

pl.display()

This will give you the following output, loading all the integrated parts of the library:

      id                              uuid     number               name  ...                supplier manufacturer_number unit_price currency
0      1  7dd559e06e1044c9b66e4a61df1072b6  SCRW-1000   Screw Type A 5mm  ...          Acme Fasteners          MFG-625535       0.86      EUR
1      2  ced16afd527e483db362f44d6fcedd82  SCRW-1001   Screw Type A 5mm  ...  In-House Manufacturing          MFG-807818       4.02      EUR
2      3  e3f8a20ab4974e45bca023a31c50e862  SCRW-1002   Screw Type C 2mm  ...   Precision Screws Ltd.          MFG-543204       4.13      EUR
3      4  7115fbc429594f09881181a3503b62db  SCRW-1003   Screw Type B 3mm  ...  In-House Manufacturing          MFG-916662       3.52      EUR
4      5  8381dfa595854aa78b9d373d8a3f3f63  SCRW-1004   Screw Type A 1mm  ...  In-House Manufacturing          MFG-742978       0.38      EUR
..   ...                               ...        ...                ...  ...                     ...                 ...        ...      ...
115  116  67f3f0ec88974cdc8e9ac4eea5cf1351  SCRW-1115   Screw Type B 1mm  ...  In-House Manufacturing          MFG-406022       3.95      EUR
116  117  a685e7b7135f48579a34ca45cf6baafe  SCRW-1116  Screw Type B 10mm  ...  In-House Manufacturing          MFG-230904       2.99      EUR
117  118  c5c256a8a8b04972ab87ef84110f7d5a  SCRW-1117   Screw Type A 4mm  ...                  BoltCo          MFG-343539       0.23      EUR
118  119  2b9eda46cb8b45e093c084a437f01ba2  SCRW-1118   Screw Type B 1mm  ...   Precision Screws Ltd.          MFG-247256       4.28      EUR
119  120  39a71a5ed7224ee0bf5e919870ebe0a3  SCRW-1119   Screw Type D 4mm  ...                 HexTech          MFG-293100       2.06      EUR

[120 rows x 24 columns]

Working with the parts library

Creating a new part in the library:

from openpartslibrary.models import Part

new_part = Part(
            number='SCRW-2001',
            name='Screw Type Z (Special) M5x14',
            description='A special kind of screw for safety switches',
            revision="1",
            lifecycle_state="In Work",
            owner='Max Mustermann',
            material='Steel',
            mass=0.03,
            dimension_x=0.02,
            dimension_y=0.005,
            dimension_z=0.005,
            quantity=100,
            cad_reference='CAD REFERENCE',
            attached_documents_reference='DOCUMENTS REFERENCE',
            lead_time=10,
            make_or_buy='make',
            supplier='In-House Manufacturing',
            manufacturer_number='MFN-100001',
            unit_price=0.45,
            currency='EUR'
        )
pl.session.add(new_part)
pl.session.commit()
pl.display_reduced()

Loading a part from the library:

part = pl.session.query(Part).filter(Part.number == 'SCRW-1002').first()
print(part)

Modifying a part from the library:

part = pl.session.query(Part).filter(Part.number == 'SCRW-2001').first()
part.quantity -= 10
pl.session.commit()
pl.display_reduced()

Deleting a part from the library:

part = pl.session.query(Part).filter(Part.number == 'SCRW-1003').delete()
pl.session.commit()
pl.display_reduced()

Getting the total value of all parts in the library:

print('Total value of all parts in the library: ' + str(pl.total_value()) + ' EUR')

Creating parts from a parts list in a Excel-spreadsheet (*.xlsx). Take note, that the spreadsheet needs to implement the schema specified in this repository:

pl.create_parts_from_spreadsheet('C:/Users/Work/Documents/Github/OpenPartsLibrary/openpartslibrary/sample/parts_data_sample.xlsx')

Part schema

This table outlines the Part properties used in the OpenPartsLibrary.

Property Description
number Unique identifier for the part, often alphanumeric (e.g., "MTR-12345").
name Descriptive name of the part, typically used for display and search.
description Detailed explanation of what the part is and its intended function.
revision Version or iteration of the part (e.g., "6").
lifecycle_state Current status in the engineering lifecycle, like "In Work", "Released", "Obsolete".
owner Responsible person for the part.
date_created Timestamp of when the part was first created in the system.
date_modified Timestamp of the most recent update to the part.
material The material from which the part is made (e.g., "Aluminum 6061", "ABS").
mass Mass of the part, in kilograms.
dimensions_x Length of the part along the X-axis, in millimeters.
dimensions_y Width of the part along the Y-axis, in millimeters.
dimensions_z Height of the part along the Z-axis, in millimeters.
quantity Number of units of this part that are available.
cad_file_reference Reference to the associated 3D CAD file (e.g. *.FCStd).
attached_documents_reference References to external documents (e.g., datasheets, certifications).
lead_time Expected procurement time, in days.
make_or_buy Indicates whether the part is manufactured internally ("Make") or externally sourced ("Buy").
supplier Preferred supplier or vendor name.
manufacturer_number Vendor-specific identifier for the part, if purchased externally.
unit_price Cost per individual unit of the part (e.g., 12.75).
currency Currency of the unit price (e.g., EUR).

id and uuid will also be used internally, but database users does not have to worry about those.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openpartslibrary-0.1.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openpartslibrary-0.1.3-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file openpartslibrary-0.1.3.tar.gz.

File metadata

  • Download URL: openpartslibrary-0.1.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for openpartslibrary-0.1.3.tar.gz
Algorithm Hash digest
SHA256 db8934daf3936c21884113d8b132b73f6f0f95d9bcc81c8496eb8176b5fb9822
MD5 92989ff575678daafa2cc211bfbf7fec
BLAKE2b-256 f03fa52d54c2641628aab8d38a3d4b5ffd2d8eb9dd41bcc34517956c3e17a15f

See more details on using hashes here.

Provenance

The following attestation bundles were made for openpartslibrary-0.1.3.tar.gz:

Publisher: python-publish.yml on alekssadowski95/OpenPartsLibrary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openpartslibrary-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for openpartslibrary-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cb9b8907666fc7e88eebe0f6443007c16ff1acf96ab2fcaa3cf6078f19dfebaa
MD5 bf0d652200b6563daf988643c879e6e9
BLAKE2b-256 c7f8f0b7d13aa34740135f7dfbf15b2dd1302e397418a73fe4d1e52088b5e552

See more details on using hashes here.

Provenance

The following attestation bundles were made for openpartslibrary-0.1.3-py3-none-any.whl:

Publisher: python-publish.yml on alekssadowski95/OpenPartsLibrary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page