Skip to main content
Help us improve Python packaging – donate today!

Singleton metaclasses and singleton factories

Project Description

Declaring singleton classes and singleton factories with different scopes of instantiation, striving for thread-safety and simplicity.

  • Free software: MIT license

Installation

pip install singletons

Quick Example

    import singletons

@singletons.GlobalFactory
def my_uuid():
    return uuid.uuid4()

# elsewhere...
my_uuid()  # will return the global instance of a UUID object

Development

To run the all tests run:

tox

Changelog

master

0.2.2 (2018-02-01)

  • Shows warning rather than giving exception when using greenthread singletons without a greenthread environment

0.2.1 (2018-01-29)

  • CI changes

0.2.0 (2018-01-23)

  • More tests
  • Usage examples added to documentation
  • Fixed issues revealed by tests

0.1.0 (2018-01-22)

  • First release on PyPI.

Release history Release notifications

This version
History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
singletons-0.2.2.tar.gz (16.0 kB) Copy SHA256 hash SHA256 Source None Feb 1, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page