Skip to content

nekitdev/solus

Repository files navigation

solus

License Version Downloads Discord

Documentation Check Test Coverage

Singleton types.

Installing

Python 3.8 or above is required.

pip

Installing the library with pip is quite simple:

$ pip install solus

Alternatively, the library can be installed from source:

$ git clone https://github.com/nekitdev/solus.git
$ cd solus
$ python -m pip install .

poetry

You can add solus as a dependency with the following command:

$ poetry add solus

Or by directly specifying it in the configuration like so:

[tool.poetry.dependencies]
solus = "^1.2.2"

Alternatively, you can add it directly from the source:

[tool.poetry.dependencies.solus]
git = "https://github.com/nekitdev/solus.git"

Examples

Default

Singleton type is used to create thread-safe singletons.

from solus import Singleton


class Null(Singleton):
    ...

Somewhere else in the code:

null = Null()  # instantiate

Unsafe

UnsafeSingleton type is used to create thread-unsafe singletons.

from solus import UnsafeSingleton


class Null(UnsafeSingleton):
    ...


null = Null()  # instantiate right away

Warning

!!! warning

It is highly recommended to instantiate unsafe singleton types right after their creation!

Documentation

You can find the documentation here.

Support

If you need support with the library, you can send an email or refer to the official Discord server.

Changelog

You can find the changelog here.

Security Policy

You can find the Security Policy of solus here.

Contributing

If you are interested in contributing to solus, make sure to take a look at the Contributing Guide, as well as the Code of Conduct.

License

solus is licensed under the MIT License terms. See License for details.