Skip to content

Commit 8f0c06e

Browse files
authored
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
1 parent 8d74ffc commit 8f0c06e

17 files changed

Lines changed: 175 additions & 216 deletions

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
13+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15-dev"]
1414
numpy: [0, 1]
1515
os: [ubuntu-latest, macos-latest, windows-latest, macos-14]
1616
steps:
@@ -46,7 +46,7 @@ jobs:
4646
- name: run flake8
4747
run: flake8
4848
- name: run ty
49-
if: matrix.os != 'windows-latest'
49+
if: matrix.os != 'windows-latest' && matrix.python-version == '3.14'
5050
run: |
5151
pip install uv
5252
uv run ty check sqlite_utils

docs/cli-reference.rst

Lines changed: 72 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ See :ref:`cli_query`.
117117
--tsv Output TSV
118118
--no-headers Omit CSV headers
119119
-t, --table Output as a formatted table
120-
--fmt TEXT Table format - one of asciidoc, double_grid,
121-
double_outline, fancy_grid, fancy_outline, github,
122-
grid, heavy_grid, heavy_outline, html, jira,
123-
latex, latex_booktabs, latex_longtable, latex_raw,
124-
mediawiki, mixed_grid, mixed_outline, moinmoin,
125-
orgtbl, outline, pipe, plain, presto, pretty,
126-
psql, rounded_grid, rounded_outline, rst, simple,
127-
simple_grid, simple_outline, textile, tsv,
128-
unsafehtml, youtrack
120+
--fmt TEXT Table format - one of asciidoc, colon_grid,
121+
double_grid, double_outline, fancy_grid,
122+
fancy_outline, github, grid, heavy_grid,
123+
heavy_outline, html, jira, latex, latex_booktabs,
124+
latex_longtable, latex_raw, mediawiki, mixed_grid,
125+
mixed_outline, moinmoin, orgtbl, outline, pipe,
126+
plain, presto, pretty, psql, rounded_grid,
127+
rounded_outline, rst, simple, simple_grid,
128+
simple_outline, textile, tsv, unsafehtml, youtrack
129129
--json-cols Detect JSON cols and output them as JSON, not
130130
escaped strings
131131
-r, --raw Raw output, first column of first row
@@ -186,15 +186,15 @@ See :ref:`cli_memory`.
186186
--tsv Output TSV
187187
--no-headers Omit CSV headers
188188
-t, --table Output as a formatted table
189-
--fmt TEXT Table format - one of asciidoc, double_grid,
190-
double_outline, fancy_grid, fancy_outline, github,
191-
grid, heavy_grid, heavy_outline, html, jira,
192-
latex, latex_booktabs, latex_longtable, latex_raw,
193-
mediawiki, mixed_grid, mixed_outline, moinmoin,
194-
orgtbl, outline, pipe, plain, presto, pretty,
195-
psql, rounded_grid, rounded_outline, rst, simple,
196-
simple_grid, simple_outline, textile, tsv,
197-
unsafehtml, youtrack
189+
--fmt TEXT Table format - one of asciidoc, colon_grid,
190+
double_grid, double_outline, fancy_grid,
191+
fancy_outline, github, grid, heavy_grid,
192+
heavy_outline, html, jira, latex, latex_booktabs,
193+
latex_longtable, latex_raw, mediawiki, mixed_grid,
194+
mixed_outline, moinmoin, orgtbl, outline, pipe,
195+
plain, presto, pretty, psql, rounded_grid,
196+
rounded_outline, rst, simple, simple_grid,
197+
simple_outline, textile, tsv, unsafehtml, youtrack
198198
--json-cols Detect JSON cols and output them as JSON, not
199199
escaped strings
200200
-r, --raw Raw output, first column of first row
@@ -425,14 +425,15 @@ See :ref:`cli_search`.
425425
--tsv Output TSV
426426
--no-headers Omit CSV headers
427427
-t, --table Output as a formatted table
428-
--fmt TEXT Table format - one of asciidoc, double_grid,
429-
double_outline, fancy_grid, fancy_outline, github,
430-
grid, heavy_grid, heavy_outline, html, jira, latex,
431-
latex_booktabs, latex_longtable, latex_raw, mediawiki,
432-
mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
433-
pipe, plain, presto, pretty, psql, rounded_grid,
434-
rounded_outline, rst, simple, simple_grid,
435-
simple_outline, textile, tsv, unsafehtml, youtrack
428+
--fmt TEXT Table format - one of asciidoc, colon_grid,
429+
double_grid, double_outline, fancy_grid, fancy_outline,
430+
github, grid, heavy_grid, heavy_outline, html, jira,
431+
latex, latex_booktabs, latex_longtable, latex_raw,
432+
mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
433+
outline, pipe, plain, presto, pretty, psql,
434+
rounded_grid, rounded_outline, rst, simple,
435+
simple_grid, simple_outline, textile, tsv, unsafehtml,
436+
youtrack
436437
--json-cols Detect JSON cols and output them as JSON, not escaped
437438
strings
438439
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
@@ -690,14 +691,15 @@ See :ref:`cli_tables`.
690691
--tsv Output TSV
691692
--no-headers Omit CSV headers
692693
-t, --table Output as a formatted table
693-
--fmt TEXT Table format - one of asciidoc, double_grid,
694-
double_outline, fancy_grid, fancy_outline, github,
695-
grid, heavy_grid, heavy_outline, html, jira, latex,
696-
latex_booktabs, latex_longtable, latex_raw, mediawiki,
697-
mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
698-
pipe, plain, presto, pretty, psql, rounded_grid,
699-
rounded_outline, rst, simple, simple_grid,
700-
simple_outline, textile, tsv, unsafehtml, youtrack
694+
--fmt TEXT Table format - one of asciidoc, colon_grid,
695+
double_grid, double_outline, fancy_grid, fancy_outline,
696+
github, grid, heavy_grid, heavy_outline, html, jira,
697+
latex, latex_booktabs, latex_longtable, latex_raw,
698+
mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
699+
outline, pipe, plain, presto, pretty, psql,
700+
rounded_grid, rounded_outline, rst, simple,
701+
simple_grid, simple_outline, textile, tsv, unsafehtml,
702+
youtrack
701703
--json-cols Detect JSON cols and output them as JSON, not escaped
702704
strings
703705
--columns Include list of columns for each table
@@ -731,14 +733,15 @@ See :ref:`cli_views`.
731733
--tsv Output TSV
732734
--no-headers Omit CSV headers
733735
-t, --table Output as a formatted table
734-
--fmt TEXT Table format - one of asciidoc, double_grid,
735-
double_outline, fancy_grid, fancy_outline, github,
736-
grid, heavy_grid, heavy_outline, html, jira, latex,
737-
latex_booktabs, latex_longtable, latex_raw, mediawiki,
738-
mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
739-
pipe, plain, presto, pretty, psql, rounded_grid,
740-
rounded_outline, rst, simple, simple_grid,
741-
simple_outline, textile, tsv, unsafehtml, youtrack
736+
--fmt TEXT Table format - one of asciidoc, colon_grid,
737+
double_grid, double_outline, fancy_grid, fancy_outline,
738+
github, grid, heavy_grid, heavy_outline, html, jira,
739+
latex, latex_booktabs, latex_longtable, latex_raw,
740+
mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
741+
outline, pipe, plain, presto, pretty, psql,
742+
rounded_grid, rounded_outline, rst, simple,
743+
simple_grid, simple_outline, textile, tsv, unsafehtml,
744+
youtrack
742745
--json-cols Detect JSON cols and output them as JSON, not escaped
743746
strings
744747
--columns Include list of columns for each view
@@ -777,15 +780,15 @@ See :ref:`cli_rows`.
777780
--tsv Output TSV
778781
--no-headers Omit CSV headers
779782
-t, --table Output as a formatted table
780-
--fmt TEXT Table format - one of asciidoc, double_grid,
781-
double_outline, fancy_grid, fancy_outline, github,
782-
grid, heavy_grid, heavy_outline, html, jira,
783-
latex, latex_booktabs, latex_longtable, latex_raw,
784-
mediawiki, mixed_grid, mixed_outline, moinmoin,
785-
orgtbl, outline, pipe, plain, presto, pretty,
786-
psql, rounded_grid, rounded_outline, rst, simple,
787-
simple_grid, simple_outline, textile, tsv,
788-
unsafehtml, youtrack
783+
--fmt TEXT Table format - one of asciidoc, colon_grid,
784+
double_grid, double_outline, fancy_grid,
785+
fancy_outline, github, grid, heavy_grid,
786+
heavy_outline, html, jira, latex, latex_booktabs,
787+
latex_longtable, latex_raw, mediawiki, mixed_grid,
788+
mixed_outline, moinmoin, orgtbl, outline, pipe,
789+
plain, presto, pretty, psql, rounded_grid,
790+
rounded_outline, rst, simple, simple_grid,
791+
simple_outline, textile, tsv, unsafehtml, youtrack
789792
--json-cols Detect JSON cols and output them as JSON, not
790793
escaped strings
791794
--load-extension TEXT Path to SQLite extension, with optional
@@ -817,14 +820,15 @@ See :ref:`cli_triggers`.
817820
--tsv Output TSV
818821
--no-headers Omit CSV headers
819822
-t, --table Output as a formatted table
820-
--fmt TEXT Table format - one of asciidoc, double_grid,
821-
double_outline, fancy_grid, fancy_outline, github,
822-
grid, heavy_grid, heavy_outline, html, jira, latex,
823-
latex_booktabs, latex_longtable, latex_raw, mediawiki,
824-
mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
825-
pipe, plain, presto, pretty, psql, rounded_grid,
826-
rounded_outline, rst, simple, simple_grid,
827-
simple_outline, textile, tsv, unsafehtml, youtrack
823+
--fmt TEXT Table format - one of asciidoc, colon_grid,
824+
double_grid, double_outline, fancy_grid, fancy_outline,
825+
github, grid, heavy_grid, heavy_outline, html, jira,
826+
latex, latex_booktabs, latex_longtable, latex_raw,
827+
mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
828+
outline, pipe, plain, presto, pretty, psql,
829+
rounded_grid, rounded_outline, rst, simple,
830+
simple_grid, simple_outline, textile, tsv, unsafehtml,
831+
youtrack
828832
--json-cols Detect JSON cols and output them as JSON, not escaped
829833
strings
830834
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
@@ -856,14 +860,15 @@ See :ref:`cli_indexes`.
856860
--tsv Output TSV
857861
--no-headers Omit CSV headers
858862
-t, --table Output as a formatted table
859-
--fmt TEXT Table format - one of asciidoc, double_grid,
860-
double_outline, fancy_grid, fancy_outline, github,
861-
grid, heavy_grid, heavy_outline, html, jira, latex,
862-
latex_booktabs, latex_longtable, latex_raw, mediawiki,
863-
mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
864-
pipe, plain, presto, pretty, psql, rounded_grid,
865-
rounded_outline, rst, simple, simple_grid,
866-
simple_outline, textile, tsv, unsafehtml, youtrack
863+
--fmt TEXT Table format - one of asciidoc, colon_grid,
864+
double_grid, double_outline, fancy_grid, fancy_outline,
865+
github, grid, heavy_grid, heavy_outline, html, jira,
866+
latex, latex_booktabs, latex_longtable, latex_raw,
867+
mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
868+
outline, pipe, plain, presto, pretty, psql,
869+
rounded_grid, rounded_outline, rst, simple,
870+
simple_grid, simple_outline, textile, tsv, unsafehtml,
871+
youtrack
867872
--json-cols Detect JSON cols and output them as JSON, not escaped
868873
strings
869874
--load-extension TEXT Path to SQLite extension, with optional :entrypoint

