Release: datasette-fixtures 0.1a0
TL;DR · AI Summary
datasette-fixtures 0.1a0 provides a way to populate test databases, streamlining plugin development workflows.
Key Takeaways
- Built on top of Datasette 1.0a30’s new API for creating fixture database tables.
- Can be run directly via uvx command without installing Datasette.
- Returns structured JSON output including ok, rows, and truncated fields for easy
Outline
Jump quickly between sections.
datasette-fixtures is a plugin that creates test databases using Datasette's new APIs.
It leverages the newly added populate_fixture_database API from Datasette 1.0a30.
Users can execute the plugin directly through uvx without installing Datasette.
Calling /fixtures/roadside_attractions.json returns predefined attraction data in JSON format.
Mindmap
See how the topics connect at a glance.
查看大纲文本(无障碍 / 无 JS 友好)
- datasette-fixtures 0.1a0
- Core Features
- populate_fixture_database API
- Usage
- Run with uvx
- JSON Output Format
Highlights
Key sentences worth saving and sharing.
New documented datasette.fixtures.populate_fixture_database(conn) helper for creating the fixture database tables used by Datasette's own tests.
You can try it out using `uvx` without even installing Datasette like this:
Which outputs: {"ok": true, "next": null, "rows": [...], "truncated": false}
One of the smaller features in Datasette 1.0a30 is this:
New documented datasette.fixtures.populate_fixture_database(conn) helper for creating the fixture database tables used by Datasette's own tests, intended for plugin test suites.
This new plugin takes advantage of that API. You can try it out using uvx without even installing Datasette like this:
uvx --prerelease=allow \ --with datasette-fixtures datasette \ --get /fixtures/roadside_attractions.json Which outputs:
{ "ok": true, "next": null, "rows": [ {"pk": 1, "name": "The Mystery Spot", "address": "465 Mystery Spot Road, Santa Cruz, CA 95065", "url": "https://www.mysteryspot.com/", "latitude": 37.0167, "longitude": -122.0024}, {"pk": 2, "name": "Winchester Mystery House", "address": "525 South Winchester Boulevard, San Jose, CA 95128", "url": "https://winchestermysteryhouse.com/", "latitude": 37.3184, "longitude": -121.9511}, {"pk": 3, "name": "Burlingame Museum of PEZ Memorabilia", "address": "214 California Drive, Burlingame, CA 94010", "url": null, "latitude": 37.5793, "longitude": -122.3442}, {"pk": 4, "name": "Bigfoot Discovery Museum", "address": "5497 Highway 9, Felton, CA 95018", "url": "https://www.bigfootdiscoveryproject.com/", "latitude": 37.0414, "longitude": -122.0725} ], "truncated": false }