JFLib

Versions, the public API and the changelog#

JFLib has one version for the library and lets every app keep a version of its own. The library follows Semantic Versioning 2.0.0: the version says whether an app that built against the last release still builds against the new one. python build_rs.py api-diff checks that for the Rust API, python build_rs.py release cuts a release, and CHANGELOG.md lists what changed.

WhatWhere
The library's versionversion in Cargo.toml in the root folder, one for all crates; in code rt::VERSION (also plat::VERSION, ui::VERSION) and VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH
What the crates on crates.io promiseThe crates on crates.io below: the facade jflib, jflib-build, cargo-jflib
An app's versionversion= in apps/NAME/PACKAGE; in code rt::app_version!() (also ui::app_version!())
API snapshots of the releasesdocs/api/X.Y.Z.txt, written by build_rs.py release / api-diff --snapshot (tools/apidiff.py)
The changelogCHANGELOG.md (Keep a Changelog 1.1.0), tools/changelog.py
Teststools/tests/test_devkit.py (the suite runs it; the suite also prints the API changes since the last release)

Two kinds of versions#

The library is versioned as a whole: every crate under lib/, the styles, and the contract between an app and the build (the app folder: TARGETS, STYLE, PERMISSIONS, PACKAGE, BINS, assets/, tests/*.uis; the ui::main! / rt::main! entry points; the command line of every app; the script language). rt::VERSION is checked at compile time to be MAJOR.MINOR.PATCH.

An app keeps its own version in apps/NAME/PACKAGE (version=0.1.0 for a new app). The build hands it to every program of the app (JFGUI_VERSION), which reads it with rt::app_version!() -- an &'static str, "0.0.0" without a version=. The packages (PACKAGING.md) and the updater (UPDATES.md: update::Config::new("paint", rt::app_version!(), ..)) use the same value. The build refuses a version= that is not MAJOR.MINOR.PATCH (with an optional -pre / +build part). Raise it for every release of the app; the library's version does not change it.

const APP_VERSION: &str = rt::app_version!();
ui.text(TS_CAPTION, &format!("Version {} · JFLib {}", APP_VERSION, ui::VERSION));

The crates on crates.io#

JFLib is published as about sixty crates that share one version (CRATES.md). A program depends on one of them, jflib, and the promise of this page is made for what it reaches through it and for the two tools around it:

CrateWhat is promised
jflibevery crate it shows, by its path jflib::CRATE::..., as API.md documents it (the rules of "What is public" below); of the styles jflib::style::STYLE and jflib::style_NAME::STYLE; its features std (an app with std: plat::std_start, rt::panic_hook, rt::Alloc) and unwind (with std and panic = "unwind": rt::panic_take, rt::abort_on_unwind)
jflib-buildapp(), console(), Build::app(), Build::console(), .part_of(), .run() and the files it reads next to Cargo.toml: PERMISSIONS, PACKAGE, assets/, res/app.ico
cargo-jflibits commands and their options, the PACKAGE keys and environment variables its README names, where it writes (target/jflib-*)
the other jflib-* cratesnothing of their own: they are published because jflib needs them. A program may name one directly, but jflib pins every one to its own version (=X.Y.Z), so they move together. simd, text_shape and style_assets are building blocks, hidden in jflib (#[doc(hidden)])
jflib-installer, jflib-appimagertnothing: the setup stub and the AppImage runtime that cargo jflib package of the same version builds
jflib-modrt, jflib-modplatnot yet: loadable modules are built, but not tested for programs outside this repository

Not published and no part of it: the apps, build_rs.py and tools/ (and crates listed in REPO_ONLY of tools/gendoc.py: none since PaintCraft's plugin ABI went with the app, 2026-11). build_rs.py check keeps what jflib shows equal to what API.md documents (a crate that is neither documented nor hidden fails), and api-diff compares exactly that.

A crate of another author that a program adds itself is outside all of this, and outside PERMISSIONS too: its own system calls do not pass plat, which enforces the manifest. Only the sandbox line confines it, by the operating system's sandbox (PERMISSIONS.md).

What is public#

The public API is what API.md documents:

  • every item of the crates in the CRATES table of tools/gendoc.py (but REPO_ONLY) that another crate can name: pub items of the crate root and of pub mod modules, items re-exported with pub use (also through private modules and globs), the pub methods and fields of public types, every member of a public trait, #[macro_export] macros, the derives and impl Trait for Type of public types;
  • of the codec crates (img_png ... img_pdn) only the crate root, its re-exports and the items CODEC_EXTRA names: their other modules are building blocks for apps/codectest;
  • not: items marked #[doc(hidden)] (internal hand-overs such as plat::boot::permissions), pub(crate) and private items, rt::os (the OS calls plat is built on), simd, the style crates' own items (the ui::Style traits are public), anything in apps/.

Beyond the Rust items, these are part of the contract and are reviewed by hand at a release: the PERMISSIONS syntax (PERMISSIONS.md), the PACKAGE keys, the script language and the command line switches of ui::main! (GUIDE.md section 12), the app:// bundle and the app folder layout, the commands of build_rs.py.

Not covered: how a widget looks (styles may change pixels in any release), the exact text of messages, timings, the layout of private data, and behaviour that is documented as unspecified.

What each part of the version promises#

Change1.0 and laterwhile 0.x
a public item removed or renamed; a signature changed (parameter or return types, generics, unsafe, const); a field's type changedMAJORMINOR
a new variant of an enum without #[non_exhaustive]; a new required member of a public trait; a provided trait member that became required; #[non_exhaustive] addedMAJORMINOR
a derive or trait impl of a public type removed; an item that existed on every target became target-specificMAJORMINOR
a documented behaviour or the syntax of PERMISSIONS, PACKAGE or the script language changed incompatiblyMAJORMINOR
new items, new provided trait members, new variants of #[non_exhaustive] enums, new derivesMINORPATCH
a new public field of a struct whose other fields are public too (see below)MINORPATCH
a deprecationMINORPATCH
fixes, speed, documentation, internal changes, styles drawing differentlyPATCHPATCH

While the library is 0.x, the MINOR number counts incompatible changes and PATCH everything else, as Cargo treats 0.x versions: an app that built against 0.3.1 builds against every 0.3.y.

Struct fields. Rust counts a new public field as a breaking change when a program builds the struct as a literal. The library's descriptor structs come with an empty value (AppDesc::NONE, Default), and the guide asks for AppDesc { title: "..", ..AppDesc::NONE }, so a new field is a compatible addition here; api-diff lists it under "Notes". Code that lists every field without ..X::NONE may have to be extended.

Enums that grow are #[non_exhaustive], so a new variant is no break: every error enum, the GPU stack (gpu, wgsl, shader), and the open lists such as widget events, roles, states, formats and netpkt::decode::Proto (172 of 284 public enums). A program that matches one needs a _ arm. Exhaustive stay the enums a consumer must handle completely, where the compiler's demand for a new arm is the point: the document model (doc_core, its errors excepted; doc_io and doc_layout write every variant), the protocol messages of netpkt and eapm (a program that speaks a protocol handles each message), what ui handles completely (plat's events, states and answers, gpu::TryAcquire, gpu::PresentMode) and closed alternatives (Either, IpAddr, FingerPhase, a kind with an Other variant). A new variant there is breaking.

Parameter names are no part of a signature: renaming _id to id changes nothing for a caller, and api-diff ignores it, as it ignores line breaks and trailing commas.

Deprecations#

  1. Mark the item with #[deprecated(since = "X.Y.Z", note = "use ... instead")] (X.Y.Z: the release that brings the deprecation) and say what replaces it in its doc comment.
  2. The build turns warnings into errors (-D warnings): the library's own crates and apps stop using the item in the same change. Where a use must stay (a test of the old item), wrap it in #[allow(deprecated)] with a comment why.
  3. Add a changelog entry under "Deprecated" (build_rs.py changelog "..." --type deprecated).
  4. Keep the item for at least one release; remove it only in a release that may break (the next MAJOR, while 0.x the next MINOR), with an entry under "Removed".

api-diff lists new deprecations, and a removed item that was deprecated says so.

build_rs.py api-diff#

python build_rs.py api-diff                    # the sources against the newest docs/api snapshot
python build_rs.py api-diff --against 0.1.0    # ... against that release
python build_rs.py api-diff --all              # every line (default: 200 per group)
python build_rs.py api-diff --snapshot         # write docs/api/<the library's version>.txt

It reads the sources with gendoc's parser (no compiler), walks every crate's modules to find each item's public paths and keeps the shortest, so moving an item between modules that are re-exported changes nothing. A pub use into another crate of the library is followed there, so neither does moving a module or an item to another crate that the old crate re-exports it from (pub use formats::json; in agent_core). It prints four groups: Breaking (removed, changed, a new variant of an exhaustive enum, a new required trait member, ...), Deprecated, Added and Notes, then the version the next release needs. The exit code is 1 when there are breaking changes and the library's version is lower than that version, so it can guard a release or a CI job; between releases (the version still the last release) it flags every breaking change.

build_rs.py test prints a one-line summary (API since 0.1.0: 2 breaking, 0 deprecated, 14 added) and does not fail on it: breaking changes between releases are allowed, the release decides the version.

A snapshot has one line per item, sorted: PATH, KIND (fn, method, struct, field, enum, variant, trait, trait-fn, const, static, type, macro, impl, use ...), the signature (constants without their value) and flags (windows / linux for items of one target, deprecated, provided, all-pub, non-exhaustive). tools/apidiff.py describes the format and the rules in detail.

Releasing the library#

  1. python build_rs.py api-diff: read the breaking changes and decide the version.
  2. python build_rs.py changelog shows [Unreleased]; add what is missing, here and in the crates' changelogs (below). Rewrite the section "What's new in X.Y.Z" of every crate's README.md for the new version: a few sentences about its changelog, or that it has no changes of its own; examples that name a version (jflib = "X.Y") follow.
  3. python build_rs.py release X.Y.Z renames [Unreleased] to [X.Y.Z] - DATE (a new empty [Unreleased] above it) here and in every crate's CHANGELOG.md, writes the version to Cargo.toml and Cargo.lock and the snapshot docs/api/X.Y.Z.txt. It refuses a version that is not newer than the last release or too small for the API changes, and READMEs whose "What's new" names another version (--force cuts it anyway, with a warning; --date sets the date).
  4. python build_rs.py test --quick (both targets) and python tools/gendoc.py --check, then commit and tag: git tag vX.Y.Z. The tools never commit, tag or push.

The changelog#

CHANGELOG.md follows Keep a Changelog: newest release first, an [Unreleased] section on top, and in every section the groups Added, Changed, Deprecated, Removed, Fixed and Security. Entries are written for app authors (what they can use now, what they must change), grouped by area, not one line per commit.

python build_rs.py changelog                                       # show [Unreleased]
python build_rs.py changelog "Tables sort by column" --area ui     # Added (default)
python build_rs.py changelog "Wrong DPI on the second monitor" --type fixed --area plat

A branch adds its entries under [Unreleased] before it is merged. Apps note their own changes in their own files (for example apps/NAME/README.md), not here.

Each crate's README and changelog#

Every published crate has a README.md, the page crates.io and docs.rs show, and a CHANGELOG.md of its own, both in its folder and in its package. The README is written by hand for someone who lands on that page: what the crate is and why it exists, how it is used, a section ## What's new in X.Y.Z with a few sentences about the latest release, where the documentation is, the licence. Only absolute links: crates.io and docs.rs show the text away from the repository. The crate's changelog has this file's format; its entries are written from the crate's side, shorter than here, and an entry that changes several crates stands in each. A crate without changes says "No changes in this crate" under [Unreleased]; release turns that into the release's text, since all crates are released together.

python build_rs.py changelog "Tables sort by column" --crate ui     # here (area ui) and in lib/ui/CHANGELOG.md
python build_rs.py changelog "..." --type fixed --crate plat,rt     # here and in both crates' files
python build_rs.py changelog --crate ui                             # show [Unreleased] of lib/ui

--crate takes a folder (lib/ui), a package (jflib-ui) or a lib name (ui) and writes the same text into the crates' files; reword it there where the crate's side reads better. build_rs.py check reports a crate without these files, a README that is still the frame build_rs.py new --lib writes, a relative link, a missing or outdated "What's new", an example that names another version than the README is for (jflib = "0.1", jflib-0.1.*), and a changelog section that is no release of the library; tools/publish.py also wants every crate's changelog cut for the version it uploads.

Source: docs/VERSIONING.md in the JFLib repository.