Skip to main content

atomicity

PyPI version

Atomicity is a simple library that provides atomic operation to python's synchronization primitives used in multi-threading application.

*** Note: This is at a very early stage and is subject to changes. Use at your own risk. ***

It includes an atomic lock and counter class, ensuring (somewhat) thread-safety and prevention of race conditions in concurrent programming. Everything is entirely lock-free and is backed by Rust's atomic types.

Features

TBD

Installation

Binary wheels are provided for Python 3.8 and above on Linux, macOS, and Windows:

pip install atomicity

On Windows systems, The LLVM Compiler Infrastructure is required

Usage

See the documentation for more information. Here's a quick overview:

Atomic Counter

from atomicity import AtomicCounter

# Create an atomic integer with an initial value of 0
atom = AtomicCounter()

# Perform atomic operations
atom.set(10)
value = atom.get()
print(f"Value: {value}")

previous_value = atom.add( 20)
print(f"Previous Value: {previous_value}")

atom.sub(5)
print(f"Result after addition: {atom}")

# Increment and decrement operations
atom.increment()
atom.decrement()

Atomic Lock

from atomicity import AtomicLock

# Create an atomic boolean with an initial value of False
atom = AtomicLock( False)

# Perform atomic operations
atom.store(True)
value = atom.acquire()
previous_value = atom.release()

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

  • The atomicity library is heavily dependent on and inspired by the Rust std::sync::atomic module.

Metadata

Release files for atomicity 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atomicity 0.0.3
File Size Uploaded Provenance
atomicity-0.0.3.tar.gz 7.1 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for atomicity 0.0.3
File Interpreter ABI Platform
atomicity-0.0.3-cp310-none-win_amd64.whl CPython 3.10 none Windows x86-64 Details
atomicity-0.0.3-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details
atomicity-0.0.3-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details

Total release size: 595.3 kB

Release files / atomicity-0.0.3.tar.gz

Download URL atomicity-0.0.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a677cc33fea972381e30a23c625940fdf4d14a102fc134d44d08312c1b689084
BLAKE2b-256 checksum
How to use checksums
db9f6c72c1b9b8d039de381b11571c7b556d12ca4d4b795ade54e3edf6c62d42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.4.0

Release files / atomicity-0.0.3-cp310-none-win_amd64.whl

Download URL atomicity-0.0.3-cp310-none-win_amd64.whl
Size 130.1 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
1ab89d8cd765b095de645124a72041e26ef1195dcf19404f72477d50d8b2ec4f
BLAKE2b-256 checksum
How to use checksums
0c19a0a1aadf3362eba58d6223882f2dff7f4184c2351668838d28a33dc0b6d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.4.0

Release files / atomicity-0.0.3-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL atomicity-0.0.3-cp310-cp310-manylinux_2_34_x86_64.whl
Size 229.3 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
8a04ff9ff222ec34d72788f9beaf2e07a9041c69aa586477600867b2dcdc4f52
BLAKE2b-256 checksum
How to use checksums
17aacb303ffed389f06c5e94a391e8e2f30273adabd430ec71aa97ef18412808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.4.0

Release files / atomicity-0.0.3-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL atomicity-0.0.3-cp310-abi3-manylinux_2_34_x86_64.whl
Size 228.8 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
35562908e1c9820658fc7f9e1540f4d4f21a7e73786dae72012525d63afe32b7
BLAKE2b-256 checksum
How to use checksums
a01f06326c7ddd372ddf1e352db2d0ceeb83e8fb0bfe4ddf5ec038a100840bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.4.0

Security for atomicity 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page