Singleton types.
Python 3.8 or above is required.
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 .
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"
Singleton
type is used to create thread-safe singletons.
from solus import Singleton
class Null(Singleton):
...
Somewhere else in the code:
null = Null() # instantiate
UnsafeSingleton
type is used to create thread-unsafe singletons.
from solus import UnsafeSingleton
class Null(UnsafeSingleton):
...
null = Null() # instantiate right away
!!! warning
It is highly recommended to instantiate unsafe singleton types right after their creation!
You can find the documentation here.
If you need support with the library, you can send an email or refer to the official Discord server.
You can find the changelog here.
You can find the Security Policy of solus
here.
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.
solus
is licensed under the MIT License terms. See License for details.