Skip to content
datakidPublic

About

Floe. Data preparation for web and desktop, with Parquet streaming by row group.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Floe 1.1 — data preparation, web and desktop

What's new since 1.1

  • Parquet streaming on the web (js/parquet.js):
    • Reads only the footer metadata first.
    • Decodes row group by row group, and only the columns the query needs. Projection is worked out from the steps: Select, Remove, Group by, formulas, and so on.
    • Previews stop after the row groups that cover the preview row count.
    • Large files stay as a lazy Blob (or OPFS file) and are read in byte slices, so the whole file is never copied into memory.
    • Decoded columns are cached in an LRU with a budget of about 30M cells.
    • Progress shows "row group i of n · k of m columns".
    • Filter pushdown: full runs and exports skip row groups whose min/max statistics show that a leading Filter can't match.
      • Operators: = <> < <= > >= in, combined with and / or.
      • Columns: int, number, ASCII text and date.
      • Constants: literals, parameters or constant expressions.
      • Only Filters reached through column-only steps (select/remove/reorder) are used, so results are identical to an unpruned run.
      • The status note reports "N skipped by filter statistics".
  • Column projection in the UI:
    • The Parquet navigator has column checkboxes.
    • The Source step has a column picker.
    • The Python export adds .select([...]) after pl.scan_parquet.
    • The Polars JSON plan carries the projection.
  • floe CLI (scripts/floe.mjs, Node 18+, no dependencies). It runs the same built-in JS engine headlessly:
    node scripts/floe.mjs run project.floe [--query <name>] [--format csv|tsv|xlsx|parquet|arrow] [--data <dir>] [--out <dir>] [--param k=v]
    node scripts/floe.mjs inspect data.parquet [--rows 20] [--json]
    node scripts/floe.mjs python project.floe [--query <name>] [--out script.py]
    node scripts/floe.mjs plan project.floe --query <name>
    
    Exit codes: 0 ok · 1 query failed · 2 usage · 3 input missing. npm link installs it as floe.
  • Tests: 137 golden tests in tests.html, the UI end-to-end test in tests-ui.html, the release-script unit tests in .github/scripts/test_release_notes.py, and the Rust tests in engine/tests (plan.rs, ops.rs, sql.rs, cancel.rs and parity.rs, which runs the 418 fixtures from scripts/gen-fixtures.mjs against the built-in engine and compares every column's profile and distinct values). npm run test:engine in desktop runs the Rust tests and prints their count.

What's new in 1.1

  • Engine indicator in the status bar: ● Built-in · 42 ms · Sample 1,000. Click it (or press Enter on it) for engine, location, last run, data scope and, on desktop, why that engine ran. The dot shows idle, busy, starting or error. On phones it shrinks to the dot and engine name.
  • Polars engine for desktop (optional build, --features polars-engine):
    • js/plan.js lowers a query into a JSON plan, or refuses with a reason naming the step.
    • desktop/src-tauri/engine (crate floe-engine, Polars 0.55, calamine, rust_xlsxwriter) executes the plan.
    • Pages come back as Arrow IPC. Exports are written straight to the chosen path.
    • Anything Polars can't run falls back to the built-in engine automatically, and the indicator shows Built-in ↺ with the reason.
  • Web ships no native-engine code. native-engine.js is loaded only inside Tauri and is excluded from the web build.
  • Engine tests:
    • Rust: engine/tests/plan.rs (plan lowering), engine/tests/cancel.rs (cancellation between steps).
    • engine/tests/parity.rs runs the shared cases generated from the built-in engine by scripts/gen-fixtures.mjs and requires Polars to give the same schema and rows, including half-way rounding cases.
    • engine/tests/ops.rs checks the column profile, distinct values, grid pages and exports against the built-in engine.
  • Faster built-in engine:
    • CSV parsing writes straight into columns (about −30%).
    • Pivot uses streaming accumulators (−60%).
    • Previews of large CSVs decode only the first 4 MB.
    • Benchmark with bench.html; results go in docs/BENCH.md.
  • Signing: opt-in through the repository variable SIGNING=on plus secrets; see docs/SIGNING.md.

Clean and reshape messy spreadsheets with replayable steps. Excel, CSV, JSON, Parquet and Arrow IPC in; Excel, CSV, Parquet, Arrow or a Polars Python script out. Everything runs locally — files are never uploaded.

One codebase ships two ways:

Web (Vercel / any static host) Desktop (Tauri 2)
Engine Built-in columnar JS engine in a Web Worker Built-in engine; Polars in the polars build for supported queries
Files File System Access API on Chromium, copies elsewhere Native open/save dialogs, real paths, files stay linked
Save In-place on Chromium, download elsewhere In-place atomic write to the .floe file
Refresh Re-reads linked files that changed Re-reads files whose size/mtime changed on disk
Offline Service worker + PWA install Always offline
OS integration PWA file handlers, share target File associations, drag & drop, single instance, macOS menu, unsaved-changes guard on close

Repository layout

index.html, demo.html, 404.html     app pages
tests.html, tests-ui.html           engine golden tests (137) · UI end-to-end smoke test (web build only)
css/app.css                         "Clay" design system
js/                                 engine (worker), platform layer, UI
js/native-engine.js                 optional Polars adapter; idle unless a desktop engine reports itself available
vendor/                             SheetJS, AlaSQL, apache-arrow, hyparquet(+writer, compressors), Font Awesome (+webfonts)
fonts/                              Instrument Sans, Source Serif 4, JetBrains Mono (variable woff2)
images/                             floe-icon.svg (app icon source), floe-icon-maskable.svg, floe-mark.svg, raster jpgs
manifest.webmanifest, sw.js         PWA
scripts/build-web.mjs               single build script for both targets
scripts/floe.mjs                    headless `floe` CLI (built-in engine under Node)
js/parquet.js                       Parquet metadata, row-group/range planner, projected column scan
package.json                        root version (source of truth) + build scripts
vercel.json, .vercelignore          web deploy
desktop/                            Tauri 2 shell (never uploaded to Vercel)
  package.json, scripts/ensure-icons.mjs
  src-tauri/Cargo.toml, build.rs, tauri.conf.json, capabilities/default.json, src/main.rs, src/lib.rs
.github/workflows/                  ci.yml (web build + tests, engine tests, Windows installers) · release.yml (tagged pre-release)

Build

scripts/build-web.mjs copies only what each target needs into an output folder and validates it:

  • verifies package.json, PQ.VERSION (js/util.js) and, for desktop, tauri.conf.json versions match;
  • fails if a required vendor/font/icon file is missing;
  • web: stamps sw.js with a content-hashed cache name (floe-1.0.0-<hash>) so every deploy invalidates old caches automatically, and fails if sw.js precaches a file that is not in the build;
  • desktop: omits sw.js and the test pages;
  • writes version.json ({version, build, target, builtAt}).
node scripts/build-web.mjs --target web       → dist/
node scripts/build-web.mjs --target desktop   → desktop/dist/

No npm dependencies are required for the web build.

Deploy the web app (Vercel)

vercel.json is the full instruction set: framework: null, installCommand is a no-op, buildCommand runs the web build, outputDirectory is dist. Just import the repo (root directory = repo root) or run vercel --prod. Project settings in the dashboard should be left on "Other / override off" so vercel.json wins.

.vercelignore keeps desktop/, .github/, target/, node_modules/ and local dist/ out of the upload, so Rust sources and Tauri build artefacts never reach Vercel and never get touched by it.

Headers: CSP ('unsafe-eval' is required by AlaSQL for Custom SQL steps), nosniff, frame/permissions policies, long caching for vendor|fonts|images, no-cache for sw.js, the manifest and version.json. /share-target falls back to a 303 redirect when no service worker is active.

Build the desktop app (Tauri 2)

Prerequisites: Node 18+, Rust stable, and the Tauri system prerequisites (WebView2 on Windows, libwebkit2gtk-4.1-dev on Linux, Xcode CLT on macOS).

cd desktop
npm install
npm run dev        # stages desktop/dist, generates icons if missing, opens the app
npm run build      # installers in desktop/src-tauri/target/release/bundle/

Icons are generated from images/floe-icon.svg into desktop/src-tauri/icons/ on first dev/build (npm run icons to regenerate).

CI and pre-alpha releases

.github/workflows/ci.yml runs on every push to main, every pull request, and on demand:

  • Web build and tests: builds the web and desktop frontends, runs scripts/check-python-export.mjs (the exported Python script against the app's engine on 333 cases (every step type, every formula function, every file source and output format, parameters and locales), needs pip install polars fastexcel xlsxwriter openpyxl), then tests.html (unit) and tests-ui.html (end-to-end) in headless Chromium.
  • Polars engine tests: cargo test on floe-engine, including the parity suite.
  • Windows installers: builds the NSIS installer for both variants (built-in engine and Polars) and uploads them as artifacts (kept 14 days).

.github/workflows/release.yml builds both Windows installers and both Linux .deb packages and publishes them on the Releases page with SHA-256 files and the Linux test table. Push a tag to start one:

git tag v1.1.0-alpha.1
git push origin v1.1.0-alpha.1
  • The version in the tag is written into package.json, js/util.js, desktop/package.json and tauri.conf.json, so the build's version check passes without hand edits.
  • A tag with a suffix (-alpha.1, -beta.1) is published as a pre-release. A plain tag such as v1.1.0 is a normal release.
  • It can also be started from the Actions tab (Run workflow) with a tag name.
  • Builds are unsigned and have no auto-update. macOS builds are not part of the workflows yet. Linux is described in docs/LINUX.md: what is built, how it is tested on Ubuntu 22.04, 24.04, 26.04 and 26.10, and what that does not cover.

Desktop shell (src-tauri/src/lib.rs)

Commands used by js/platform.js:

Command Purpose
app_info version, Tauri version, OS
pick_files {kind, multiple} / pick_folder / pick_save {defaultName} native dialogs
read_file {path} raw bytes (binary IPC response)
write_file (raw body, x-path header) atomic write via temp file + rename
file_stat {path} size + mtime for change detection
take_launch_files files passed on the command line / "Open with" before the UI was ready
engine_status / engine_cancel report no native engine (keeps the adapter idle)

Security: the shell only reads or writes paths the user granted through a dialog, a drop or "Open with" (persisted in the app data dir as granted-paths.json), so the webview cannot read arbitrary files. CSP is strict ('self', no remote origins). Capabilities grant only core window/title/close and dialog permissions.

Events emitted to the UI: floe://menu (macOS menu), floe://files-dropped, floe://open-project, floe://open-data. The window close request is routed through the same Save / Don't save / Cancel guard as the web app.

Entry points

Path Purpose
index.html App
demo.html Fresh workspace with the sample project
index.html?demo Load samples if the project is empty
index.html?q=<query>&step=<n> Open a query at a step
index.html?pane=queries|data|steps Mobile pane
index.html?open=python|merge|deps|files|nav|params|custom|palette Open a dialog
index.html?shared=1 Import files received through the PWA share target
share-target (POST) Web Share Target endpoint (service worker)
version.json Deployed build info
tests.html, tests-ui.html Test pages (web build only)
bench.html Engine benchmark, 100k–1M rows (web build only)

Data model

  • Project (.floe): stable-key JSON {format_version, name, settings:{previewRows, locale}, params[], queries[{id, name, load:{target}, steps[{id, name, kind, note?, disabled?}]}]}.
  • File record (IndexedDB pqx-files/files): {id, name, size, mtime, folder, path, buf | opfs:true}. On desktop path is the real path used for refresh.
  • Web KV (IndexedDB floe-web/kv): file handles, project handle, recent list.
  • localStorage: floe.project.v1, floe.ui, floe.theme, floe.panes, floe.fileName, floe.filePath (desktop), floe.savedHash.

What changed for 1.0

  • Shippable build pipeline for web and desktop with version and asset checks; content-hashed service-worker cache.
  • Fixed Vercel config (outputDirectory: dist, explicit build, no framework detection) and added .vercelignore so desktop/ is never uploaded.
  • Added the missing pieces the app referenced: manifest.webmanifest, Font Awesome webfonts, the three UI fonts, SVG icons (floe-icon.svg, floe-icon-maskable.svg, floe-mark.svg).
  • Complete Tauri 2 shell: dialogs, binary IPC, atomic saves, path grants, drag & drop, file associations, single instance, launch files, macOS menu, close guard.
  • Desktop refresh re-reads changed files from disk; F5 / Ctrl+E / Ctrl+, are bound on Windows and Linux. The Linux smoke test presses Ctrl+, only; F5 and Ctrl+E are not pressed by any test, and nothing presses a shortcut on Windows.
  • UI no longer advertises Polars or a floe CLI when they are not installed: Settings hides the engine toggle, Automate… exports a Polars script, About shows "Built-in engine".
  • demo.html uses an external script (works under the strict desktop CSP).

Polars engine (desktop)

cd desktop && npm install
npm run dev:polars        # or: npm run build:polars
npm run test:engine       # cargo tests for floe-engine

CI builds both variants for Windows: Floe_* uses the built-in engine and Floe-polars_* adds Polars. The polars variant installer is about 10 MB larger (12.45 MB against 2.67 MB at 3120c24).

Polars covers:

  • Sources: CSV (UTF-8), Parquet, Arrow IPC, Excel sheets and ranges, entered data, query references.
  • Columns: choose/remove/reorder, rename, change type and custom columns (locale-aware, with per-cell error flags: a formula that divides by zero, takes the square root of a negative number, uses an input error cell or overflows gives a cell error, as in the app), split (delimiter, first, last, into rows, by positions including negative ones), merge columns, custom and conditional columns, index, duplicate.
  • Rows: filter, sort, distinct, keep duplicates, keep rows, promote headers, fill down/up.
  • Values: replace values, replace/remove/keep errors, text transforms (except Proper), round.
  • Reshaping and combining: group by (count, distinct count, sum, average, median, standard deviation, variance, mode, percentile, min, max, first, last, concatenate), unpivot, pivot, merge (all join types), append, window columns (running total, running max and min, row number, rank, dense rank, change and % change from previous, previous and next value, percent of total, moving average, rolling sum, min, max and std deviation).
  • Formula functions: the text, number, date and logic functions listed in PQ.Plan.FUNCS.
  • Custom SQL, for the statements described under "Custom SQL on Polars" below; every other statement runs on the built-in engine with the reason shown.

Runs on built-in (with the reason shown):

  • Sources: Excel tables, named ranges, multi-sheet sources, merged-cell fill, non-UTF-8 CSV, a CSV file with blank lines between its rows (the app skips them, Polars would read them as rows of nulls; blank lines after the last row are fine), pasted files. Folders of CSV, Parquet, Arrow or JSON files run on Polars, combined in name order with the file-name column first and missing columns as null; a folder falls back if a column has different types in different files, a file already has the file-name column, or a file is an Excel workbook. JSON runs on Polars when it has the same shape the built-in reader accepts; a JSON column that mixes value types or is all null, a single object whose array property would become the rows, rows that are not objects, integer-like keys and non-UTF-8 text fall back.
  • Steps: ClusterValues, Validate, Transpose, DemoteHeaders, Proper case, and Custom SQL that is not one of the lowered shapes. Transpose and DemoteHeaders produce columns that hold values of different types, which a Polars column cannot; Expand JSON runs on Polars for object cells and falls back for arrays, invalid JSON, mixed-type or all-null fields; ClusterValues, Validate and Text.Similarity have no Polars equivalent and stay on the built-in engine.
  • Formula functions without a Polars mapping: Text.Similarity, Text.Fingerprint, Text.RemoveDiacritics, Text.Proper, Date.From and Value.IsError. Dialog previews also stay on built-in.

Custom SQL on Polars: Custom SQL is lowered to Polars only when js/plan.js can read the whole statement and every part of it is one that was checked against the built-in engine (AlaSQL) on the same data. The text sent to Polars is rebuilt from what was read, never passed through. The two engines read SQL differently in many small ways, so everything else keeps running on AlaSQL, and a Polars error at run time falls back to it as well.

  • Lowered: one SELECT of plain columns or *; named expressions (AS is required); AND, OR, parentheses, =, <>, !=, <, <=, >, >=, IS [NOT] NULL, IN and NOT IN lists of numbers or text, BETWEEN; +, -, *, and / and % by a non-zero number; CASE WHEN, COALESCE; COUNT(*), COUNT, COUNT(DISTINCT), SUM, AVG, MIN, MAX; GROUP BY, HAVING, ORDER BY, LIMIT with OFFSET; INNER and LEFT joins on column equalities between self, other queries (by their snake_case name) and each other.
  • Rewritten to give the same rows: ORDER BY gets NULLS FIRST when ascending and NULLS LAST when descending, because AlaSQL sorts NULL as the smallest value and Polars as the largest. Without GROUP BY, ORDER BY also ends with the row number of every table in the query, which the engine adds and hides: AlaSQL's sort is stable and Polars' sort on several keys is not (on 500,000 rows it reordered 250,093 rows that tied on every key), so rows that tie keep the order they had. SQL text order is by character on both engines (unlike the Sort step on the built-in engine).
  • Not lowered: LIKE (AlaSQL ignores case), NOT, DISTINCT, functions other than COALESCE and the aggregates, ||, names in quotes or brackets or with spaces, an expression without AS, division by a column or by zero (AlaSQL gives NULL, Polars infinity), a minus sign before a column, LIMIT 0 (AlaSQL ignores it), NULL as a value, GROUP BY unless ORDER BY lists every GROUP BY column (AlaSQL lists group keys that look like whole numbers first, whatever the data order), joins without ORDER BY, SELECT * with joins, columns of joined tables not written as table.column, RIGHT, FULL and CROSS joins, and queries that read themselves.
  • 36 statements are fixtures in scripts/gen-fixtures.mjs; each gives the same schema and rows on both engines. PQ.Plan.lower refusals are tested in js/tests.js and the run-time fallback in tests-ui.html.

Known differences:

  • Polars sorts text in plain character order, while the built-in engine uses natural, accent-insensitive order. This also decides the minimum and maximum shown for text columns in the profile.
  • With Polars, per-step row counts show only for the selected step.
  • A CSV file is checked for blank lines before Polars reads it: one more sequential pass over the file in a full run, and over the first rows in a preview. Header names follow the app: spaces trimmed, an empty name becomes Column3, a repeated name id_1.
  • Unpivot of columns that are all numbers but of different types (whole numbers and decimals) types the value column number on Polars and any in the app. Unpivot of columns of other mixed types, which the app keeps cell by cell, runs on the built-in engine.
  • Custom SQL, where AlaSQL is the one that departs from SQL and Polars follows the standard:
    • A result with no rows keeps its columns on Polars; AlaSQL returns a table with no columns.
    • Column types follow the Polars type. The built-in engine infers them from the values, so a result of whole numbers is int there and number on Polars, and a column of only nulls is any there.
    • SUM over no rows is NULL on Polars and 0 in AlaSQL. MIN and MAX of a text column give the text on Polars and NULL in AlaSQL.
    • A date column compared with a text literal (order_date >= '2025-03-01') is compared as dates on Polars; AlaSQL finds no rows.
    • A NULL key joins to a NULL key in AlaSQL and never on Polars.
    • A name that AlaSQL reserves (for example total) as a column alias is a parse error there and works on Polars.
    • Text compared with a number (name = 3) is an error on Polars, which falls back to AlaSQL.

Not implemented / known limits

  • The built-in engine reads a Custom SQL step as using another query when that query's name appears in it as a whole word outside quotes, so a column alias equal to a query's name (an alias q next to a query named q) is read as a reference.
  • Phone layout is tested in an emulated browser at 390×844 and 360×640 (no horizontal overflow, Parameters and Automate footers inside the screen). It has not been checked on a real device.
  • The floe CLI runs on the built-in JS engine (Node). A native Rust CLI on floe-engine is not built yet.
  • The Rust code (floe-engine and the Tauri shell) compiles and the engine tests run in CI, but the installers have not been tested by hand on a Windows PC yet.
  • Builds are unsigned; macOS Gatekeeper and Windows SmartScreen will warn until signing is configured.
  • Linux has .deb packages only, built on Ubuntu 22.04 and tested in containers on Ubuntu 22.04, 24.04, 26.04 and 26.10 under Xvfb and a headless Wayland compositor, without a GPU and with the WebKit sandbox off. Opening a .floe project and a data file given on the command line is tested; no real desktop session, file chooser, drag and drop or file association registration was. See docs/LINUX.md.
  • The exported Python script matches the app on the 333 cases (every step type, every formula function, every file source and output format, parameters and locales) in scripts/check-python-export.mjs (Sample, split in every mode, merge and duplicate columns, unpivot, window columns, row and text steps, and CSV output for booleans and date-times). Custom SQL is checked on four plain statements only (select, group by, alias with limit, IN and LIKE), and it is not checked for steps that have no Polars equivalent (cluster, validate, similarity), for characters outside the Basic Multilingual Plane (the app counts UTF-16 units, Polars counts characters in split by positions), or for the app's per-cell error markers. Numbers are compared to nine digits: the app rounds computed floats to ten decimals when it writes a CSV and the script writes them at full precision, so a value such as 0.3 can appear as 0.30000000000000004 there. Rows made only of empty fields are dropped when the script reads a CSV file (the app skips blank lines but keeps a row of delimiters), and Excel sources need fastexcel installed. Text used as a number or a date is accepted by the app but stops the script: a sum of a text column gives an empty cell in the app, and a date function on a text column parses the text there; change the column type first. Cell errors have no Python equivalent: a failed cast is a null there, so Remove errors and Keep errors are not exported and Replace errors with a value also fills cells that were already null. The app and the Polars engine track errors exactly. node scripts/fuzz-python-export.mjs --seed 1 --count 40 builds random pipelines from the check's steps and compares the app with the script; it is run by hand, not in CI.
  • No auto-updater yet.
  • Parquet filter pushdown uses row-group min/max statistics only. It doesn't use page indexes or bloom filters, and it is off when a timestamp or nested column is read, because those types are inferred from the values. Previews don't prune either. They already stop after the first row groups.
  • On desktop, Parquet files that fall back to the built-in engine are still read whole by the shell.
  • Text.Similarity has no Polars equivalent; codegen emits a placeholder.
  • Integers above 2^53 are exact only when they arrive typed as integers (for example an int64 Parquet column): result pages keep them exact and show them as text. Converting text to an integer, and the profile and distinct values, go through a 64-bit float in both engines, so such values are rounded there.
  • Full runs use Polars' streaming engine and fall back to the in-memory engine if it fails. CSV, Parquet and Arrow exports are written as a stream, so their memory does not grow with the data (see docs/BENCH.md). A full run still keeps its result in memory so the grid can page it, and Excel exports collect the whole result.
  • Cancel releases the UI at once and discards the result, but a Polars query that is already running keeps its CPU until it finishes. Polars 0.55 has an interruptible collect, but a panic inside it aborts the whole process, so Floe does not use it. A plan that is cancelled between steps stops before the next step is built.
  • Database sources.

Roadmap

The full step-by-step plan for web, desktop and the optional Polars engine is in docs/PLAN.md.

Next steps

  1. Test the pre-alpha installers by hand, then add signing (see docs/SIGNING.md).
  2. Native floe CLI binary on floe-engine (Polars), reusing the scripts/floe.mjs command surface.
  3. Ranged reads from the Tauri shell (read_file_range) so desktop built-in fallbacks also stream Parquet.
  4. Page-index and bloom-filter pushdown in js/parquet.js, plus pruning for previews.

License

MIT. Bundled: SheetJS CE (Apache-2.0), AlaSQL (MIT), apache-arrow (Apache-2.0), hyparquet / hyparquet-writer / hyparquet-compressors (MIT), Font Awesome Free (icons CC BY 4.0, fonts OFL, code MIT), Instrument Sans, Source Serif 4 and JetBrains Mono (OFL).

About

Floe. Data preparation for web and desktop, with Parquet streaming by row group.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages