Armin Ronacher@mitsuhiko
minijinjadevin/1795855749-autoescape-assignment-scope

Fixed assignments inside autoescape, filter and set blocks leaking out of the block. Like in Jinja2, these…

CHANGELOG.md

  • Fixed the urlencode filter percent-encoding ~ as %7E in Rust. Like in Jinja2 and Go, ~ is now kept as an unreserved URL character.
  • The indent filter now also accepts a string as the width for Jinja2 compatibility, which is used as the indentation instead of spaces, so indent("> ") quotes a block.
  • Fixed the integer conversions of the format filter to match Python. In Go, %i printed %!i(int64=3), %#o printed 010 instead of 0o10, zero padding ignored the 0x/0o prefix and booleans failed with "invalid format spec". In Rust, a precision did not set the minimum number of digits, so "%.3d"|format(3) is now 003.
  • Fixed str.splitlines in the pycompat module of minijinja-contrib only splitting on \n and \r\n. Like in Python, a lone \r, \v, \f, \x1c, \x1d, \x1e, \x85, \u2028 and \u2029 now also end a line, so 'a\rb'.splitlines() is ['a', 'b'], and splitlines(true) keeps these line endings.
7 commits+303 −9416 files
Armin Ronacher@mitsuhiko
djs

0316: cheaper sync host calls: cached memory views for the out buffer and staging, a reused encoder, lazy…

docs/guide/benchmarks.md

djs next to the engines a host would otherwise embed, on workloads modeled on agent

codemode sessions: download size, starting a VM, run time, memory, passing data in and

out, and what each engine does with a script that never ends or exhausts memory.

> In short. Of eight engines, djs starts a VM fastest and has the lowest run time

> over the workloads, most of all where scripts move JSON and strings, and it passes

> structured data through the host bridge several times faster than the QuickJS builds.

> It is behind on the smallest bodies, on bytes coming in and on many tiny tool calls,

> and its compressed module is the largest of the JavaScript engines in wasm.

What is measured

An agent's codemode body is short and makes a few tool calls, so what a host pays is

mostly starting a VM, passing tool results in and out, compiling the body and building

strings. The harness measures that as an embedder sees it:

  • Every engine but Psychoscript is a wasm module run by node, compiled once per process.

Psychoscript is written in JavaScript and runs on node's own engine.

  • Every run gets a fresh VM. *New VM* is the time to get one ready; *run* is the time

from handing it the script to having the result string. Times are medians of 25 runs

after 3 warm-up runs.

  • Tool answers are recorded once and handed to every engine as one JSON string, through

the same bridge code…

37 commits+4,443 −4,81258 files2.5h session
datasettem2m-prototype

Demo: junction tables with extra columns, and reviews as a configured relationship

  • Screenshots of many-to-many columns on table pages, desktop and mobile
  • Format the demo build script with black
  • Expose junction table extra columns in the m2m extra
  • Show junction table extra columns in the link editor
  • Document junction table extra columns
  • Screenshots of extra columns in the link editor, keep the note link blue
  • …and 9 more
16 commits+4,202 −20450 files2.7h session
Armin Ronacher@mitsuhiko
djs

0310: snapshot::inspect: the run in JavaScript terms as text and JSON; parameter names in debug info; host…

builtins/README.md

  • enum declarations (records and named constants, below) and their members as

Name.member.

Records and named constants

State that builtins keep between calls (a capability, the data of a Promise.all element

function, an async generator's request, an iterator helper's fields) lives in internal

records, and states and flags are numbers. Both are named by enum declarations

(D3710), so that a logical snapshot writes them by name and another build reads them by

name: a build that orders the fields or numbers the constants differently continues the

snapshot the same, one that lacks a field or a constant refuses it.

```ts

/** A PromiseCapability Record of a constructor other than %Promise%. @record */

enum Capability {

promise,

resolve,

reject,

}

/** A module record's flags. @flags */

enum ModuleFlags {

json = 1,

tla = 2,

}

const r: Obj = NewRecord(Capability);

RecordSet(r, Capability.promise, promise);

```

  • @record: the fields of a kind of record, its slots in order. NewRecord(Name) makes

one (its fields undefined); the record carries its kind in its header. Name.field is

the slot index, so RecordGet(r, Capability.resolve) is the same slot access as a

number. @class IteratorHelper makes it an iterator helper's schema

(CreateIteratorHelper(Name, kind)); @rest name gives it a variable tail after the

