Skip to content

Commit 367c71a

Browse files
authored
TOW-1131 - add py.typed to python sdk (#127)
* chore: add py.typed to SDK * feat: add type checking for optional imports
1 parent b7c4a31 commit 367c71a

5 files changed

Lines changed: 53 additions & 1 deletion

File tree

.github/workflows/test-python.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ jobs:
3838
- name: Check Python formatting with Black
3939
run: uv run --group dev black --check --diff .
4040

41+
- name: Check types with mypy
42+
run: uv run --group dev mypy src/tower/__init__.py --no-error-summary
43+
4144
- name: Run tests
4245
run: uv run pytest tests

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ test = [
105105
dev = [
106106
{ include-group = "test" },
107107
"black==24.10.0",
108+
"mypy==1.13.0",
108109
"openapi-python-client==0.24.3",
109110
"pre-commit==4.0.1",
110111
"pyiceberg[sql-sqlite]==0.9.1",

src/tower/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- All features: Install with `pip install "tower[all]"`
1212
"""
1313

14+
from typing import TYPE_CHECKING
15+
1416
from ._client import (
1517
run_app,
1618
wait_for_run,
@@ -19,8 +21,13 @@
1921

2022
from ._features import override_get_attr, get_available_features, is_feature_enabled
2123

24+
if TYPE_CHECKING:
25+
from ._tables import tables as tables
26+
from ._llms import llms as llms
27+
from ._dbt import dbt as dbt
28+
2229

23-
def __getattr__(name: str) -> any:
30+
def __getattr__(name: str):
2431
"""
2532
Dynamic attribute lookup for optional features.
2633

src/tower/py.typed

Whitespace-only changes.

uv.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)