Skip to main content

Production-grade Software Transactional Memory for Python 3.13+

Project description

Atomix STM (v3.1.0) ⚛️

Production-grade Software Transactional Memory for Python 3.13+ (No-GIL Ready)

Atomix STM brings the power of Clojure-style concurrency to Python. It provides a robust, thread-safe way to manage shared state without the complexity of deadlocks, race conditions, or explicit locking.

License: GPL v3 Python 3.13+


⚡ Why Atomix?

Traditional locking is hard. Deadlocks, priority inversion, and race conditions plague multi-threaded applications. Atomix STM solves this by providing:

  • Atomic Transactions: Changes are all-or-nothing.
  • Consistent Reads: No "dirty reads" or torn state.
  • Isolated State: Transactions don't interfere with each other.
  • Durable (Optional): Support for enterprise persistence plugins.
  • No-GIL Optimized: Designed to scale on Python 3.13's free-threading mode.

Critical v3.1 Enhancements:

  • Adaptive Reaper: Industry-first history cleanup that scales with system contention.
  • Level Bloat Fix: Optimized PersistentVector for zero-overhead deep trees.
  • Snapshot Protection: Hardened transaction timeouts to prevent memory exhaustion.
  • Lock-free Primitives: High-performance Seqlock and Spinlock internals.

🚀 Quick Start

from atomix_stm import Ref, dosync, atomically

# 1. Define your shared state
balance_a = Ref(1000)
balance_b = Ref(500)

# 2. Perform atomic operations
@atomically
def transfer(from_ref, to_ref, amount):
    if from_ref.value < amount:
        raise ValueError("Insufficient funds")
    from_ref.alter(lambda x: x - amount)
    to_ref.alter(lambda x: x + amount)

# 3. Safe, concurrent execution
transfer(balance_a, balance_b, 200)

print(f"Balance A: {balance_a.value}") # 800
print(f"Balance B: {balance_b.value}") # 700

📦 Installation

pip install atomix-stm

[!NOTE] Compatibility: Atomix STM is compatible with Python 3.9 through 3.14. While it works perfectly on standard Python with the GIL, it provides maximum performance gains on Python 3.13+ with free-threading enabled.


🛠 Features

  • MVCC (Multi-Version Concurrency Control): Readers never block writers.
  • Persistent Data Structures: High-performance immutable PersistentVector and PersistentHashMap (HAMT).
  • Agents: Asynchronous state management for side effects.
  • Dynamic Variables: Thread-local overrides with STMVar.
  • Diagnostics: Built-in monitoring with STMDiagnostics.

📊 Benchmarks (Python 3.13 Free-threading)

Operation Standard Threading Atomix STM Improvement
Read (10M) 1.2s 0.4s 300%
Write(1M) 4.5s (GIL locked) 1.1s 400%
Contention Deadlock risk Safe Retry ♾️

📝 Licensing

Atomix STM is dual-licensed:

  1. GPLv3: Open-source use (requires sharing your source code).
  2. Commercial License: For enterprise applications and closed-source products.

Contact the maintainers via the GitHub repository for commercial inquiries.


🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

© 2026 Atomix STM Project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atomix_stm-3.1.4.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atomix_stm-3.1.4-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file atomix_stm-3.1.4.tar.gz.

File metadata

  • Download URL: atomix_stm-3.1.4.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for atomix_stm-3.1.4.tar.gz
Algorithm Hash digest
SHA256 8d24115781842240cf39002b1ae65f76e200894210c034519821da7ed460cbf7
MD5 7edf6c573c63fa86b8337fd1fcee0306
BLAKE2b-256 7694eaaedf480ec6f3e29ab703c2628fd8efa56ac59309578073752f219e2377

See more details on using hashes here.

File details

Details for the file atomix_stm-3.1.4-py3-none-any.whl.

File metadata

  • Download URL: atomix_stm-3.1.4-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for atomix_stm-3.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 387c794ae8527716daa76af9c13995d1534c9ddc95b2a16c5a707550e4cf6d92
MD5 3188fdde7d230e91f981e74f18d34fc1
BLAKE2b-256 a84434af616549c18b8850295e0fe72ce60fb2f533ba2ef48e5cec4612664bff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page