Skip to content

Commit db28530

Browse files
authored
Merge pull request #243 from dbcli/krace/sqlean-stubs
Add sqlean stubs
2 parents eea974f + c5af6b2 commit db28530

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Internal
44

55
- Switch mypy to ty for type checking. [(#242)](https://github.com/dbcli/litecli/pull/242/files)
6+
- Add sqlean-stubs for type checking. [(#243)(https://github.com/dbcli/litecli/pull/243/files)]
67

78
## 1.17.0 - 2025-09-28
89

litecli/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from io import open
1414

1515
try:
16-
from sqlean import OperationalError, sqlite_version # type: ignore[import-untyped]
16+
from sqlean import OperationalError, sqlite_version
1717
except ImportError:
1818
from sqlite3 import OperationalError, sqlite_version
1919
from time import time

litecli/sqlexecute.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from typing import Any, Generator, Iterable
66

77
try:
8-
import sqlean as sqlite3 # type: ignore[import-untyped]
9-
from sqlean import OperationalError # type: ignore[import-untyped]
8+
import sqlean as sqlite3
9+
from sqlean import OperationalError
1010

1111
sqlite3.extensions.enable_all()
1212
except ImportError:
@@ -87,8 +87,7 @@ def connect(self, database: str | None = None) -> None:
8787
if not os.path.exists(db_dir_name):
8888
raise Exception("Path does not exist: {}".format(db_dir_name))
8989

90-
# sqlean exposes the connect method during run-time
91-
conn = sqlite3.connect(database=db_name, isolation_level=None, uri=uri) # type: ignore[attr-defined]
90+
conn = sqlite3.connect(database=db_name, isolation_level=None, uri=uri)
9291
conn.text_factory = lambda x: x.decode("utf-8", "backslashreplace")
9392
if self.conn:
9493
self.conn.close()

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ litecli = "litecli.main:cli"
3434

3535
[project.optional-dependencies]
3636
ai = ["llm"]
37-
sqlean = ["sqlean-py>=3.47.0"]
37+
sqlean = ["sqlean-py>=3.47.0",
38+
"sqlean-stubs>=0.0.3"]
3839

3940
dev = [
4041
"behave>=1.2.6",
@@ -45,7 +46,7 @@ dev = [
4546
"tox>=4.8.0",
4647
"pdbpp>=0.10.3",
4748
"llm>=0.19.0",
48-
"ty>=0.0.4",
49+
"ty>=0.0.4"
4950
]
5051

5152
[tool.setuptools.packages.find]

tests/test_sqlexecute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from .utils import assert_result_equal, dbtest, is_expanded_output, run, set_expanded_output
88

99
try:
10-
from sqlean import OperationalError, ProgrammingError # type: ignore[import-untyped]
10+
from sqlean import OperationalError, ProgrammingError
1111
except ImportError:
1212
from sqlite3 import OperationalError, ProgrammingError
1313

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ commands = uv pip install -e .[dev]
99

1010
[testenv:sqlean]
1111
deps = uv
12-
commands = uv pip install -e .[dev,sqlean]
12+
commands = uv pip install -e .[dev,sqlean,sqlean-stubs]
1313
coverage run -m pytest -v tests
1414
coverage report -m
1515

0 commit comments

Comments
 (0)