docs/cli.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ Available ``--fmt`` options are:
257257
.. ]]]
258258
259259
- ``asciidoc``
260+
- ``colon_grid``
260261
- ``double_grid``
261262
- ``double_outline``
262263
- ``fancy_grid``

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies = [
3333

3434
[dependency-groups]
3535
dev = [
36-
"black>=24.1.1",
36+
"black>=26.3.1",
3737
"cogapp",
3838
"hypothesis",
3939
"pytest",
@@ -47,7 +47,9 @@ dev = [
4747
# flake8
4848
"flake8",
4949
"flake8-pyproject",
50-
"ty",
50+
"ty>=0.0.37",
51+
# For stable cog:
52+
"tabulate>=0.10.0",
5153
]
5254
docs = [
5355
"beanbag-docutils>=2.0",

sqlite_utils/cli.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import base64
22
from typing import Any
33
import click
4-
from click_default_group import DefaultGroup # type: ignore
4+
from click_default_group import DefaultGroup
55
from datetime import datetime, timezone
66
import hashlib
77
import pathlib
@@ -42,7 +42,6 @@
4242
TypeTracker,
4343
)
4444

45-
4645
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
4746

4847

@@ -223,7 +222,7 @@ def _iter():
223222
else:
224223
items = db.table_names(fts4=fts4, fts5=fts5)
225224
for name in items:
226-
row = [name]
225+
row: list[Any] = [name]
227226
if counts:
228227
row.append(method(name).count)
229228
if columns:
@@ -2122,8 +2121,9 @@ def _execute_query(
21222121
cursor = [[cursor.rowcount]]
21232122
else:
21242123
headers = [c[0] for c in cursor.description]
2124+
cursor_or_rows: Any = cursor
21252125
if raw:
2126-
row = cursor.fetchone() # type: ignore[union-attr]
2126+
row = cursor_or_rows.fetchone()
21272127
data = row[0] if row else None
21282128
if isinstance(data, bytes):
21292129
sys.stdout.buffer.write(data)
@@ -2911,17 +2911,15 @@ def _analyze(db, tables, columns, save, common_limit=10, no_most=False, no_least
29112911
)
29122912
details = (
29132913
(
2914-
textwrap.dedent(
2915-
"""
2914+
textwrap.dedent("""
29162915
{table}.{column}: ({i}/{total})
29172916
29182917
Total rows: {total_rows}
29192918
Null rows: {num_null}
29202919
Blank rows: {num_blank}
29212920
29222921
Distinct values: {num_distinct}{most_common_rendered}{least_common_rendered}
2923-
"""
2924-
)
2922+
""")
29252923
.strip()
29262924
.format(
29272925
i=i + 1,
@@ -2968,8 +2966,7 @@ def uninstall(packages, yes):
29682966

29692967

29702968
def _generate_convert_help():
2971-
help = textwrap.dedent(
2972-
"""
2969+
help = textwrap.dedent("""
29732970
Convert columns using Python code you supply. For example:
29742971
29752972
\b
@@ -2982,8 +2979,7 @@ def _generate_convert_help():
29822979
Use "-" for CODE to read Python code from standard input.
29832980
29842981
The following common operations are available as recipe functions:
2985-
"""
2986-
).strip()
2982+
""").strip()
29872983
recipe_names = [
29882984
n
29892985
for n in dir(recipes)
@@ -2997,15 +2993,13 @@ def _generate_convert_help():
29972993
name, str(inspect.signature(fn)), textwrap.dedent(fn.__doc__.rstrip())
29982994
)
29992995
help += "\n\n"
3000-
help += textwrap.dedent(
3001-
"""
2996+
help += textwrap.dedent("""
30022997
You can use these recipes like so:
30032998
30042999
\b
30053000
sqlite-utils convert my.db mytable mycolumn \\
30063001
'r.jsonsplit(value, delimiter=":")'
3007-
"""
3008-
).strip()
3002+
""").strip()
30093003
return help
30103004

30113005

0 commit comments

Comments
 (0)