Registry / data / spq
library1.0.5pypypi✓ verified 80d ago

A lightweight library for handling physical quantities with units and uncertainties. Version 1.0.5, semi-active development, sporadic releases.

pip install spq
INSTALL
IMPORT
SIG · SPQ
S
spq
datapythonv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Quantity
import spq
from spq import Quantity

Basic usage: create quantities with units, perform arithmetic, and convert units.

from spq import Quantity, Q # Create a length with units length = Quantity(5.0, 'm') print(length) # 5.0 m # Arithmetic with automatic unit handling area = length * length print(area) # 25.0 m^2 # Use Q shorthand for uncertainties value = Q(10, 0.5, 'kg') # 10 ± 0.5 kg print(value) # Unit conversion print(length.to('cm')) # 500.0 cm
Debug
Known issues
gotchaThe 'Q' shorthand for creating quantities with uncertainties is undocumented in older versions. Use 'Quantity' constructor with uncertainty argument or 'Q' from spq.
fix
Use `from spq import Q` then `Q(value, uncertainty, unit)` or `Quantity(value, unit, uncertainty=...)`.
affects: all
gotchaUnit string parsing is strict; unknown unit strings raise an error. Do not use plural or alternative spellings (e.g., 'meters' instead of 'm').
fix
Always use SI base unit symbols (m, kg, s, A, K, mol, cd) or derived units (N, J, etc.).
affects: >=1.0.0
deprecatedThe 'magnitude' attribute is deprecated in favor of 'value' in v1.0.5.
fix
Replace `q.magnitude` with `q.value`.
affects: >=1.0.5
Upgrade
Version history
1.0.5latest on PyPI · released Jul 16, 2025
Audit
Dependencies
numpyrequiredUsed for array operations and uncertainty propagation
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
spq — pip install spq · libregistry