=============
@tls_property
=============
`@tls_property` is a super-tiny library that will help you write
thread-safe classes.
It's acting like a `@cached_property <https://pypi.org/project/cached-property/>`_,
but value will be cached only for current thread.
Garbage collecting is respected, `@tls_property` won't mess up with it.
.. code-block:: python
from some_library import NonThreadsafeSuperClient
from tls_property import tls_property
class SuperClientWrapper:
@tls_property
def nonthreadsafe_client(self) -> NonThreadsafeSuperClient:
return NonThreadsafeSuperClient()
Also, value reset supported via @tls_property :code:`del` ete:
.. code-block:: python
client = SuperClientWrapper()
client.something()
del client.nonthreadsafe_client
client.something()
..
Module works on Python == 2.7 and Python ~= 3.4.
Installation
------------
.. code-block:: bash
pip install tls-property
..
License
-------
Public Domain: `CC0 1.0 Universal <https://creativecommons.org/publicdomain/zero/1.0/>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/leenr/tls-property",
"name": "tls-property",
"maintainer": "leenr",
"docs_url": null,
"requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,<4",
"maintainer_email": "i@leenr.ru",
"keywords": "thread-local storage,decorator",
"author": "leenr",
"author_email": "i@leenr.ru",
"download_url": "https://files.pythonhosted.org/packages/d9/83/441bac852a9fb9d6d6c7af42a1571052668d6c6a9945fe21ce7e0060d6ee/tls-property-1.1.0.tar.gz",
"platform": "posix",
"description": "=============\n@tls_property\n=============\n\n`@tls_property` is a super-tiny library that will help you write\nthread-safe classes.\n\nIt's acting like a `@cached_property <https://pypi.org/project/cached-property/>`_,\nbut value will be cached only for current thread.\n\nGarbage collecting is respected, `@tls_property` won't mess up with it.\n\n.. code-block:: python\n\n from some_library import NonThreadsafeSuperClient\n from tls_property import tls_property\n\n class SuperClientWrapper:\n @tls_property\n def nonthreadsafe_client(self) -> NonThreadsafeSuperClient:\n return NonThreadsafeSuperClient()\n\nAlso, value reset supported via @tls_property :code:`del` ete:\n\n.. code-block:: python\n\n client = SuperClientWrapper()\n client.something()\n del client.nonthreadsafe_client\n client.something()\n..\n\nModule works on Python == 2.7 and Python ~= 3.4.\n\nInstallation\n------------\n.. code-block:: bash\n\n pip install tls-property\n..\n\nLicense\n-------\nPublic Domain: `CC0 1.0 Universal <https://creativecommons.org/publicdomain/zero/1.0/>`_.",
"bugtrack_url": null,
"license": "",
"summary": "A @decorator for caching properties in classes in the thread-local storage.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/leenr/tls-property"
},
"split_keywords": [
"thread-local storage",
"decorator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d983441bac852a9fb9d6d6c7af42a1571052668d6c6a9945fe21ce7e0060d6ee",
"md5": "f738dbc8e5bfa92315bbf4b102440182",
"sha256": "cddf1152620e7c09307de5348a10d945070f0521183738a1fabaff17ad56343d"
},
"downloads": -1,
"filename": "tls-property-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "f738dbc8e5bfa92315bbf4b102440182",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,<4",
"size": 2252,
"upload_time": "2019-08-05T13:20:38",
"upload_time_iso_8601": "2019-08-05T13:20:38.898303Z",
"url": "https://files.pythonhosted.org/packages/d9/83/441bac852a9fb9d6d6c7af42a1571052668d6c6a9945fe21ce7e0060d6ee/tls-property-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2019-08-05 13:20:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "leenr",
"github_project": "tls-property",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "tls-property"
}