{"id":28257,"library":"spq","title":"SPQ - Simple Physical Quantities","description":"A lightweight library for handling physical quantities with units and uncertainties. Version 1.0.5, semi-active development, sporadic releases.","status":"active","version":"1.0.5","language":"python","source_language":"en","source_url":"https://github.com/ketakopter/spq","tags":["physical-quantities","units","uncertainty","physics","scientific-computing"],"install":[{"cmd":"pip install spq","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for array operations and uncertainty propagation","package":"numpy","optional":false}],"imports":[{"note":"Can also use 'from spq import Q' as a shorthand","symbol":"Quantity","correct":"from spq import Quantity"},{"note":"Unit is exposed at package level, not from an internal module","wrong":"from spq.core import Unit","symbol":"Unit","correct":"from spq import Unit"}],"quickstart":{"code":"from spq import Quantity, Q\n\n# Create a length with units\nlength = Quantity(5.0, 'm')\nprint(length)  # 5.0 m\n\n# Arithmetic with automatic unit handling\narea = length * length\nprint(area)  # 25.0 m^2\n\n# Use Q shorthand for uncertainties\nvalue = Q(10, 0.5, 'kg')  # 10 ± 0.5 kg\nprint(value)\n\n# Unit conversion\nprint(length.to('cm'))  # 500.0 cm","lang":"python","description":"Basic usage: create quantities with units, perform arithmetic, and convert units."},"warnings":[{"fix":"Use `from spq import Q` then `Q(value, uncertainty, unit)` or `Quantity(value, unit, uncertainty=...)`.","message":"The 'Q' shorthand for creating quantities with uncertainties is undocumented in older versions. Use 'Quantity' constructor with uncertainty argument or 'Q' from spq.","severity":"gotcha","affected_versions":"all"},{"fix":"Always use SI base unit symbols (m, kg, s, A, K, mol, cd) or derived units (N, J, etc.).","message":"Unit string parsing is strict; unknown unit strings raise an error. Do not use plural or alternative spellings (e.g., 'meters' instead of 'm').","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Replace `q.magnitude` with `q.value`.","message":"The 'magnitude' attribute is deprecated in favor of 'value' in v1.0.5.","severity":"deprecated","affected_versions":">=1.0.5"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Install with `pip install spq` and import using `from spq import Quantity`.","cause":"spq is not installed or imported from wrong module (e.g., spq.core).","error":"ImportError: cannot import name 'Quantity' from 'spq'"},{"fix":"Use singular SI symbols: 'm' for meters, 'kg' for kilograms, etc.","cause":"Using plural or non-standard unit strings.","error":"ValueError: Unknown unit symbol: 'meters'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}