Metadata-Version: 2.1
Name: typed_singleton
Version: 0.1.2
Summary: Package to provide a decorator to create singletons
Home-page: https://github.com/386jp/typed_singleton
License: MIT
Author: Kyosuke Miyamura
Author-email: ask@386.jp
Requires-Python: >=3.12,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Project-URL: Repository, https://github.com/386jp/typed_singleton
Description-Content-Type: text/markdown

# typed_singleton

A simple Python decorator library for creating singletons.

## Installation

```bash
pip install typed_singleton
```

## Usage

```python
from typed_singleton import Singleton


@Singleton
class SingletonClass:
    def __init__(self, my_value: int) -> None:
        self.my_value = my_value

    def get_my_awesome_value(self) -> int:
        return self.my_value

instance_1 = SingletonClass(1)
instance_2 = SingletonClass(2)
print(instance_1 is instance_2)  # True

print(instance_1.get_my_awesome_value())  # 1
print(instance_2.get_my_awesome_value())  # also 1
```

