Metadata-Version: 2.1
Name: door
Version: 0.0.1
Summary: A comprehensive python library for synchronization proxies
Home-page: https://github.com/blueskysolarracing/door
Author: Blue Sky Solar Racing
Author-email: blueskysolar@studentorg.utoronto.ca
License: MIT
Project-URL: Documentation, https://door.readthedocs.io/en/latest/
Project-URL: Source, https://github.com/blueskysolarracing/door
Project-URL: Tracker, https://github.com/blueskysolarracing/door/issues
Keywords: python,synchronization
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
License-File: LICENSE

====
Door
====

Door is a comprehensive python library for synchronization proxies. Door's
reliability has been established through static type checking, extensive
doctests, and unit tests, achieving 98% code coverage.


Features
--------

- Synchronization proxies to enforce sound synchronous data access.
- SLock (Readers-writer lock) implementations.
- Supported scenarios:

  - Multithreading;
  - Multiprocessing;
  - Asynchronous programming.

- Supported primitives:

  - Lock;
  - RLock;
  - Condition;
  - Semaphore;
  - BoundedSemaphore;
  - SLock (Readers-writer lock);
  - et cetera.

Installation
------------

.. code-block:: bash

   pip install door

Usage
-----

Below shows a sample usage of Door.

.. code-block:: pycon

   >>> @dataclass
   ... class Resource:
   ...     key: Any = 'value'
   ...
   >>> resource = Resource()
   >>> resource
   Resource(key='value')
   >>> resource.key
   'value'
   >>> from door.threading2 import SLock
   >>> door = SAcquirableDoor(resource, SLock())
   >>> with door.acquire_read() as proxy:
   ...     proxy.key
   ...
   'value'
   >>> with door.acquire_read() as proxy:
   ...     proxy.key = 'VALUE'
   ...
   Traceback (most recent call last):
       ...
   ValueError: no write permission
   >>> with door.acquire_write() as proxy:
   ...     proxy.key
   ...     proxy.key = 'VALUE'
   ...     proxy.key
   ...
   'value'
   'VALUE'
   >>> proxy.key
   Traceback (most recent call last):
       ...
   ValueError: no read permission
   >>> proxy.key = 'value'
   Traceback (most recent call last):
       ...
   ValueError: no write permission
   >>> resource
   Resource(key='VALUE')
   >>> resource.key
   'VALUE'

Testing and Validation
----------------------

Door has extensive test coverage, passes mypy static type checking with
strict parameter, and has been validated through extensive use in real-life
scenarios.

Contributing
------------

Contributions are welcome! Please read our Contributing Guide for more
information.

License
-------

Door is distributed under the MIT license.
