# singletonify
[![Build Status](https://travis-ci.com/Cologler/singletonify-python.svg?branch=master)](https://travis-ci.com/Cologler/singletonify-python)
[![PyPI](https://img.shields.io/pypi/v/singletonify.svg)](https://pypi.org/project/singletonify/)
## install
``` cmd
pip install singletonify
```
## usage
``` py
@singleton(a=3)
class YourClass:
def __init__(self, a): ...
assert YourClass() is YourClass()
```
## why not other
There are many singleton libraries on pypi, but their all has problem:
* [singleton](https://pypi.python.org/pypi/singleton) - cannot use `issubclass()` or `__mro__` or ...
* [singleton-decorator](https://pypi.python.org/pypi/singleton-decorator) - cannot use `isinstance()` .
* [singleton_factory](https://pypi.python.org/pypi/singleton_factory) - wtf, why do people use `dict()[hash(obj)] = obj` ?
* [singletonmetaclasss](https://pypi.python.org/pypi/singletonmetaclasss/0.1) - a little like this, but not a decorator.
* [singleton3](https://pypi.python.org/pypi/singleton3) - haha
* [pysingleton](https://pypi.python.org/pypi/pysingleton) - ABANDONED.
Raw data
{
"_id": null,
"home_page": "https://github.com/Cologler/singletonify-python",
"name": "singletonify",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "singleton",
"author": "cologler",
"author_email": "skyoflw@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/97/61/b297dab1cca05651aac73e93fd6e8083ae08bab7b549cb2d3f0ce7e92111/singletonify-0.2.4.tar.gz",
"platform": "",
"description": "# singletonify\n\n[![Build Status](https://travis-ci.com/Cologler/singletonify-python.svg?branch=master)](https://travis-ci.com/Cologler/singletonify-python)\n[![PyPI](https://img.shields.io/pypi/v/singletonify.svg)](https://pypi.org/project/singletonify/)\n\n\n## install\n\n``` cmd\npip install singletonify\n```\n\n## usage\n\n``` py\n@singleton(a=3)\nclass YourClass:\n def __init__(self, a): ...\n\nassert YourClass() is YourClass()\n```\n\n## why not other\n\nThere are many singleton libraries on pypi, but their all has problem:\n\n* [singleton](https://pypi.python.org/pypi/singleton) - cannot use `issubclass()` or `__mro__` or ...\n* [singleton-decorator](https://pypi.python.org/pypi/singleton-decorator) - cannot use `isinstance()` .\n* [singleton_factory](https://pypi.python.org/pypi/singleton_factory) - wtf, why do people use `dict()[hash(obj)] = obj` ?\n* [singletonmetaclasss](https://pypi.python.org/pypi/singletonmetaclasss/0.1) - a little like this, but not a decorator.\n* [singleton3](https://pypi.python.org/pypi/singleton3) - haha\n* [pysingleton](https://pypi.python.org/pypi/pysingleton) - ABANDONED.\n\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "",
"version": "0.2.4",
"project_urls": {
"Homepage": "https://github.com/Cologler/singletonify-python"
},
"split_keywords": [
"singleton"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4b317aa2ad2a40cada659a46ad2441de4bda08cc2385c40ce7886b976f59b2ca",
"md5": "991c0c53f21e04fb7d5fc5751154f383",
"sha256": "2508c0630611f72061bb396427c9a2932d9909cc07ebaa479edef01f64dab336"
},
"downloads": -1,
"filename": "singletonify-0.2.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "991c0c53f21e04fb7d5fc5751154f383",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3211,
"upload_time": "2018-10-17T03:26:58",
"upload_time_iso_8601": "2018-10-17T03:26:58.687240Z",
"url": "https://files.pythonhosted.org/packages/4b/31/7aa2ad2a40cada659a46ad2441de4bda08cc2385c40ce7886b976f59b2ca/singletonify-0.2.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9761b297dab1cca05651aac73e93fd6e8083ae08bab7b549cb2d3f0ce7e92111",
"md5": "5a4fa91765c8066d31668403e96a08cd",
"sha256": "05be9f3eefc9dcd93fc18eabc72468f586a317af6b216a821e7a1f2ea351f26f"
},
"downloads": -1,
"filename": "singletonify-0.2.4.tar.gz",
"has_sig": false,
"md5_digest": "5a4fa91765c8066d31668403e96a08cd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2173,
"upload_time": "2018-10-17T03:26:59",
"upload_time_iso_8601": "2018-10-17T03:26:59.566027Z",
"url": "https://files.pythonhosted.org/packages/97/61/b297dab1cca05651aac73e93fd6e8083ae08bab7b549cb2d3f0ce7e92111/singletonify-0.2.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2018-10-17 03:26:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Cologler",
"github_project": "singletonify-python",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "singletonify"
}