Commit graph

29 commits

Author SHA1 Message Date
Simon Willison
5c537e0a3e Fix type annotation bugs and remove unused imports
This fixes issues introduced by the ruff commit e57f391a which converted
Optional[x] to x | None:

- Fixed datasette/app.py line 1024: Dict[id | str, Dict] -> Dict[int | str, Dict]
  (was using id built-in function instead of int type)
- Fixed datasette/app.py line 1074: Optional["Resource"] -> "Resource" | None
- Added 'from __future__ import annotations' for Python 3.10 compatibility
- Added TYPE_CHECKING blocks to avoid circular imports
- Removed dead code (unused variable assignments) from cli.py and views
- Removed unused imports flagged by ruff across multiple files
- Fixed test fixtures: moved app_client fixture imports to conftest.py
  (fixed 71 test errors caused by fixtures not being registered)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 16:03:13 -07:00
Jack Stratton
d5c6e502fb
fix: tilde encode database name in expanded foreign key links (#2476)
* Tilde encode database for expanded foreign key links
* Test for foreign key fix in #2476

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2025-04-16 22:15:11 -07:00
Simon Willison
53a3b3c80e
Test improvements and fixed deprecation warnings (#2464)
* `asyncio_default_fixture_loop_scope = function`
* Fix a bunch of BeautifulSoup deprecation warnings
* Fix for PytestUnraisableExceptionWarning: Exception ignored in: <_io.FileIO [closed]>
* xfail for sql_time_limit tests (these can be flaky in CI)

Refs #2461
2025-02-04 14:49:52 -08:00
Simon Willison
4dff846271 simple_primary_key now uses integer id, helps close #2458 2025-02-01 21:44:53 -08:00
Alex Garcia
a23c2aee00
Introduce new /$DB/-/query endpoint, soft replaces /$DB?sql=... (#2363)
* Introduce new default /$DB/-/query endpoint
* Fix a lot of tests
* Update pyodide test to use query endpoint
* Link to /fixtures/-/query in a few places
* Documentation for QueryView

---------

Co-authored-by: Simon Willison <swillison@gmail.com>
2024-07-15 10:33:51 -07:00
Simon Willison
7316dd4ac6 Fix for TableNotFound, refs #2359 2024-06-21 16:09:20 -07:00
Alex Garcia
e1bfab3fca
Move Metadata to --internal database
Refs:
- https://github.com/simonw/datasette/pull/2343
- https://github.com/simonw/datasette/issues/2341
2024-06-11 09:33:23 -07:00
Simon Willison
69c6e95323 Fixed a bunch of unused imports spotted with ruff 2024-02-06 17:27:20 -08:00
Alex Garcia
35deaabcb1
Move non-metadata configuration from metadata.yaml to datasette.yaml
* Allow and permission blocks moved to datasette.yaml
* Documentation updates, initial framework for configuration reference
2023-10-12 09:16:37 -07:00
Simon Willison
c26370485a Label expand permission check respects cascade, closes #2178 2023-09-07 16:28:30 -07:00
Simon Willison
dbfad6d220 Foreign key label expanding respects table permissions, closes #2178 2023-09-07 15:51:09 -07:00
Simon Willison
c39d600aef Fix all E741 Ambiguous variable name warnings, refs #2090 2023-06-29 08:05:24 -07:00
Simon Willison
d97e82df3c
?_extra= support and TableView refactor to table_view
* Implemented ?_extra= option for JSON views, refs #262
* New dependency: asyncinject
* Remove now-obsolete TableView class
2023-03-22 15:49:39 -07:00
Simon Willison
9c43b4164d Removed @pytest.mark.ds_client mark - refs #1959
I don't need it - can run 'pytest -k ds_client' instead.

See https://github.com/simonw/datasette/pull/1960#issuecomment-1355685828
2022-12-17 13:47:55 -08:00
Simon Willison
ebd3358e49 ds_client for test_table_html.py 2022-12-17 13:47:55 -08:00
Simon Willison
f84acae98e Return 400 errors for ?_sort errors, closes #1950 2022-12-13 14:23:17 -08:00
Simon Willison
6f610e1d94 Updated test, refs #1890 2022-11-15 19:04:24 -08:00
Simon Willison
d0737e4de5 truncate_cells_html now affects URLs too, refs #1805 2022-09-06 16:50:43 -07:00
Simon Willison
1563c22a8c Don't duplicate _sort_desc, refs #1738 2022-08-14 09:13:12 -07:00
Simon Willison
0bc5186b7b Tooltip and commas for byte length display, closes #1712 2022-04-12 11:44:12 -07:00
Simon Willison
c496f2b663 Don't show facet in cog menu if not allow_facet, closes #1683 2022-03-24 12:16:19 -07:00
Simon Willison
a35393b29c
Tilde encoding (#1659)
Closes #1657

Refs #1439
2022-03-15 11:01:57 -07:00
Simon Willison
1baa030eca
Switch to dash encoding for table/database/row-pk in paths
* Dash encoding functions, tests and docs, refs #1439
* dash encoding is now like percent encoding but with dashes
* Use dash-encoding for row PKs and ?_next=, refs #1439
* Use dash encoding for table names, refs #1439
* Use dash encoding for database names, too, refs #1439

See also https://simonwillison.net/2022/Mar/5/dash-encoding/
2022-03-07 07:38:29 -08:00
Simon Willison
b72b2423c7 rel=alternate JSON for queries and database pages, closes #1620 2022-02-02 13:22:45 -08:00
Simon Willison
3ef47a0896 Link rel=alternate header for tables and rows
Also added Access-Control-Expose-Headers: Link to --cors mode.

Closes #1533

Refs https://github.com/simonw/datasette-notebook/issues/2

LL#	metadata.json.1
2022-02-01 23:49:09 -08:00
Simon Willison
3a0f7d6488 Fixed hidden form fields bug #1527 2022-01-13 16:27:21 -08:00
Simon Willison
3658e57ac2 Fixed bug with table title element, closes #1560 2022-01-13 14:20:07 -08:00
Simon Willison
eb53837d2a Always show count of distinct facet values, closes #1556
Refs #1423
2021-12-15 09:58:01 -08:00
Simon Willison
1876975e3b Refactor table view HTML tests to test_table_html.py
Refs #1518
2021-12-11 19:06:45 -08:00