fields (records the engine makes,…

167 commits+5,166 −5,841300 files2.6h session
Armin Ronacher@mitsuhiko
deser

Only link the limit checks of raw values with raw values

compile-times/README.md

field is #[inline(never)] now. The same happened to the

PlainSink methods of the serialize driver (PlainDelivery) and to

the closure that passes events to the layers (now created in

deliver_layered), which held copies of the writer's event handler

(5.6 KiB in the small program).

linked only into programs that add layers. The last layer delivers

the events with the same functions as the driver without layers

(DriverCore::atom_event and friends, the driver jumps to them):

Next::emit had its own copy of the delivery of all events, 10.7 KiB.

  • Limits inside raw values are checked by the formats' scanners or

by replaying the raw value (for formats without one). Both are only

referred to by the descriptions of the formats (RawFormatInfo), so

only programs with raw values contain them. When the limits layer

referred to the replay, the small program got 7.5 KiB larger, which

crossed two 16 KiB pages of the binary (33 KiB on disk).

  • Forwarded values (Emit::Forward) are driven by the loop of the

serialize driver, which takes them from the driver (forwarded) when

their frame is on the top. drive_forwarded held a copy of

drive_value (with the writer's event handler inlined), 3.7 KiB in the

small program. Returning the forwarded value from drive_value to a

loop that checks for it first made serializing 2-3%…

6 commits+761 −35862 files

Removed Fable 5.2's editorial notes from the README

README.md

Pie, donut, sunburst and rose charts for datasette-charts.

| donut | The same, with the total in the hole | Not suggested |

| sunburst | Two categories as two rings: each inner slice broken down by a second column | Not suggested |

All of these chart types can be constructed by hand in the chart builder. Pie and Rose charts will be suggested if the data matches the above criteria.

2 commits+4 −311 file

Document the calendar, box and intervals charts, and add them to the gallery

docs/plugins.md

Writing chart type plugins

A chart type has two halves. A Python class proposes charts for a table or query and compiles each one to SQL. A JavaScript module draws the rows that SQL returns. Other plugins add chart types with the register_chart_types hook, which is how the built-in ones are registered too. A chart type from a plugin shows up in the chart builder, can be suggested next to the built-in charts, works in #chart= links, <datasette-chart> embeds and Datasette Agent, and can draw annotations.

This page starts with a tutorial that builds a chart type plugin from nothing, then documents both halves: the Python classes, the profile that suggestions are worked out from, and the JavaScript helpers every renderer is handed.

This interface is not stable yet: until it is, anything on this page could still change, and any change will be in the release notes. Only what this page documents is public. The rest of datasette_charts, and of its JavaScript, can change at any time.

Contents

  • [Tutorial: a lollipop chart plugin](#tutorial-a-lollipop-chart-plugin): [create the plugin](#1-create-the-plugin), [the chart type](#2-the-chart-type), [the SQL](#3-compile-a-spec-to-sql), [the renderer](#4-draw-it), [try it](#5-try-it), [suggest it](#6-suggest-it), [annotations](#7-add-annotations), [tests](#8-write-tests), [publish it](#9-publish-it), [the finished…
11 commits+4,985 −5141 files2.9h session
datasette-chartsmore-chart-types

Rename box to box_plot and intervals to active_count

README.md

| box_plot | Box plots of a numeric column for each of the most common values of a category: minimum, quartiles, median and maximum | There is a measure and a category with enough rows for each value |

| active_count | How many rows are active at each point in time, from a start and an end column, optionally split by a category | Two date columns are named like a start and an end, such as start_date and end_date |

  • x and y are the spec's own x and y channels. On a horizontal bar chart and a box plot x is the category axis, down the side, so a line at an x value there is horizontal. On an active_count chart x is time, from its start column.

Bar, line, histogram, scatter, stacked bar, box plot and active count charts take every type. Maps take text only, since they have no x or y axis, and so do calendar heatmaps, whose weeks wrap from one column to the next with no straight time axis to draw on. A chart type from another plugin takes none unless it says which it draws, with annotation_types.

1 commit+102 −8718 files
datasette-chartsmore-chart-types

Document the calendar, box and intervals charts, and add them to the gallery

docs/plugins.md

Writing chart type plugins

A chart type has two halves. A Python class proposes charts for a table or query and compiles each one to SQL. A JavaScript module draws the rows that SQL returns. Other plugins add chart types with the register_chart_types hook, which is how the built-in ones are registered too. A chart type from a plugin shows up in the chart builder, can be suggested next to the built-in charts, works in #chart= links, <datasette-chart> embeds and Datasette Agent, and can draw annotations.

This page starts with a tutorial that builds a chart type plugin from nothing, then documents both halves: the Python classes, the profile that suggestions are worked out from, and the JavaScript helpers every renderer is handed.

This interface is not stable yet: until it is, anything on this page could still change, and any change will be in the release notes. Only what this page documents is public. The rest of datasette_charts, and of its JavaScript, can change at any time.

Contents

  • [Tutorial: a lollipop chart plugin](#tutorial-a-lollipop-chart-plugin): [create the plugin](#1-create-the-plugin), [the chart type](#2-the-chart-type), [the SQL](#3-compile-a-spec-to-sql), [the renderer](#4-draw-it), [try it](#5-try-it), [suggest it](#6-suggest-it), [annotations](#7-add-annotations), [tests](#8-write-tests), [publish it](#9-publish-it), [the finished…
11 commits+4,985 −5141 files28m session