A simple Python package to create singleton objects
Project description
Singleton Package
The singleton_package is a simple Python package that provides a Singleton metaclass. This metaclass can be used to create singleton objects, ensuring that only one instance of a class exists throughout the application.
Installation
You can install the singleton_package using pip:
pip install singleton_package
Usage
To use the Singleton metaclass in your classes, simply specify Singleton as the metaclass:
from singleton import Singleton
class MyClass(metaclass=Singleton):
def __init__(self):
# Your initialization code here
pass
# Usage
instance1 = MyClass()
instance2 = MyClass()
# instance1 and instance2 will be the same object
assert instance1 is instance2
Contributing
Contributions are welcome! Please feel free to submit pull requests or report any issues you encounter.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file singleton_package-0.7.0.tar.gz.
File metadata
- Download URL: singleton_package-0.7.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e57af99853974fa6a1272b8e8b896483e909812c15180ade9d1a31a52c87974d
|
|
| MD5 |
bdea7416be6418d161dbc9919c2cf355
|
|
| BLAKE2b-256 |
303111352fb859bb899e5fcb6ab75b7aa18720a3870fa6bcbef51d5249af9d2d
|
File details
Details for the file singleton_package-0.7.0-py3-none-any.whl.
File metadata
- Download URL: singleton_package-0.7.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c92a6ce335fbfc78e465b914998755228fc1e984b9f2f986f89ce519e188deac
|
|
| MD5 |
c8c7fa4c2f9864697e4b6ec121a94c0e
|
|
| BLAKE2b-256 |
0e8663acac2cfc533fb437731b79b4f27b67f2055fcba1e241576c532d7f85eb
|