fuckface (0.3.0)
Published 2026-07-24 19:12:41 +00:00 by Jack
Installation
pip install --index-url fuckfaceAbout this package
JSON settings that behave—unless you tell them to be a brat.
fuckface
A small JSON-backed settings module.
from fuckface import Settings, SettingsMode, SharedSettings
settings = Settings("settings.json", mode=SettingsMode.LOAD_OR_CREATE)
settings.set("theme", "dark")
settings["volume"] = 75
settings.save()
# Replace the current in-memory values with the file contents at any time.
settings.read()
# Enable brat mode for compact, one-line JSON:
compact_settings = Settings("compact.json", be_a_brat=True)
compact_settings.set("theme", "dark")
compact_settings.save()
# Pretty, indented JSON is the default:
pretty_settings = Settings("pretty.json", be_a_brat=False)
# Create/configure the shared instance before its first use.
shared = SharedSettings("shared-settings.json")
@SharedSettings.subscribe("theme")
def setting_theme_changed(old, new):
print(f"theme changed from {old!r} to {new!r}")
shared.set("theme", "light")
shared.save()
SharedSettings() always returns the same instance within the process. Create
it with the desired path before using its class-level subscribe decorator.
Creation modes are SettingsMode.LOAD_OR_FAIL,
SettingsMode.LOAD_OR_CREATE, and SettingsMode.NOTHING (the default).
Errors from settings operations—including file access, JSON decoding,
serialization, missing keys, and missing subscribers—are exposed as
Fuckface...Exception subclasses of FuckFaceException. Exceptions raised by
your own subscriber callbacks are left untouched.
Initialized by Hyperpyemia 0.3.4
Requirements
Requires Python: >=3.10
Details
2026-07-24 19:12:41 +00:00
Assets (2)
Versions (2)
View all
PyPI
3
12 KiB
fuckface-0.3.0-py3-none-any.whl
5.4 KiB
fuckface-0.3.0.tar.gz
6.6 KiB