libfyaml is a high-performance YAML 1.2 and JSON parser/emitter with zero-copy operation, full document and event APIs, and the two major 1.0 features:
The 1.0 series adds a clear progression:
1.0.0-beta1 is the first beta for the 1.0 line. The main API areas are now in
place: the core parser/emitter API, the generic value API, reflection-based
typed serdes, Python bindings over generics, transparent parse caching, and
durable generic storage.
This release keeps the durable-storage and comment-handling work from alpha8
and adds smaller generic helpers that were missing from normal use:
The intent is to make common generic operations available through public entry points. Code can now ask whether a value is a short scalar, convert values to strings or numbers, iterate sequences with indexes, iterate mapping items, and format strings through a generic builder without using lower-level internals.
Transparent parse caching remains the main performance feature for repeated loads. It avoids reparsing unchanged content and can reuse deduplicated generic storage. Durable allocator support allows that state to persist across process runs.
This release also fixes several edge cases. Empty generic lists now use valid storage. Empty collections compare by value rather than backing address. Decorated scalar accessors unwrap correctly. Cached line-break scans are reused. Block scalars with many empty lines no longer keep pending line-break state on the stack.
The linker interface version advances for beta1 because the release adds public
generic APIs. CMake and Autotools both read the same .libtool-version, so
shared-library ABI naming stays aligned across build systems.
The center of the generic API is fy_generic.
fy_generic is the sum-type value used to represent YAML and JSON data in C.
It carries one runtime value of one type: null, bool, int, float, string,
sequence, mapping, or YAML-specific wrappers.
It is a single pointer-sized word with inline storage for common small values, including 61-bit signed integers on 64-bit builds, short strings, and inline 32-bit floats.
The rest of the generic API is about working with fy_generic values:
fy_generic values from C literals or parsed inputfy_generic into anotherThat gives C a Python-like data model:
fy_generic valuesfy_value(), fy_sequence(), and fy_mapping()If you know Python dict / list workflows, serde_json::Value,
tagged unions, or other sum-type/value-tree APIs, generics are the direct fit.
The reflection subsystem provides schema-driven typed serdes:
Reflection is the typed layer for stable C data models.
The Python binding in python-libfyaml/ is built on the
generic runtime. It is a direct bridge into the C generics API:
FyGeneric lazy wrappers mirror C fy_generic valuesSee the binding reference at
python-libfyaml/docs/API.md.
Choose the core library when you need:
Choose generics when you need:
Choose reflection when you need:
#include <libfyaml/libfyaml-generic.h>
fy_generic config = fy_mapping(
"server", fy_mapping(
"host", "localhost",
"port", 8080,
"tls", true),
"features", fy_sequence("http", "metrics", "admin"));
fy_generic doc = fy_parse(
"values: [1, 2, 3, 4]",
FYOPPF_DISABLE_DIRECTORY | FYOPPF_INPUT_TYPE_STRING,
NULL);
fy_generic values = fy_get(doc, "values", fy_invalid);
fy_generic first = fy_first(values);
#include <libfyaml/libfyaml-reflection.h>
struct fy_reflection *rfl = fy_reflection_from_c_file_with_cflags(
"schema.h", "", false, true, NULL);
struct fy_type_context_cfg cfg = {
.rfl = rfl,
.entry_type = "struct app_config",
};
struct fy_type_context *ctx = fy_type_context_create(&cfg);
Start with these pages:
doc/generics-guide.rst: value model, schemas, lifetimesdoc/reflection-guide.rst: typed serdes, libclang, packed blobsReference pages:
The refreshed examples directory now covers the new alpha workflows:
See examples/README.md for the full list.
libfyaml also remains:
find_package(libfyaml 1.0 REQUIRED)
target_link_libraries(your_app PRIVATE libfyaml::libfyaml)
If the installed package was built with libclang support, the CMake package also
exports libfyaml_HAS_LIBCLANG.
pkg-config --cflags libfyaml
pkg-config --libs libfyaml
Using CMake:
mkdir build && cd build
cmake ..
cmake --build .
ctest --progress -j"$(nproc)"
Using Autotools:
./bootstrap.sh
./configure
make
make check
llvm-dev libclang-dev: author reflection metadata directly from C headersSphinx documentation targets require the Python documentation toolchain:
sphinxsphinx_rtd_themesphinx-markdown-builderlinuxdocPDF documentation also requires a LaTeX toolchain with:
latexmkpdflatexxcolor.stywrapfig.styOn Debian/Ubuntu, the practical package set is:
python3 -m pip install sphinx sphinx_rtd_theme sphinx-markdown-builder linuxdoc
sudo apt-get install latexmk tex-gyre texlive-fonts-recommended texlive-latex-base texlive-latex-recommended texlive-latex-extra
Then build the docs with:
cmake --build build --target doc-html
cmake --build build --target doc-latexpdf
The binding lives in python-libfyaml/. Run its tests with:
cd python-libfyaml
python3 -m pytest tests/
The binding is part of the 1.0 release story and shows the generic runtime's
data model in regular use. v1.0.0-alpha3 improved the Windows story for the
binding, v1.0.0-alpha4 repaired the wheel and sdist packaging flow,
v1.0.0-alpha5 broadened build and CI coverage, and v1.0.0-alpha6 expands
generic formatting/document handling. v1.0.0-alpha7 adds transparent parse
caching, optimized generic emission, and Stable ABI Python wheels.
v1.0.0-alpha8 adds durable storage, auto-anchor emission, stronger comment
round-tripping, and more complete generic helper APIs. v1.0.0-beta1 starts
the beta cycle with additional conversion, predicate, iteration, formatting,
and correctness fixes on top of that alpha surface.
libfyaml is fully MIT licensed.
(top 30 of 36)
Hacker News (1)
C
85.5%
Assembly
5.1%
Python
3.9%
CMake
2.3%
M4
1.5%
Shell
1.3%
libfyaml is a high-performance YAML 1.2 and JSON parser/emitter with zero-copy operation, full document and event APIs, and the two major 1.0 features:
The 1.0 series adds a clear progression:
1.0.0-beta1 is the first beta for the 1.0 line. The main API areas are now in
place: the core parser/emitter API, the generic value API, reflection-based
typed serdes, Python bindings over generics, transparent parse caching, and
durable generic storage.
This release keeps the durable-storage and comment-handling work from alpha8
and adds smaller generic helpers that were missing from normal use:
The intent is to make common generic operations available through public entry points. Code can now ask whether a value is a short scalar, convert values to strings or numbers, iterate sequences with indexes, iterate mapping items, and format strings through a generic builder without using lower-level internals.
Transparent parse caching remains the main performance feature for repeated loads. It avoids reparsing unchanged content and can reuse deduplicated generic storage. Durable allocator support allows that state to persist across process runs.
This release also fixes several edge cases. Empty generic lists now use valid storage. Empty collections compare by value rather than backing address. Decorated scalar accessors unwrap correctly. Cached line-break scans are reused. Block scalars with many empty lines no longer keep pending line-break state on the stack.
The linker interface version advances for beta1 because the release adds public
generic APIs. CMake and Autotools both read the same .libtool-version, so
shared-library ABI naming stays aligned across build systems.
The center of the generic API is fy_generic.
fy_generic is the sum-type value used to represent YAML and JSON data in C.
It carries one runtime value of one type: null, bool, int, float, string,
sequence, mapping, or YAML-specific wrappers.
It is a single pointer-sized word with inline storage for common small values, including 61-bit signed integers on 64-bit builds, short strings, and inline 32-bit floats.
The rest of the generic API is about working with fy_generic values:
fy_generic values from C literals or parsed inputfy_generic into anotherThat gives C a Python-like data model:
fy_generic valuesfy_value(), fy_sequence(), and fy_mapping()If you know Python dict / list workflows, serde_json::Value,
tagged unions, or other sum-type/value-tree APIs, generics are the direct fit.
The reflection subsystem provides schema-driven typed serdes:
Reflection is the typed layer for stable C data models.
The Python binding in python-libfyaml/ is built on the
generic runtime. It is a direct bridge into the C generics API:
FyGeneric lazy wrappers mirror C fy_generic valuesSee the binding reference at
python-libfyaml/docs/API.md.
Choose the core library when you need:
Choose generics when you need:
Choose reflection when you need:
#include <libfyaml/libfyaml-generic.h>
fy_generic config = fy_mapping(
"server", fy_mapping(
"host", "localhost",
"port", 8080,
"tls", true),
"features", fy_sequence("http", "metrics", "admin"));
fy_generic doc = fy_parse(
"values: [1, 2, 3, 4]",
FYOPPF_DISABLE_DIRECTORY | FYOPPF_INPUT_TYPE_STRING,
NULL);
fy_generic values = fy_get(doc, "values", fy_invalid);
fy_generic first = fy_first(values);
#include <libfyaml/libfyaml-reflection.h>
struct fy_reflection *rfl = fy_reflection_from_c_file_with_cflags(
"schema.h", "", false, true, NULL);
struct fy_type_context_cfg cfg = {
.rfl = rfl,
.entry_type = "struct app_config",
};
struct fy_type_context *ctx = fy_type_context_create(&cfg);
Start with these pages:
doc/generics-guide.rst: value model, schemas, lifetimesdoc/reflection-guide.rst: typed serdes, libclang, packed blobsReference pages:
The refreshed examples directory now covers the new alpha workflows:
See examples/README.md for the full list.
libfyaml also remains:
find_package(libfyaml 1.0 REQUIRED)
target_link_libraries(your_app PRIVATE libfyaml::libfyaml)
If the installed package was built with libclang support, the CMake package also
exports libfyaml_HAS_LIBCLANG.
pkg-config --cflags libfyaml
pkg-config --libs libfyaml
Using CMake:
mkdir build && cd build
cmake ..
cmake --build .
ctest --progress -j"$(nproc)"
Using Autotools:
./bootstrap.sh
./configure
make
make check
llvm-dev libclang-dev: author reflection metadata directly from C headersSphinx documentation targets require the Python documentation toolchain:
sphinxsphinx_rtd_themesphinx-markdown-builderlinuxdocPDF documentation also requires a LaTeX toolchain with:
latexmkpdflatexxcolor.stywrapfig.styOn Debian/Ubuntu, the practical package set is:
python3 -m pip install sphinx sphinx_rtd_theme sphinx-markdown-builder linuxdoc
sudo apt-get install latexmk tex-gyre texlive-fonts-recommended texlive-latex-base texlive-latex-recommended texlive-latex-extra
Then build the docs with:
cmake --build build --target doc-html
cmake --build build --target doc-latexpdf
The binding lives in python-libfyaml/. Run its tests with:
cd python-libfyaml
python3 -m pytest tests/
The binding is part of the 1.0 release story and shows the generic runtime's
data model in regular use. v1.0.0-alpha3 improved the Windows story for the
binding, v1.0.0-alpha4 repaired the wheel and sdist packaging flow,
v1.0.0-alpha5 broadened build and CI coverage, and v1.0.0-alpha6 expands
generic formatting/document handling. v1.0.0-alpha7 adds transparent parse
caching, optimized generic emission, and Stable ABI Python wheels.
v1.0.0-alpha8 adds durable storage, auto-anchor emission, stronger comment
round-tripping, and more complete generic helper APIs. v1.0.0-beta1 starts
the beta cycle with additional conversion, predicate, iteration, formatting,
and correctness fixes on top of that alpha surface.
libfyaml is fully MIT licensed.
Hacker News (1)
(top 30 of 36)
C
85.5%
Assembly
5.1%
Python
3.9%
CMake
2.3%
M4
1.5%
Shell
1.3%