Commit graph

60 commits

Author SHA1 Message Date
Simon Willison
89af511f79
Also run "pytest --sqlite-autocommit" for one matrix item in CI
To test that our code works correctly with the new autocommit option introduced in Python 3.13+

https://github.com/simonw/sqlite-utils/pull/767#discussion_r3523983636
2026-07-04 16:24:07 -07:00
Simon Willison
8f0c06e188
Test against Python 3.15-dev, bump ty and Black (#738)
* Add Python 3.15-dev to test matrix
* Run ty check only on 3.14
* Bump Black version
* Update tabulate and use that in 
* Bump to latest ty
2026-05-17 16:52:48 -07:00
Simon Willison
871038505b
Type fixes now enforced by ty
* Fix type warning for pipe.stdout possibly being None

Add conditional check before calling .read() on pipe.stdout since
Popen can return None for stdout.

* Use ctx.meta instead of dynamic attribute for database cleanup

Click's Context.meta dictionary is the proper way to store arbitrary
data on the context object, avoiding type checker warnings about
dynamic attribute assignment.

* Add assert for tables.callback before calling

Click's callback attribute is typed as Optional[Callable], so add
assert to satisfy type checker that it's not None.

* Fix type errors in cli.py and db.py

- Add type annotation for Database.conn to fix context manager errors
- Convert exception objects to str() when raising ClickException
- Handle None return from find_spatialite() with proper error message

* Fix remaining type errors in cli.py

- Add typing import and type annotations for dict kwargs
- Use db.table() instead of db[] for extract command
- Fix missing str() conversion for exception

* Fix type errors in db.py

- Add type annotation for Database.conn
- Add type: ignore for optional sqlite_dump import
- Update execute/query parameter types to Sequence|Dict for sqlite3 compatibility
- Use getattr for fn.__name__ access to handle callables without __name__
- Handle None return from find_spatialite() with OSError
- Fix pk_values assignment to use local variable

* Add type: ignore for optional pysqlite3 and sqlean imports

These are alternative sqlite3 implementations that may not be installed.

* Fix type errors in tests and plugins

- Add type: ignore for monkey-patching Database.__init__ in conftest
- Fix CLI test to pass string "2" instead of integer to Click invoke
- Add type: ignore for optional sqlean import
- Fix add_geometry_column test to use "XY" instead of integer 2
- Add type: ignore for click.Context as context manager
- Add type: ignore for enable_fts test that intentionally omits argument
- Add type: ignore for sys._called_from_test dynamic attribute
- Fix rows_from_file test type error for intentional wrong argument
- Handle None from pm.get_hookcallers in plugins.py

* Use db.table() instead of db[] for Table-specific operations

Changes db[table] to db.table(table) in CLI commands where we know
we're working with tables, not views. This resolves most of the
Table | View disambiguation type warnings since db.table() returns
Table directly rather than Table | View.

* Fix remaining type warnings in sqlite_utils package

- Add assert for sniff_buffer not being None
- Handle cursor.fetchone() potentially returning None
- Use db.table() for counts_table and index_foreign_keys
- Add type: ignore for cursor union type in raw mode

* Ran Black

* Run ty in CI

* ty check sqlite_utils

* Skip running ty on Windows

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 19:34:45 -08:00
Simon Willison
066d0f3e8d pip install . --group dev 2025-12-11 15:33:25 -08:00
Simon Willison
29d84bc95d
dependency-groups.dev and uv in docs (#691)
* dependency-groups.dev and switch to uv in docs
* Separate dependency group for docs
2025-12-11 15:32:00 -08:00
Simon Willison
ae58faf274 Add 3.14 to the publish.yml workflow 2025-11-23 22:34:59 -08:00
Simon Willison
4f12c7a452 Port from setup.py to pyproject.toml
Refs #676, closes #675
2025-11-23 14:07:11 -08:00
Simon Willison
dfb2dbe967 Update GitHub Actions workflow cache configuration 2025-11-23 12:12:55 -08:00
Simon Willison
c479ca0f44 SQLite tests against Python 3.10 2025-10-01 13:52:10 -07:00
Simon Willison
f91e4c9e52 Run cog with --diff to show errors 2025-10-01 13:52:10 -07:00
Simon Willison
bccd05c9b4 Test on 3.14 and 3.14t, drop 3.9 2025-10-01 13:52:10 -07:00
Simon Willison
0e4e270d44
Test against multiple SQLite versions (#654)
* Test against pre-upsert SQLite 3.23.1

Borrowed from 8f86d2af6

* Try this on Python 3.9

* select ... from pragma_function_list()

Refs https://github.com/simonw/sqlite-utils/pull/654#issuecomment-2860898278

* Fix spelling error

* Compatible with latest black

* Skip plugin test that needs pragma_function_list

Refs https://github.com/simonw/sqlite-utils/pull/654#issuecomment-2860924225

* Ran cog
2025-05-07 17:49:50 -07:00
Simon Willison
1290c50f71 Drop Python 3.9, add Python 3.13 to all CI
Refs #646
2024-11-23 14:43:04 -08:00
Simon Willison
5bd7aec4d2
Test against Python 3.13 pre-release (#619)
* Test against Python 3.13 pre-release

* Skip tests for numpy on Python 3.13

Refs https://github.com/simonw/sqlite-utils/pull/619#issuecomment-1998798451

* Try to avoid Python 3.13 cog differences

* Hide \b characters in cli-reference

* Fixed .rST warning
2024-03-14 21:14:10 -07:00
Simon Willison
17eb8184d2
Run tests against ARM macos-14 (#615)
* Run tests against ARM macos-14

https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/

* Skip Python 3.8 and 3.9 on macos-14
2024-01-30 19:02:37 -08:00
Simon Willison
70cc0c91ab
Drop support for Python 3.7
* Drop support for Python 3.7, closes #616
* Bumped versions on a whole lot of GitHub Actions
2024-01-30 18:37:38 -08:00
Simon Willison
08c8bb7cfb Test against Python 3.12
First tested in #591
2023-11-03 17:58:31 -07:00
Simon Willison
fedd477e01 Don't attempt tui stuff on Python 3.7, refs #572 2023-07-22 15:11:38 -07:00
Simon Willison
f5c63088e1
Use sqlean if available in environment (#560)
Closes #559
Closes #235

Refs https://github.com/simonw/llm/issues/60

- Uses `sqlean` in place of `sqlite3` if `sqlean.py` is installed
- Uses `sqlite-dump` if available and `conn.iterdump()` does not exist
- New `with db.ensure_autocommit_off()` method for ensuring autocommit is off, used by `enable_wal()` and `disable_wal()`.
2023-06-25 16:25:51 -07:00
Simon Willison
718b0cba9b
Experimental TUI powered by Trogon
* sqlite-utils tui command if Trogon is installed, closes #545
* Documentation for trogon TUI
* Screenshot of TUI
* Ignore trogon mypy error
* only run flake8 on Python 3.8 or higher, closes #550
2023-05-21 11:41:56 -07:00
Simon Willison
e660635cea Drop support for Python 3.6, refs #517 2022-12-09 17:25:23 -08:00
Simon Willison
529110e7d8
GitHub Actions has Python 3.11 on macOS now
Refs https://github.com/actions/setup-python/issues/531
2022-10-26 12:27:32 -07:00
Simon Willison
fb8f495582
Skip macOS 3.11 test when publishing
Refs #505
2022-10-25 15:34:30 -07:00
Simon Willison
5133339d00
Skip macos-latest Python 3.11 for the moment
Refs https://github.com/actions/setup-python/issues/531
2022-10-25 12:08:58 -07:00
Simon Willison
b8526c434a
Test against Python 3.11 2022-10-25 07:17:49 -07:00
Simon Willison
9cbe19ac05 Skip cog check on Python 3.6, refs #501 2022-10-18 11:16:43 -07:00
Mischa Untaga
0b315d3fa8
progressbar for inserts/upserts of other file formats
* progressbar for inserts/upserts of other file formats, closes #485
* Pin to Python 3.10.6 for the moment as workaround for mypy error

Co-authored-by: Simon Willison <swillison@gmail.com>
2022-09-15 13:37:51 -07:00
Simon Willison
19dd077944
Support entrypoints for --load-extension (#473)
* Entrypoint support, closes #470
2022-08-26 22:55:47 -07:00
Manuel Kaufmann
83e7339255
Use Read the Docs action v1 (#463)
Read the Docs repository was renamed from `readthedocs/readthedocs-preview` to `readthedocs/actions/`. Now, the `preview` action is under `readthedocs/actions/preview` and is tagged as `v1`
2022-08-17 16:11:15 -07:00
Simon Willison
98a28cbfe6
Oops, fixed project slug
Refs:
- https://github.com/readthedocs/readthedocs-preview/issues/10
- https://github.com/simonw/sqlite-utils/pull/460
2022-08-02 13:35:56 -07:00
Simon Willison
1856002e3c
readthedocs/readthedocs-preview
Tip from https://twitter.com/readthedocs/status/1552354156056395778
2022-08-02 09:02:43 -07:00
Simon Willison
e3a14c33a0
Run tests against pull requests 2022-04-19 17:21:04 -07:00
Chris Amico
a692c56659
Add SpatiaLite helpers to CLI (#407)
* Add SpatiaLite CLI helpers
* Add docs for spaitalite helpers
* Fix flake8 issues and add more detail on spatial types
* Run cog and add some help text.
* Use SpatiaLite when calculating coverage, refs #407

Co-authored-by: Simon Willison <swillison@gmail.com>
2022-02-15 16:58:07 -08:00
Simon Willison
e46798959e
Looks like Actions if: clauses prefer single quotes
Refs #395, #79
2022-02-03 22:06:23 -08:00
Simon Willison
7494187284
Only install SpatiaLite on Ubuntu, refs #395
For tests added to #79
2022-02-03 22:05:12 -08:00
Simon Willison
4a2a3e2fd0
Install SpatiaLite in tests
To run tests for #79, #385
2022-02-03 21:56:34 -08:00
Simon Willison
b2ab08e048
Don't test main against 3.11-dev yet
It breaks on Windows. Refs #394
2022-02-03 13:07:00 -08:00
Simon Willison
44cbddff8a
Run tests against Python 3.11-dev
Refs #394
2022-02-02 14:21:38 -08:00
Simon Willison
148e9c7aee Use cog to maintain --fmt list, closes #373 2022-01-09 09:48:48 -08:00
Simon Willison
33176ad47b
Run pytest with colors
Tip from https://twitter.com/cjolowicz/status/1461266663681187841
2021-11-19 00:09:16 -08:00
Simon Willison
fda4dad23a
Test against Python 3.10 (#330)
* Test against Python 3.10
* Added 3.10 to classifiers
* Test on Python 3.10 before publish
2021-10-13 15:25:05 -07:00
Simon Willison
c62363ebdc Run mypy against tests/ too, refs #37 2021-08-18 14:49:12 -07:00
Simon Willison
cff6afcc43 Run codespell against source code too, refs #307 2021-08-03 10:06:08 -07:00
Simon Willison
991cf56ae2 Check spelling with codespell, closes #307 2021-08-03 09:48:49 -07:00
Simon Willison
02898bf7af Run flake8 in CI, refs #291 2021-06-22 18:23:12 -07:00
Simon Willison
8d1d801389 mypy tweaks, refs #289, #266, #37 2021-06-22 11:08:21 -07:00
Simon Willison
7b3fdf0fcd mypy annotations for rows_from_file(), run mypy in CI
Refs #289, #279
2021-06-22 11:04:32 -07:00
Simon Willison
adcd32a866 Re-enable publish testing on macos-latest 2021-06-20 11:52:15 -07:00
Simon Willison
eb18b6e42c Disabling macos-latest for the moment
GitHub seems to have run out of workers right now.
2021-06-19 09:09:29 -07:00
Simon Willison
f003d051e7 Not using .coveragerc, refs #275 2021-06-16 16:55:53 -07:00