Metadata-Version: 2.4
Name: fuckface
Version: 0.3.0
Summary: JSON settings that behave—unless you tell them to be a brat.
Author-email: Chipperfluff <contact@chipi.at>
License-Expression: MIT
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: twine>=5.1; extra == 'dev'
Description-Content-Type: text/markdown

# fuckface

A small JSON-backed settings module.

```python
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.

<sub style="color: grey;"><small><small>Initialized by Hyperpyemia 0.3.4</small></small></sub>
