Skip to main content

A comprehensive python library for synchronization proxies

Project description

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 83% code coverage.

Features

  • Synchronization proxies to enforce sound synchronous data access.

    • Supported scenarios:

      • Multithreading;

      • Asynchronous programming.

    • Supported primitives:

      • Lock;

      • RLock;

      • Condition;

      • Semaphore;

      • BoundedSemaphore;

      • RSLock (Read-preferring shared lock);

      • WSLock (Write-preferring shared lock);

      • et cetera.

  • Shared lock (Readers-writer lock) implementations.

    • Supported scenarios:

      • Multithreading;

      • Multiprocessing;

      • Asynchronous programming.

Installation

pip install door

Usage

Below shows a sample usage of Door.

>>> @dataclass
... class Resource:
...     key: Any = 'value'
...
>>> resource = Resource()
>>> resource
Resource(key='value')
>>> resource.key
'value'
>>> from door.threading2 import RSLock
>>> door = SAcquirableDoor(resource, RSLock())
>>> with door.read() as proxy:
...     proxy.key
...
'value'
>>> with door.read() as proxy:
...     proxy.key = 'VALUE'
...
Traceback (most recent call last):
    ...
ValueError: no write permission
>>> with door.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.

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

door-0.0.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

door-0.0.2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file door-0.0.2.tar.gz.

File metadata

  • Download URL: door-0.0.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for door-0.0.2.tar.gz
Algorithm Hash digest
SHA256 060296adf1590e03a86620c67b7c3a728e6be8fec9b8ccc6113dd2aa8e56063c
MD5 20feb59b2cee6711d1a9de95903753cd
BLAKE2b-256 f13d19ae3474d5c326d1378c730d599dfcb69dd8f3d05257c59a3ca0d38e59cd

See more details on using hashes here.

File details

Details for the file door-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: door-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for door-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e365cb3fa3555accbb66a3831b70227e0960bec8ea2e7b5c4a2fc58cb48b2400
MD5 875030bd6c77a8ad39ef8c9875e542b1
BLAKE2b-256 8c1e011718b56a8ef1d6693ee0db3e56017dead0e601f5d02015e57d4b718603

See more details on using hashes here.

Supported by

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