coopstorage
A Python library for embedded storage tracking — models physical storage locations, containers, and the channel-processor rules that govern how items flow in and out of each slot.
Overview
coopstorage provides:
- Locations — physical storage slots with configurable capacity, dimensions, and channel-processor type
- Containers — items stored at locations, each with a UoM, optional contents, and resource qualifiers
- Channel processors — pluggable rules that control which slots are addable/removable (FIFO, LIFO, OMNI, NoFlow, push variants, etc.)
- Transfer requests — declarative add/move/remove operations resolved against qualifier criteria
- Location qualifiers — filter locations by capacity, dimensions, UoM, resource type, occupied state, channel accessibility, and more
- Live visualizer — browser-based isometric/top-down view with real-time SSE updates, slot overlays, UOM icons, and a legend
Channel Processor Types
| Type | Add | Remove | Flow |
|---|---|---|---|
AllAvailableChannelProcessor |
any empty slot | any occupied slot | none |
AllAvailableFlowChannelProcessor |
any empty slot | any occupied slot | forward |
AllAvailableFlowBackwardChannelProcessor |
any empty slot | any occupied slot | backward |
FIFOFlowChannelProcessor |
back of queue | front (oldest) | forward |
FIFOFlowBackwardChannelProcessor |
front (push) | front (oldest) | backward |
FIFONoFlowChannelProcessor |
deepest open slot | deepest occupied (oldest) | none |
FIFONoFlowPushChannelProcessor |
slot 0 (push) | deepest occupied (oldest) | none |
LIFOFlowChannelProcessor |
back of queue | front (newest) | forward |
LIFOFlowBackwardChannelProcessor |
front (push) | front (newest) | backward |
LIFONoFlowChannelProcessor |
deepest open slot | shallowest occupied (newest) | none |
LIFONoFlowPushChannelProcessor |
slot 0 (push) | shallowest occupied (newest) | none |
OMNIChannelProcessor |
adjacent to pack (either end) | either end | none |
OMNIFlowChannelProcessor |
adjacent to pack (either end) | either end | forward |
OMNIFlowBackwardChannelProcessor |
adjacent to pack (either end) | either end | backward |
Install
coopstorage ships a lean core with optional extras for the API server and persistence backends:
pip install coopstorage # core simulation engine only
pip install coopstorage[api] # + FastAPI visualizer/API server
pip install coopstorage[persistence] # + SQL (Postgres/SQLite) and MongoDB stores
pip install coopstorage[api,persistence] # both
pip install coopstorage[all] # everything
Quick Start
from coopstorage.storage.loc_load.storage import Storage
from coopstorage.storage.loc_load.location import Location
import coopstorage.storage.loc_load.dcs as dcs
import coopstorage.storage.loc_load.channel_processors as cps
from coopstorage.storage.loc_load.qualifiers import LocationQualifier
from coopstorage.storage.loc_load.transferRequest import TransferRequestCriteria
# Build storage with two locations
loc_a = Location(
id='A',
location_meta=dcs.LocationMeta(
dims=(10, 10, 5),
channel_processor=cps.FIFOFlowChannelProcessor(),
capacity=5,
),
coords=(0, 0, 0),
)
loc_b = Location(
id='B',
location_meta=dcs.LocationMeta(
dims=(10, 10, 5),
channel_processor=cps.LIFOFlowBackwardChannelProcessor(),
capacity=5,
),
coords=(15, 0, 0),
)
storage = Storage(locs=[loc_a, loc_b])
# Add a container to the first available location
storage.handle_transfer_requests([
TransferRequestCriteria(
new_container=dcs.Container(id='C001'),
dest_loc_query_args=LocationQualifier(at_least_capacity=1, has_addable_position=True),
)
])
Location Qualifiers
LocationQualifier filters candidate locations during transfer resolution:
from coopstorage.storage.loc_load.qualifiers import LocationQualifier, ContainerQualifier
from cooptools.qualifiers import PatternMatchQualifier, WhiteBlackListQualifier
# Destination: must have capacity, an accessible drop slot, and accept the container's UoM
LocationQualifier(
at_least_capacity=1,
has_addable_position=True,
)
# Source: must contain a container matching a pattern
LocationQualifier(
has_all_containers=[ContainerQualifier(pattern=PatternMatchQualifier(regex='^C00'))]
)
Key parameters:
| Parameter | Description |
|---|---|
at_least_capacity |
Minimum number of free slots |
has_addable_position |
Channel processor has an accessible drop position |
is_occupied |
True/False filter on whether any container is present |
has_any_containers |
At least one container satisfies any of the given qualifiers |
has_all_containers |
For each qualifier, at least one container satisfies it |
has_content |
Total qty of a resource/UoM across all containers meets a minimum |
uom_qualifier / ignore_uom_qualifier |
Container UoM must be allowed by location's whitelist |
resource_type_qualifier / ignore_resource_type_qualifier |
Container resource types must be allowed |
min_slot_dims |
All slot dimensions must be >= this |
reserved |
Filter on reservation state |
Visualizer
Start a live browser visualizer alongside a benchmark or simulation:
# Showcase: one of each channel processor type, lock-step add/remove
python run_viz_benchmark.py --mode showcase
# Continuous randomized simulation
python run_viz_benchmark.py --mode sim --config small
# Fixed benchmark workload
python run_viz_benchmark.py --mode benchmark --config medium
# Options
python run_viz_benchmark.py --delay 0.05 --log-level DEBUG --port 1219
The visualizer is served at http://localhost:1219/static/index.html.
Slot overlays:
| Color | Meaning |
|---|---|
| Green fill | Occupied |
| Grey fill | Available |
| Blue outline | Droppable (addable position) |
| Purple outline | Retrievable (removable position) |
Each container label shows a unique icon per UoM type with a live legend.
Running Tests
python -m pytest tests/ -v
License
MIT
Metadata
Release files for coopstorage 2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| coopstorage-2.1.tar.gz | 88.8 kB | Without provenance | Details for coopstorage-2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| coopstorage-2.1-py3-none-any.whl | Python 3 | none | any | Details for coopstorage-2.1-py3-none-any.whl |
Total release size: 171.9 kB
Release files / coopstorage-2.1.tar.gz
| Download URL | coopstorage-2.1.tar.gz |
|---|---|
| Size | 88.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8bdc1b12ad570907d695586379932c9ca460eafc02231b8bff28f8a917e2c9a8
|
|
BLAKE2b-256 checksum How to use checksums |
0bcf406cc5ca33fc640297696d6af77b9d76a3378df183e0ca74dbbb0058d132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / coopstorage-2.1-py3-none-any.whl
| Download URL | coopstorage-2.1-py3-none-any.whl |
|---|---|
| Size | 83.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b8b7471e0cf59be1844d8cd4ff33fd41fc2ea885585c4006b41f11b2869d5daa
|
|
BLAKE2b-256 checksum How to use checksums |
03cbee7c35148534864221d42c1776cc7cb7279f826551eda96c86ddef53308d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Security for coopstorage 2.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.