A Python package for creating functional singletons
Project description
Yuck!
Yuck!
is a library that is helpful when you need to create a singleton instance of a function.
Just decorate the function you want to singletonize, call it once with setup arguments and subsequent calls will use the already setup function call.
Example
from yuck import yuck
@yuck
def db(connection_string: str):
connection = connect(connection_string)
query = yield
while True:
query = yield connection.execute(query)
# Initial setup
db_instance = db("sqlite:///:memory:")
# Use the singleton instance
result = db_instance.send("SELECT * FROM users")
print(result)
NOTE: I'm not entirely sure this really works but I'm too lazy to even check :D.
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
pyuck-0.1.0.tar.gz
(2.7 kB
view details)
Built Distribution
pyuck-0.1.0-py3-none-any.whl
(3.1 kB
view details)
File details
Details for the file pyuck-0.1.0.tar.gz
.
File metadata
- Download URL: pyuck-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9501d54946b544ffb1152429f6622ba4063dd5fe5a0424a39f48b094aaac11c0 |
|
MD5 | 1e6dc9e28e462c54090991092b4eeff9 |
|
BLAKE2b-256 | 7b234b2078e0544606dd50778acb6e73d238a40362a28e291426586a7d7894bb |
File details
Details for the file pyuck-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: pyuck-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46f4cabd97e09bdf0a19464ef8fdd8249a67819cc8922e25063fe48ae632a751 |
|
MD5 | a293058aee6236fba12cb99c6fcebbb7 |
|
BLAKE2b-256 | 2ac431ff4cb574005ccfcf2114df82de992a705644771145d3ae677b199d2b39 |