Python SDK for the InvenTree API
Project description
inventree-sdk
Python SDK for the InvenTree API.
It is designed to support shared integrations across projects like stocktake,
inventree-importer, and picklist.
Installation
pip install inventree-sdk
Configuration
Environment variables:
INVENTREE_URL=https://inventree.example.com
INVENTREE_TOKEN=your-api-token
Compatible aliases are also supported:
INVENTREE_API_URLINVENTREE_API_TOKEN
Usage
from inventree_sdk import AuthManager, InvenTreeClient, get_config
config = get_config()
auth = AuthManager(config)
client = InvenTreeClient(config, auth)
part = client.parts.find_by_name("FRAME-001")
stock = client.stock.list_for_part(part.pk, in_stock=True)
Included services
partscompaniesbarcodesbompricingstockbuilds
Full schema coverage
The SDK now ships with a generated OpenAPI surface for the full InvenTree schema.
- Existing hand-written services remain for the most common workflows.
- Every schema operation is also attached as a generated method on the matching service.
- Missing service groups are created automatically on the client.
Examples:
stock_page = client.stock.stock_list(part=123, limit=25)
attachment_page = client.attachment.attachment_list(limit=10)
build = client.builds.build_retrieve(id=42)
Generated component models are also available:
from inventree_sdk import get_openapi_model
StockItemModel = get_openapi_model("StockItem")
GitLab CI
The repository includes a .gitlab-ci.yml pipeline that:
- runs
ruffandpytest - builds the package with
python -m build - publishes to PyPI on tagged releases
To enable publishing, add a masked GitLab CI/CD variable named PYPI_API_TOKEN
with a PyPI API token value.
The publish job uploads with twine using PyPI's token-based auth on tag pipelines.
Current focus
This first version covers the endpoints already used by the local codebase:
- parts and categories
- companies and supplier parts
- barcode scan/link/unlink
- BOM items
- internal and sale prices
- stock listing, stock removal, stock count
- builds
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inventree_sdk-0.1.1.tar.gz.
File metadata
- Download URL: inventree_sdk-0.1.1.tar.gz
- Upload date:
- Size: 53.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e67cc7c1485f13c2e06a3845ee823500b0f0b0c18b01ca71c0db056adac45e
|
|
| MD5 |
a74de4715e8abc2250fbd62df93b383c
|
|
| BLAKE2b-256 |
9bce742059c51c372185a80c39587df1cd1bb08954a64076d9c6af9218631a9c
|
File details
Details for the file inventree_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: inventree_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 111.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a90ba85cdfd460d3c4f285fdc6d22c0699d45507667d96ee0fd103aca20feb16
|
|
| MD5 |
a043abb254bbd0a72a68b3e9d1e6cf3a
|
|
| BLAKE2b-256 |
902db12b0a9eb002b4d0c5af853cb9d47e99911a5413cc974aa5bcf9f783dc9a
|