The new datasette-fixtures 0.1a0 package ships a small utility that populates a fixture SQLite database using the datasette.fixtures.populate_fixture_database API introduced in Datasette 1.0a30. It lets plugin test suites create realistic tables without pulling in the full Datasette test suite, and can be run via uvx without a permanent installation. The helper is convenient but limited to the predefined fixture schema and does not replace a full‑featured test framework.
What’s claimed
The release notes for datasette-fixtures 0.1a0 market the package as a plug‑and‑play way for plugin developers to generate a ready‑made SQLite fixture database. The package advertises a single public function, datasette.fixtures.populate_fixture_database(conn), that creates a handful of tables (for example a roadside_attractions table) populated with a few dozen rows of sample data. The documentation even shows a one‑liner using uvx that runs Datasette, creates the fixture, and returns JSON for a /fixtures/roadside_attractions.json endpoint.
What’s actually new
- A thin wrapper around an existing internal API – Datasette 1.0a30 introduced
populate_fixture_databasefor its own test suite. The newdatasette-fixturespackage simply re‑exports that function and bundles the fixture schema in a tiny wheel. - Zero‑install execution via uvx – By invoking
uvx --prerelease=allow --with datasette-fixtures datasette --get /fixtures/roadside_attractions.jsonyou spin up a temporary environment, install the helper, and query the generated endpoint. This is handy for quick demos or CI steps that need a predictable data source without pulling the full Datasette source tree. - A concrete example payload – The JSON shown in the release notes contains four rows of California roadside attractions, each with primary key, name, address, optional URL, and lat/long coordinates. The output format mirrors what a normal Datasette JSON API would produce, making it easy to drop into existing test code.
Practical implications for plugin authors
- Simplified test setup – Instead of writing custom SQL to seed a test database, a plugin can call
populate_fixture_databasein itspytestfixtures. The resulting tables are guaranteed to match what the core project uses, reducing drift between the plugin’s expectations and the upstream test data. - Consistent data across CI runs – Because the fixture data is baked into the package, every CI job sees the same rows, which helps avoid flaky tests caused by external data sources.
- No need to install the full Datasette source – The uvx command demonstrates that the helper can be used in isolation, which is useful for lightweight environments (e.g., GitHub Actions runners) where pulling the entire Datasette repo would add unnecessary overhead.
Limitations and caveats
- Fixed schema – The package only creates the tables that Datasette itself uses for its own tests. If a plugin needs additional tables or custom columns, the helper offers no extension point; you’ll still have to write manual SQL or fork the package.
- Small data volume – The fixture contains a few dozen rows. It is great for unit‑style tests but not suitable for performance or scaling benchmarks that require larger datasets.
- Dependency on a pre‑release Datasette – The uvx example forces
--prerelease=allowbecause the helper targets the1.0a30alpha line. Production deployments that lock to a stable Datasette version will need to wait until the helper is released on the stable channel or pin the exact alpha version. - No built‑in cleanup – The helper creates tables in the supplied SQLite connection, but it does not automatically drop them after tests. Test authors must remember to close or delete the temporary database to avoid state leakage between test cases.
Bottom line
datasette-fixtures 0.1a0 is a modest utility that packages an internal Datasette test helper for external consumption. It removes a bit of boilerplate for plugin developers who need the exact same fixture tables Datasette uses internally, and the uvx demo shows how to spin it up without a permanent install. The trade‑off is a rigid schema and a reliance on an alpha version of Datasette, so it’s most useful for quick unit tests rather than large‑scale data experiments.
Relevant links
Comments
Please log in or register to join the discussion