Skip to main content

Python utilities classes for safe deployment and management of Threads, synchronization and Python data structures.

Project description

safethread

PyPI License Downloads

safethread is a Python package that wraps common Python data structures in thread-safe classes, providing utilities for thread-safe operations and synchronization mechanisms. It includes custom data structures designed to ensure thread safety when used in multi-threaded programming.

Features

  • Thread-Safe Data Structures: SafeList, SafeDict, SafeTuple, SafeSet, among others.
  • Thread Synchronization: Built-in locking mechanisms to ensure safe operations in multithreaded environments.
  • Utility Methods: Additional helpers and utilities for threading and synchronization.

Installation

You can install safethread from PyPI:

pip install safethread

Usage

from safethread.thread import SafeList, SafeDict, SafeTuple, SafeSet, SafeQueue

# Using SafeList
safe_list = SafeList()
safe_list.append(1)
print(safe_list[0])  # Output: 1

# Using SafeDict
safe_dict = SafeDict()
safe_dict['key'] = 'value'
print(safe_dict['key'])  # Output: 'value'

# Using SafeTuple
safe_tuple = SafeTuple(('a','b'))
print(safe_tuple[0])  # Output: 'a'

# Using SafeSet
safe_set = SafeSet(['x','y'])
safe_set.add('z')
print('z' in safe_set)  # Output: True

# Using SafeQueue
safe_queue = SafeQueue()
safe_queue.put(55)
print(safe_queue.get())  # Output: 55

For further details, check the full documentation (link below) and tests/ folder.

Documentation

The full documentation is available in https://andre-romano.github.io/safethread/docs

Contributing

We welcome contributions! If you'd like to contribute, please fork the repository and submit a pull request.

Special thanks / Acknowledgments

  • PyPi
  • Python 3

License and Copyright

Copyright (C) 2025 - Andre Luiz Romano Madureira

This project is licensed under the Apache License 2.0.

For more details, see the full license text (see LICENSE file).

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

safethread-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

safethread-0.2.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file safethread-0.2.0.tar.gz.

File metadata

  • Download URL: safethread-0.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for safethread-0.2.0.tar.gz
Algorithm Hash digest
SHA256 02c07ceba43dbbe6d45bf3e07ac6d85e6178e1d9c45a0e903d79c420b8f4eda1
MD5 8492de01e43b3c8bceb618c1b3c66475
BLAKE2b-256 8cf0728e0b8c559958edd22bda61e6d6b5bb06c26f70abe7416c1e845181eb9b

See more details on using hashes here.

File details

Details for the file safethread-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: safethread-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for safethread-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8d85d6e7f79d32eb445e08aae0ad2f26c4bda74ebcf0531091a73a3fc06fe65
MD5 2b0a66a8b9c76964342ebef393f07601
BLAKE2b-256 32fdb9c8e1c2458bc1756cd264680cb72a7355e2cd0cff5bc47ab37e0fbee573

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