fuckface (0.2.0)

Published 2026-07-24 17:47:14 +00:00 by Jack

Installation

pip install --index-url  fuckface

About 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, SharedSettings

settings = Settings("settings.json")
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.

Initialized by Hyperpyemia 0.3.4

Requirements

Requires Python: >=3.10
Details
PyPI
2026-07-24 17:47:14 +00:00
1
9.2 KiB
Assets (2)
Versions (2) View all
0.3.0 2026-07-24
0.2.0 2026-07-24