Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

singleton_package-0.8.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

singleton_package-0.8.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file singleton_package-0.8.2.tar.gz.

File metadata

  • Download URL: singleton_package-0.8.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for singleton_package-0.8.2.tar.gz
Algorithm Hash digest
SHA256 52ae82564dab937dd92aa69bbfcf0da00a1bdef4b67f2679d539a3af64e33cf4
MD5 2fd8b16456469e2d90d15481c6f581eb
BLAKE2b-256 eb86f77d3d3f0d868ff11f4d293e1d38078eacfaa569662e27a42b27ee51309f

See more details on using hashes here.

File details

Details for the file singleton_package-0.8.2-py3-none-any.whl.

File metadata

File hashes

Hashes for singleton_package-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba0db5c0ad31f07cfb1a7eae320cb092db15fe4ab0b65b004bd693ccc0889ced
MD5 77e2251dafccd6ab27c9f04ef672ab5f
BLAKE2b-256 016d1b4c6e953bfb2e01719d2bb84bab4e7ca01018656e57a2685094580a7530

See more details on using hashes here.

Supported by

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