Skip to content

Design: ship DuckDB extensions with flAPI instead of downloading them #245

Closed

Description

@jrosskopf

Problem

A fresh flAPI downloads its default DuckDB extensions (httpfs, ducklake, fts, postgres, sqlite; ~50 MB per platform) from extensions.duckdb.org on first start. That costs start-up time (measured on 2.0.1: first start with an empty extension directory 1.8 s, of which the download is almost all), needs outbound network at runtime, and makes air-gapped and serverless deployments depend on FLAPI_EXTENSION_DIRECTORY + FLAPI_EXTENSIONS_OFFLINE being set up by hand. flapi pack --with-extensions already embeds extensions, but only in a binary the user builds.

Context from the DuckDB 2.0 upgrade (#241): core_functions, parquet, json and icu are now linked into the binary; extensions are published per DuckDB version (v2.0.1/<platform>/), so any shipped copy must be refreshed with every DuckDB bump.

Options

A. Ship with releases B. Link into the binary C. Pack by default
What release archives, wheels and the Docker image carry extensions/v<duckdb>/<platform>/ next to the binary; flapi picks it up automatically (before the user dir, after FLAPI_EXTENSION_DIRECTORY) build httpfs, ducklake, fts, postgres, sqlite statically (out-of-tree extension builds) flapi pack embeds the config's extensions unless --without-extensions; document a pre-populated dir for Docker
Download at runtime only for extensions outside the default set never for the defaults only for unpacked binaries
Works offline out of the box yes yes only packed binaries
Release size +50-80 MB per platform archive/wheel (signed .duckdb_extension files) binary +40-70 MB (estimate) unchanged
CI cost low: download + verify signatures in the release job high: out-of-tree builds on 4 platforms (postgres needs libpq/OpenSSL), longer builds, extension patches per DuckDB bump none
Extension bug fix without a flapi release user can INSTALL ... FORCE into the user dir, or flapi release needs a flapi release user can re-pack
Signature check kept (official signed files) n/a (compiled in) kept
Risk dir lookup order and version mismatch must be tested build complexity, ABI coupling small

Recommendation (for discussion)

A, with C as a cheap complement: releases (archives, wheels, Docker) carry the signed default extensions for their DuckDB version and platform; flapi uses them read-only and never writes there; downloads stay possible for anything else unless offline. B only if a deployment target cannot carry files next to the binary.

Tests (real binary)

  • Fresh host, no network (docker run --network none, empty HOME): every default extension loads from the shipped dir, startup does no network I/O.
  • FLAPI_EXTENSION_DIRECTORY still wins; a user-installed newer copy wins over the shipped one (or not: decide).
  • Version mismatch (shipped dir for another DuckDB version) is ignored with one clear log line.
  • Wheel install (pip install flapi-io) finds the dir inside the package.
  • flapi pack --with-extensions and the shipped dir do not double-load.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions