{"id":23287,"library":"atomicx","title":"atomicx","description":"Easy-to-use lock-free atomic integers, booleans, and floats for Python, leveraging C11 atomics. Current version 0.0.15, requires Python >=3.8. Released under MIT license, primarily a single-developer project with infrequent releases.","status":"active","version":"0.0.15","language":"python","source_language":"en","source_url":"https://github.com/RuneBlaze/atomicx","tags":["atomic","lock-free","threading","concurrency","atomicint","atomicbool","atomicfloat"],"install":[{"cmd":"pip install atomicx","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"","wrong":"","symbol":"AtomicInt","correct":"from atomicx import AtomicInt"},{"note":"","wrong":"","symbol":"AtomicBool","correct":"from atomicx import AtomicBool"},{"note":"","wrong":"","symbol":"AtomicFloat","correct":"from atomicx import AtomicFloat"}],"quickstart":{"code":"from atomicx import AtomicInt, AtomicBool, AtomicFloat\n\ncounter = AtomicInt(0)\ncounter.inc()\ncounter.add(5)\nprint(counter.load())\n\nflag = AtomicBool(False)\nflag.store(True)\nprint(flag.load())\n\nvalue = AtomicFloat(3.14)\nprint(value.load())","lang":"python","description":"Create and use atomic types with load/store and arithmetic operations."},"warnings":[{"fix":"Use atomic_float.store(atomic_float.load() + 1) or check if .add() is implemented in your version.","message":"AtomicFloat does not support compound assignment operators like += because Python float operations are not atomic. Always use methods like .store() or .add() (if available) to modify the value.","severity":"gotcha","affected_versions":"all"},{"fix":"Always use .load() to get the value before comparing: if atomic_a.load() == atomic_b.load(): ...","message":"Atomic types do not support comparison or arithmetic across threads without explicit load; comparing two atomic objects directly compares their memory addresses, not their values.","severity":"gotcha","affected_versions":"all"},{"fix":"AtomicInt(0) works; AtomicFloat(0.0) works; AtomicFloat(0) may raise TypeError.","message":"Initialization with non-integer for AtomicInt may raise TypeError. For AtomicFloat, only float is accepted; passing int may be coerced but not guaranteed.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install atomicx' to install the package.","cause":"Package not installed or installed in a different environment.","error":"ModuleNotFoundError: No module named 'atomicx'"},{"fix":"Upgrade atomicx: 'pip install --upgrade atomicx'. Or import only available classes: AtomicInt and AtomicBool.","cause":"Version older than 0.0.15 may not have AtomicFloat; introduced in 0.0.15.","error":"ImportError: cannot import name 'AtomicFloat' from 'atomicx'"},{"fix":"Use .load() to read and .store(value) to write.","cause":"Trying to use subscript notation like atomic[0] instead of atomic.load() or atomic.store().","error":"TypeError: 'AtomicInt' object does not support item assignment"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}