A desktop formulation suite and production scaling manager built with Python 3.11+, PyQt6, and SQLite. Packageable as a standalone Linux AppImage.
Important Regulatory Notice: Tared is an engineering calculation, compounding preparation, and record-keeping tool. It is not a validated electronic records system under FDA 21 CFR Part 11, EU Annex 11, or cGMP compounding frameworks. It does not provide cryptographic user authentication, tamper-evident audit hardware, or multi-party electronic signatures. Batch execution sheets must be reviewed and verified by qualified personnel against your facility's Standard Operating Procedures (SOPs).
- Conservation of Mass Invariant: Scaled ingredient weights are computed in high-precision
decimal.Decimalcontext using normalized proportional distribution and Hare-Niemeyer (largest remainder) allocation. Allocated discrete units always equal target mass units down to the scale quantum. - Scale-Precision Aware: Supports 0.001 g, 0.01 g, 0.1 g, and 1 g. Target batch masses must be exact multiples of the precision quantum. The calculation engine detects trace components that round to 0 mass or deviate by >25% due to scale quantization.
- Cumulative Tare Weighing: Batch sheets and live grids display running cumulative vessel tares. Compounding operators add each ingredient directly into a single mixing vessel without re-taring the scale.
- Master Raw Materials Catalog: Centralized raw material price book (
ingredients_catalog) with inline autocompletion in ingredient cells, automatic price population, supplier and SKU tracking, and non-destructive two-way price learning. - Immutable Revision Snapshots: Edits that change formula name, description, ingredient sequence, percentages, or unit costs increment the recipe version and trigger an immutable snapshot in
recipe_revisionsenforced by SQLite database triggers. - Production Batch Logging & PDF Export: Exporting a batch sheet generates a print-ready PDF and logs the batch run into the
batchestable referencing the immutable recipe revision. Past batches can be reprinted from Batch History... with historical fidelity. - Failsafe Disaster Recovery: In-progress formula drafts (<100%) can be saved with confirmation. Automated workspace backups (
tared_workspace.json) rotate up to 3 generations and can be targeted to cloud sync folders (Nextcloud, Dropbox, Syncthing). - Verified AppImage Self-Updating: Integrated release checking directly queries upstream GitHub Releases, enforces fail-closed SHA-256 digest matching, and atomically swaps running AppImage binaries in place.
When scaling a formula to a target mass
-
Total Percentage Normalization: Formula percentages are summed:
$S = \sum p_i$ . Percentages must sum to 100.00% ($\pm 0.0001%$ ) for production batch generation. -
Exact Mass Proportions: Unrounded target weight for ingredient
$i$ is$w_i = (M \times p_i) / S$ . -
Discrete Hare-Niemeyer Floor Units:
$u_i = \lfloor w_i / Q \rfloor$ . -
Remainder Resolution: Remainder
$r_i = w_i - (u_i \times Q)$ . -
Deficit Allocation: Total units required is
$U = M / Q$ . The unit deficit$D = U - \sum u_i$ is distributed one unit at a time to ingredients prioritized by:- Highest remainder
$r_i$ . - Highest formula percentage
$p_i$ (tie-breaker 1). - Earliest formula index (tie-breaker 2).
- Highest remainder
-
Cost Valuation: Unit costs are denominated in
$/kg. Line and batch costs are calculated directly from raw scaled grams: $ \text{Cost} = (w_{\text{scaled}} \times \text{Cost}_{\text{per kg}}) / 1000$. Line items display adaptive precision (2 or 4 decimal places), while total cost is rounded from unrounded sum accumulation to prevent rounding drift. -
Largest-Remainder Non-Monotonicity (Alabama Paradox): Like all largest-remainder discrete allocation algorithms, Hare-Niemeyer allocation is quota-consistent but not strictly population-monotonic. In rare edge conditions at allocation boundaries, scaling a target batch mass up by a single precision quantum can cause an individual component's allocation to decrease by one quantum due to dynamic shifts in fractional remainder ranks.
-
Immutable Revision Progression: Under Tared's audit model, calling Save Formula on a finalized recipe that alters formula name, compounding instructions, ingredient order, percentages, or unit costs generates an immutable snapshot in
recipe_revisionsand increments the recipe version ($v1 \to v2 \to v3$ ). -
In-Progress Drafts: Formulations may be saved in Draft mode (
is_draft=True)—including incomplete formulas (<100.00%)—via Save as Draft or with user confirmation when saving an incomplete formula. Repeated saves in Draft mode update the active draft in place without recording immutablerecipe_revisionsentries until finalized; branching a draft from a finalized revision reserves the next version number while preserving prior committed revisions. -
Production Gate: Batch sheet printing and PDF generation require a finalized immutable revision whose formula percentages sum to 100.00% (
$\pm 0.0001%$ ).
- Units of Measure: Batch masses are strictly denominated in grams (g) and raw material unit costs in currency per kilogram ($/kg).
- Physical Print Layout: Batch sheet templates are pre-scaled for standard A4 portrait dimensions (210 × 297 mm with 10 mm margins). Printers using US Letter or alternate page sizes should configure printer driver scaling.
- Single-User Architecture: Storage uses local SQLite with Write-Ahead Logging (WAL). The database is optimized for local single-process compounding execution and must not be hosted concurrently across networked shared folders (such as NFS or SMB) where SQLite locking locks can fail.
- Linux Runtime Requirements: Packaging relies on standard Type-2 AppImage bundles requiring
libfuse2on distributions such as Ubuntu 22.04+ and Debian 12+:sudo apt-get install libfuse2
- Workspace Reset Safeguard: The Danger Zone: Reset Workspace feature clears tables back to an empty slate, but automatically exports both a full JSON snapshot (
recipes_pre_reset_*.json) and a SQLite database copy (recipes_pre_reset_*.bak) beforehand, requiring typing"RESET"to confirm.
- Linux (x86_64, aarch64)
- Python 3.11 or newer
- PyQt6 6.5+ (Qt libraries:
libgl1,libxkbcommon0,libegl1,libdbus-1-3)
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e ".[dev,audit]"# Run comprehensive audit pipeline (Ruff, Mypy, Bandit, ShellCheck, Coverage, Tests)
./scripts/audit.sh
# Fast unit test run during active development
QT_QPA_PLATFORM=offscreen python3 -m unittest discover -s tests -p "test_*.py"
# Fast linting check
pipx run ruff check ../scripts/build_appimage.sh| Data Artifact | Standard Linux Filesystem Location |
|---|---|
| Formulation Database | ~/.local/share/tared/recipes.db |
| Application Crash Logs | ~/.local/share/tared/tared_crash.log |
| Automated Cloud Backup | Configurable in Settings / tared_workspace.json |
| Legacy Database (Auto-migrated) | ~/.local/share/recipe_studio/recipes.db |
Tared is free software licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later).

