Skip to content

Commit e9f31a9

Browse files
authored
Merge pull request #1280 from hkad98/jkd/ty
Replace mypy with ty
2 parents d03467e + 12f315c commit e9f31a9

67 files changed

Lines changed: 179 additions & 269 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/rw-python-tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ jobs:
5252
- name: Install dependencies
5353
run: |
5454
uv sync --only-group tox --only-group type
55-
- name: mypy check
55+
- name: type check
5656
run: |
57-
make mypy
57+
make type-check

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ download:
6767
$(call download_client,"export")
6868
$(call download_client,automation)
6969

70-
.PHONY: mypy
71-
mypy:
70+
.PHONY: type-check
71+
type-check:
7272
RESULT=0; \
73-
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} mypy || RESULT=$$?; done; \
73+
for project in $(NO_CLIENT_GD_PROJECTS_DIRS); do $(MAKE) -C packages/$${project} type-check || RESULT=$$?; done; \
7474
exit $$RESULT
7575

7676
.PHONY: types
77-
types: mypy
77+
types: type-check
7878

7979
.PHONY: test
8080
test:

packages/gooddata-dbt/mypy.ini

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/gooddata-dbt/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ type = [
4444
"pydantic~=2.12.0",
4545
]
4646

47+
[tool.ty.analysis]
48+
allowed-unresolved-imports = ["deep_translator", "github"]
49+
4750
[tool.hatch.build.targets.wheel]
4851
packages = ["src/gooddata_dbt"]
4952

packages/gooddata-dbt/src/gooddata_dbt/dbt/cloud.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,12 @@ def dict_camel_to_snake(self, data: Union[dict, list]) -> Union[dict, list]:
291291
else:
292292
return record
293293
else:
294-
result = {} # type: ignore
294+
result = {}
295295
for key, value in data.items():
296296
if isinstance(value, dict):
297-
result[self.string_camel_to_snake(key)] = self.dict_camel_to_snake(value) # type: ignore
297+
result[self.string_camel_to_snake(key)] = self.dict_camel_to_snake(value)
298298
else:
299-
result[self.string_camel_to_snake(key)] = value # type: ignore
299+
result[self.string_camel_to_snake(key)] = value
300300
return result
301301

302302
def get_last_execution(self, environment_id: str, model_count: int) -> list[DbtExecution]:

packages/gooddata-dbt/src/gooddata_dbt/gooddata/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ class GoodDataConfigProduct(Base):
3636
id: str
3737
name: str
3838
environment_setup_id: str
39-
model_ids: list[str] = attr.field(default=list)
39+
model_ids: list[str] = attr.field(factory=list)
4040
localization: Optional[GoodDataConfigLocalization] = None
4141
skip_tests: Optional[list[str]] = None
4242

4343

4444
@attrs.define(auto_attribs=True, kw_only=True)
4545
class GoodDataConfigOrganization(Base):
4646
gooddata_profile: str
47-
data_product_ids: list[str] = attr.field(default=list)
47+
data_product_ids: list[str] = attr.field(factory=list)
4848

4949

5050
@attrs.define(auto_attribs=True, kw_only=True)

packages/gooddata-dbt/tests/test_tables.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,6 @@ def test_make_ldm():
4646
declarative_datasets = tables.make_declarative_datasets(data_source_id, [MODEL_ID])
4747
ldm = CatalogDeclarativeModel.from_dict({"ldm": declarative_datasets}, camel_case=False)
4848

49+
assert ldm.ldm is not None
4950
assert len(ldm.ldm.datasets) == 4
5051
assert len(ldm.ldm.date_instances) == 4

packages/gooddata-dbt/tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ setenv =
1313
commands =
1414
pytest -v --cov=src/gooddata_dbt --cov-report=xml tests {posargs}
1515

16-
[testenv:mypy]
16+
[testenv:type-check]
1717
runner = uv-venv-lock-runner
1818
skip_install = true
1919
dependency_groups =
2020
type
2121
commands =
22-
mypy src/gooddata_dbt
22+
uv run ty check src/gooddata_dbt

packages/gooddata-fdw/mypy.ini

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/gooddata-fdw/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ type = [
6262
"pydantic~=2.12.0",
6363
]
6464

65+
[tool.ty.analysis]
66+
allowed-unresolved-imports = ["multicorn"]
67+
6568
[tool.hatch.build.targets.wheel]
6669
packages = ["src/gooddata_fdw"]
6770

0 commit comments

Comments
 (0)