Metadata-Version: 2.4
Name: fond
Version: 0.0.39
Summary: Foundation for Cooking, Foundation for Life.
Author-email: chaz <bright.lid5647@fastmail.com>
Requires-Python: >=3.12
Description-Content-Type: text/markdown

<p align="center">
  <img src="fond.jpg" alt="Fond — Foundation for Cooking, Foundation for Life" width="480">
</p>

# Fond

Foundation for Cooking, Foundation for Life.

[![pypi version](https://img.shields.io/pypi/v/fond.svg)](https://pypi.org/project/fond/)

> **Experimental:** This package is under active development. APIs may change without notice.

C++ header-only utilities distributed via PyPI as a build-time dependency. Your end users never need to install it.

## Installation

```bash
pip install fond
```

## Usage

### As a build dependency

```toml
[build-system]
requires = [
    "fond>=0.1.0",
    "build-cub",
    "pybind11",
]
```

### Getting include paths

```python
import fond

fond.get_include()  # Root include path
fond.get_libs()     # Binding source files
```

### In your C++ code

```cpp
#include <fond/collections/maps.hpp>
#include <fond/logger/logger.hpp>
#include <fond/colors/palette.hpp>
#include <fond/msgpack/packer.hpp>
```

## Available Headers

### Collections (`fond/collections/`)
Policy-based data structures with compile-time `Ordered`/`Frozen` variants:
- **Set** — unordered, ordered, frozen, frozen-ordered (policy-based)
- **Map** — same four variants via policies
- **List / Tuple** — mutable list + frozen tuple
- **BloomFilter / BloomSet** — probabilistic fast-negative-lookup set
- **LRUCache** — simpoo version wrapping Map
- **RingBuffer** — fixed-size circular buffer, compile-time sized
- **Trie** — prefix tree for string lookup and autocomplete
- **BitFlag** — type-safe enum-keyed bitset wrapper
- **Arena** — bump allocator for bulk allocation
- **Pool** — fixed-size typed object pool with freelist
- **SparseSet** — O(1) add/remove/contains with dense iteration
- **DynStack** — dynamic LIFO stack, doubles as a freelist

### Collections Core (`fond/collections/core/`)
Composable low-level building blocks for high-performance data structures:
- **OpenMap** — open-addressing hash map with tombstones, node pool, intrusive LRU list
- **IntrusiveList** — doubly-linked list that doesn't own nodes
- **NodePool** — pre-allocated typed pool for ListNode-derived types
- **HashUtils** — probing, power-of-2 masking, hash mixing, load factor math

### High-Performance (`fond/collections/`)
- **FastLRU** — LRU cache built on OpenMap (zero allocations per get/put)

### Colors (`fond/colors/`)
- **Color** — RGBA color struct with conversions to ANSI, ImGui, uint32
- **Palette** — named color constants (single source of truth)
- **ANSI** — terminal color constants (constexpr, zero allocation)
- **ImGui** — ImVec4/ImU32 color constants (generated from palette)

### Logger (`fond/logger/`)
- Compile-time configurable logging with function pointer dispatch
- ANSI color support, file output with rotation, buffer mode, callbacks
- `std::format` template overloads on all log methods

### Info (`fond/info/`)
- **ProjectInfo** — version, exit codes, project metadata with pybind11 bindings
- **VersionHelpers** — version bump/parse utilities

### MsgPack (`fond/msgpack/`)
- Binary serialization with `MSGPACK_DEFINE` macro (powered by `FOND_FOR_EACH`)
- Packer, Unpacker, Python packer/unpacker variants

### Lua (`fond/lua/`)
- Lua table serialization with `LUA_DEFINE` macro (powered by `FOND_FOR_EACH`)

### Macros (`fond/macros/`)
- **FOND_FOR_EACH** — preprocessor for-each over variadic args (generated, up to 100 args)

### Tools
- **ByteBuffer** — unified read/write byte buffer
- **Timer** — scoped timer with auto unit selection, lap times, `time_it()` lambda
- **EpochTimestamp** — configurable timestamp formatting
- **KeyStore** — file-backed key/value store using MsgPack
- **Locking** — mutex helpers (C and C++ variants)
