Repository navigation
Packaging and Releases
Checked against v0.7.6 on November 13, 2026.
Kestrel ships as a double-clickable desktop app on Windows, macOS and Linux. PyInstaller freezes the Python app into a folder, and a per-OS script wraps that folder in an installer. A release is one git tag: CI builds all three installers, publishes them to a GitHub Release, and writes the update feed latest.json to the website repository.
The maintainer's step-by-step procedure, including the one-time secrets setup, is in docs/RELEASING.md. This page explains how the pieces fit and what goes wrong in a frozen build. For the process model of the running app, see Architecture overview.
packaging/kestrel.spec is the single PyInstaller spec for all three platforms. It builds in one-folder mode, never one-file. A one-file build unpacks itself to a temporary directory on every launch, which is slow and tends to trip antivirus heuristics. The entry point is kestrel/desktop/__main__.py on every platform.
That entry point does two jobs. With no arguments it opens the desktop app. With any argument it runs the kestrel command line, so the same executable serves both:
Kestrel.exe opens the window
kestrel-cli.exe doctor --quick Windows console twin, runs the CLI
Kestrel.app/Contents/MacOS/Kestrel doctor --quick macOS
./Kestrel-0.7.0-x86_64.AppImage doctor --quick Linux
Windows gets a second executable from the same build because a windowed program has no console to print CLI output to. kestrel-cli.exe shares the same _internal folder, so it adds a few hundred kilobytes, not a second copy of the app. It cannot be called kestrel.exe, since NTFS is case-insensitive and that would collide with Kestrel.exe.
| Platform | Script | Output | Notes |
|---|---|---|---|
| Windows | packaging/build_windows.ps1 |
dist/Kestrel-Setup-<version>.exe |
Inno Setup 6 script packaging/kestrel.iss. Installs without admin rights to %LOCALAPPDATA%\Programs\Kestrel. |
| macOS | packaging/build_dmg.sh |
dist/Kestrel-<version>.dmg |
A Kestrel.app bundle (identifier com.kestrel.desktop, minimum macOS 13) inside a disk image with an Applications link. |
| Linux | packaging/build_appimage.sh |
dist/Kestrel-<version>-x86_64.AppImage |
AppRun forwards every argument to the frozen binary, so the AppImage is also the CLI. x86_64 only. |
The version comes from one place, __version__ in kestrel/__init__.py. Hatch reads it for the package, the spec reads it for the bundle, the scripts read it for file names, and the window title, /health and /about report it. The Inno Setup include packaging/version.iss is generated from it by packaging/gen_version_iss.py, and build_windows.ps1 regenerates it on every build.
Install and data are separate. On Windows the installer never touches %LOCALAPPDATA%\Kestrel, where the database, settings and .env live. The uninstaller asks whether to delete that folder, defaults to No, and a silent uninstall always keeps it.
Two things have to exist before PyInstaller runs, and the spec stops the build if they are missing:
-
The in-process embedding model. About 90 MB of ONNX weights, fetched and checked against a SHA-256 by
scripts/fetch_embed_model.pyintokestrel/resources/embed_model/. It is never committed. Without it, installs that use a hosted model would have no embeddings at all, so the spec refuses to build rather than ship that. -
A full dependency install. The spec generates the third-party license notices from the build environment's metadata and aborts if it finds fewer than 50 packages, which means
kestrelwas not installed properly.
uv sync --extra dev
uv run python scripts/fetch_embed_model.py
PYTHON=.venv/bin/python packaging/build_appimage.shEach script accepts --skip-build (-SkipBuild on Windows) when dist/ already holds a build.
Ollama, its models and Chromium are not bundled. The app talks to the Ollama the user installed, and PDF rendering uses a browser already on the machine (see below).
A frozen app fails in ways the source tree never does, usually on the first launch on a clean machine. The code already handles these, and most have a test in tests/test_packaging.py or a neighboring file.
| Trap | What the code does |
|---|---|
multiprocessing re-runs the entry point in child processes |
multiprocessing.freeze_support() is the first statement under __main__, and the module top level holds imports only (kestrel/desktop/__main__.py). A test pins the order. |
In a windowed build, sys.stdout and sys.stderr are None
|
_repair_streams() replaces them with files in the logs folder before anything logs. Without it, the first log call raises AttributeError. |
macOS Finder can pass -psn_<n>
|
cli_args() drops it, so a double-click does not look like a CLI command. |
| Modules imported by string are invisible to PyInstaller | The page routers (kestrel.web.pages, loaded by name in web/app.py) and the signal source adapters are listed as hidden imports. Collecting all of kestrel crashes PyInstaller's analysis subprocess (it drags in jobspy, pandas and scipy together), so only those two packages are collected. |
| Starlette imports its form parser by string |
python_multipart and multipart are hidden imports; form posts would fail only in the frozen app. |
Package data is not on __file__-relative paths |
Config, prompts, templates and static files load through importlib.resources (kestrel/paths.py) and ship as datas. The spec collects resources/**/* and web/static/**/*, among others, so new files in those folders need no spec change: the Manrope interface font under web/static/fonts/manrope and the ISO 3166 country table resources/iso3166.csv (read by the ingest location parser) are examples. test_every_package_data_file_is_shipped fails if a non-Python file under kestrel/ matches no include pattern. |
| Alembic cannot import its migrations from the archive |
versions/*.py ship as data files, keeping the kestrel/ prefix, and the config uses an absolute script_location and a plain sqlite:// URL. See Database schema. |
tiktoken downloads its encoding on first use |
cl100k_base is vendored in kestrel/resources/tiktoken_cache, and kestrel/ingest/tokens.py points TIKTOKEN_CACHE_DIR at it, so tokenizing works offline. |
| JobSpy's HTTP library is a native extension with a sibling folder | JobSpy 1.3.0 uses curl_cffi, which loads libcurl-impersonate from a delvewheel folder named curl_cffi.libs next to the package. That folder is not a Python package, so packaging/kestrel.spec adds its files to the bundle root by name beside collect_all("curl_cffi"). The earlier tls_client Go library and the Windows preload in kestrel/__init__.py are gone, because the same native libraries now load cleanly in either order (tests/test_native_load_order.py guards that). |
| scikit-learn's worker pool relaunches the app | The reranker uses HistGradientBoostingRegressor, which does not start a loky pool (kestrel/learning/reranker.py). When frozen, kestrel/__init__.py also sets OMP_NUM_THREADS, OPENBLAS_NUM_THREADS and MKL_NUM_THREADS to 1 unless the user set them. |
| Pickled models are tied to a scikit-learn version |
ml_model.sklearn_version is recorded; a mismatched artifact is refused and Tier 1 falls back to the language model. |
| PDF rendering needs a browser | Playwright tries KESTREL_BROWSER_PATH, then Edge, then Chrome, then Playwright's own Chromium (launch_plan in kestrel/docs/render.py). The installer bundles none of them. |
| A second launch must not start a second app | Windows uses a Local\Kestrel mutex for the default data folder (Local, not Global, which needs a privilege and blocks a second Windows user); a custom data folder gets Local\Kestrel-<8 hex> from a hash of its real path. macOS and Linux use an exclusive flock on kestrel.lock. A lock only detects, so the second instance posts /api/focus to the running one, found through runtime.json. |
| The installer overwrites a running app |
kestrel.iss sets AppMutex=Local\Kestrel, which must match MUTEX_NAME in kestrel/desktop/shell.py byte for byte. A test checks it. |
| No GTK WebKit on Linux |
pywebview cannot open a window, so the shell falls back to the default browser and shows what is missing (kestrel/desktop/linux_check.py). |
| LGPL libraries inside a compiled archive |
pystray and python-xlib are collected as plain .py files (module_collection_mode), so a user can replace them as the license requires. |
On Linux the AppImage mounts itself with FUSE and needs libfuse2 on the machine that runs it. Where it is missing, run it with --appimage-extract-and-run, as the header of build_appimage.sh and docs/RELEASING.md both say. The build pins the AppImage runtime by SHA-256.
uv run pytest cannot see most of these. After a packaging change, run the frozen binary:
export KESTREL_DATA_HOME="$(mktemp -d)"
./dist/Kestrel/kestrel version
./dist/Kestrel/kestrel doctor --quickCI does the same on each platform before it uploads anything. Each build job runs version and doctor --quick. The doctor step cannot fail the job (|| true on Linux and macOS, an explicit exit 0 on Windows), so version is the real gate and the doctor output is there for you to read.
.github/workflows/release.yml runs when a tag matching v* is pushed. A manual run (workflow_dispatch) is a dry run: it builds installers and uploads them as workflow artifacts, with no release. The dry run can build one platform, which matters because macOS minutes cost 10x and Windows 2x. A tag push always builds all three, so a published release can never lack an installer.
preflight, then linux + macos + windows in parallel, then release, then website
| Job | Does |
|---|---|
preflight |
Runs scripts/changelog_section.py for the version and fails early if the CHANGELOG.md section is missing. It fails a tag push whose version differs from __version__ in kestrel/__init__.py (a prerelease suffix is ignored), and a tag whose GitHub Release is already published. For a stable tag it also checks that the WEBSITE_TOKEN secret is set, before any installer is built. |
linux, macos, windows
|
Fetch the embedding model, build, smoke-test the frozen CLI, write a SIGNING-<platform>.txt marker, upload artifacts. |
release |
Downloads the artifacts, writes SHA256SUMS.txt and a combined SIGNING.txt, builds the release body from the CHANGELOG section plus the signing lines, creates the GitHub Release as a draft titled Kestrel vX.Y.Z (the tag name after "Kestrel "), uploads every installer to it, and only then publishes it. A tag with a hyphen (v0.6.0-rc.1) is marked as a prerelease. |
website |
Stable tags only. Builds latest.json and commits it to the website repository. |
The release job does not write latest.json. The separate website job does, after release succeeds.
The installers are named from __version__, while the release and the changelog check use the tag, so preflight requires the two to match. Bump the version, commit, then tag.
The public repository has immutable releases: a published release takes no more uploads, and its tag can never be reused, even after the release is deleted. Create a release only by pushing a tag. If someone publishes a release for the tag from the Releases page before the build ends, it is stuck without installers and the version has to move on. That happened to 0.6.0: the tag was made but the release was never published with installers, so 0.6.1 is the first release of those changes. The release job therefore uploads to a draft and publishes it with a PATCH that sets draft=false, and preflight fails early if the tag already has a published release. A draft is invisible to the read-only preflight token, so a draft left by a failed run does not block a re-run. tests/test_packaging.py pins both steps.
A version is three plain numbers, MAJOR.MINOR.PATCH, with no leading zero in any of them. Within a milestone, small steps count up by one and a feature step jumps to the next ten, so the sequence runs 0.8.0, 0.8.1, 0.8.10, and the third number is compared as a number, not as text. While the major number is 0, any minor release may change behavior, so read the notes before updating. Release candidates such as 0.8.0-rc.1 are never offered as updates: the update checker reads only latest.json, and the feed builder refuses a hyphenated version (scripts/build_latest_json.py) and the website job skips such a tag. The user-facing explanation is at kestrelapp.co/docs/versions.
Builds are unsigned unless the signing secrets exist, and an unsigned build is a working release. Windows SmartScreen asks for "More info, Run anyway" once, and macOS Gatekeeper needs a right-click, Open once. build_windows.ps1 signs with signtool when WINDOWS_CERT_PFX_BASE64 and WINDOWS_CERT_PASSWORD are set. build_dmg.sh signs every Mach-O file inside out with the hardened runtime when APPLE_SIGNING_IDENTITY is set, and notarizes when the Apple ID variables are also present. Linux has no signing path, so SHA256SUMS.txt is the integrity check. The release body states which installers are signed, so nobody downloads an unsigned one without being told. The secret names and setup are in docs/RELEASING.md.
scripts/build_latest_json.py builds the feed from the release's own files: SHA256SUMS.txt, SIGNING.txt and CHANGELOG.md. It refuses a prerelease version and a version with no changelog section, and it validates the result by parsing it back through the same LatestFeed model the app uses.
{
"schema": 1,
"version": "0.5.0",
"published_at": "2026-10-18T12:00:00Z",
"download_page": "https://kestrelapp.co/download",
"downloads": {
"windows": {
"file": "Kestrel-Setup-0.5.0.exe",
"url": "https://github.com/distantsoil/Kestrelapp/releases/download/v0.5.0/Kestrel-Setup-0.5.0.exe",
"sha256": "<64 hex characters>",
"signed": false
}
},
"releases": [
{ "version": "0.5.0", "date": "2026-10-18", "notes_md": "### New\n- ..." }
]
}The real file also has macos and linux entries. releases holds the last 10 non-prerelease changelog sections, newest first.
The website job copies the file into the website repository (distantsoil/kestrelapp-site by default, set by the WEBSITE_REPO variable) with the WEBSITE_TOKEN secret, and Cloudflare Pages rebuilds on push. If the file is unchanged, the job pushes nothing.
On the app side, kestrel/services/updater.py polls https://kestrelapp.co/latest.json every 24 hours (the updates section of settings, on by default) and shows the release notes. It only asks. Nothing in Kestrel downloads or installs an update. The user downloads the installer from the website, and the buttons there link to the GitHub release assets because Cloudflare Pages caps each file at 25 MiB.
tests/test_packaging.py is a set of static checks on the packaging files themselves, so a broken installer script or workflow fails on a pull request, not at release time. It asserts, among other things:
- the spec parses, stays one-folder and windowed, and carries the hidden imports and data files above;
- the workflows name all three artifacts, mark unsigned ones, and keep the website job limited to real stable tags;
-
WEBSITE_TOKENappears only as the checkout token input; - the
.isshas no stray preprocessor lines, installs the one-folder output, and offers data cleanup safely; - the AppImage script pins its tools by checksum;
- the spec ships JobSpy's
curl_cffilibrary and itscurl_cffi.libsfolder, and the app never imports a module the spec excludes.
On Windows, ci.yml also compiles the real kestrel.iss against a stub program folder, so the Pascal in its [Code] section is checked on every pull request.
Kestrel never submits applications, sends messages or acts on third-party sites for the user, and the installers do not change that. The installer adds no startup behavior unless the user ticks the optional "launch at login" task on Windows. The app, once running, only fetches public pages, calls the model the user configured, and writes to the local data folder. See Security and privacy model.
- docs/RELEASING.md for the release procedure and signing secrets.
-
Testing for
scripts/check.py, which runs the packaging guards. - Contributing for commit and CI conventions.
Start here
Interfaces
Extending Kestrel
How it works
- Prompts and context budgets
- Document engine
- Learning loop internals
- Analytics internals
- Task queue and concurrency
- Database schema
Shipping and safety
- Packaging and releases
- Preflight and diagnostics
- Security and privacy model
- Outbound calls
- Benchmarking
Workarounds and Troubleshooting