Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rw-python-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ jobs:
- name: Install dependencies
run: |
uv sync --only-group tox --only-group type
- name: mypy check
- name: type check
run: |
make mypy
make type-check
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ download:
$(call download_client,"export")
$(call download_client,automation)

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

.PHONY: types
types: mypy
types: type-check

.PHONY: test
test:
Expand Down
32 changes: 0 additions & 32 deletions packages/gooddata-dbt/mypy.ini

This file was deleted.

3 changes: 3 additions & 0 deletions packages/gooddata-dbt/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type = [
"pydantic~=2.12.0",
]

[tool.ty.analysis]
allowed-unresolved-imports = ["deep_translator", "github"]

[tool.hatch.build.targets.wheel]
packages = ["src/gooddata_dbt"]

Expand Down
6 changes: 3 additions & 3 deletions packages/gooddata-dbt/src/gooddata_dbt/dbt/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,12 @@ def dict_camel_to_snake(self, data: Union[dict, list]) -> Union[dict, list]:
else:
return record
else:
result = {} # type: ignore
result = {}
for key, value in data.items():
if isinstance(value, dict):
result[self.string_camel_to_snake(key)] = self.dict_camel_to_snake(value) # type: ignore
result[self.string_camel_to_snake(key)] = self.dict_camel_to_snake(value)
else:
result[self.string_camel_to_snake(key)] = value # type: ignore
result[self.string_camel_to_snake(key)] = value
return result

def get_last_execution(self, environment_id: str, model_count: int) -> list[DbtExecution]:
Expand Down
4 changes: 2 additions & 2 deletions packages/gooddata-dbt/src/gooddata_dbt/gooddata/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class GoodDataConfigProduct(Base):
id: str
name: str
environment_setup_id: str
model_ids: list[str] = attr.field(default=list)
model_ids: list[str] = attr.field(factory=list)
localization: Optional[GoodDataConfigLocalization] = None
skip_tests: Optional[list[str]] = None


@attrs.define(auto_attribs=True, kw_only=True)
class GoodDataConfigOrganization(Base):
gooddata_profile: str
data_product_ids: list[str] = attr.field(default=list)
data_product_ids: list[str] = attr.field(factory=list)


@attrs.define(auto_attribs=True, kw_only=True)
Expand Down
1 change: 1 addition & 0 deletions packages/gooddata-dbt/tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ def test_make_ldm():
declarative_datasets = tables.make_declarative_datasets(data_source_id, [MODEL_ID])
ldm = CatalogDeclarativeModel.from_dict({"ldm": declarative_datasets}, camel_case=False)

assert ldm.ldm is not None
assert len(ldm.ldm.datasets) == 4
assert len(ldm.ldm.date_instances) == 4
4 changes: 2 additions & 2 deletions packages/gooddata-dbt/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ setenv =
commands =
pytest -v --cov=src/gooddata_dbt --cov-report=xml tests {posargs}

[testenv:mypy]
[testenv:type-check]
runner = uv-venv-lock-runner
skip_install = true
dependency_groups =
type
commands =
mypy src/gooddata_dbt
uv run ty check src/gooddata_dbt
17 changes: 0 additions & 17 deletions packages/gooddata-fdw/mypy.ini

This file was deleted.

3 changes: 3 additions & 0 deletions packages/gooddata-fdw/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ type = [
"pydantic~=2.12.0",
]

[tool.ty.analysis]
allowed-unresolved-imports = ["multicorn"]

[tool.hatch.build.targets.wheel]
packages = ["src/gooddata_fdw"]

Expand Down
12 changes: 6 additions & 6 deletions packages/gooddata-fdw/src/gooddata_fdw/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ class TableDefinitionStub:
def __init__(
self,
table_name: str,
columns: list[ColumnDefinition], # type: ignore
options: dict[str, str], # type: ignore
columns: list[ColumnDefinition],
options: dict[str, str],
) -> None:
self.table_name = table_name
self.columns = columns
self.options = options
self.col_idx = dict([(c.column_name, c) for c in columns]) # type: ignore
self.col_idx = dict([(c.column_name, c) for c in columns])

TableDefinition = TableDefinitionStub

class ForeignDataWrapperStub:
def __init__(self, options: dict[str, str], columns: dict[str, ColumnDefinition]) -> None: # type: ignore
def __init__(self, options: dict[str, str], columns: dict[str, ColumnDefinition]) -> None:
self.options = options
self.columns = columns

Expand All @@ -90,10 +90,10 @@ def import_schema(
options: dict[str, str],
restriction_type: Optional[str],
restricts: list[str],
) -> list[TableDefinition]: # type: ignore
) -> list[TableDefinition]:
return NotImplemented

def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None): # type: ignore
def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None):
pass

ForeignDataWrapper = ForeignDataWrapperStub
12 changes: 6 additions & 6 deletions packages/gooddata-fdw/src/gooddata_fdw/fdw.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, options: dict[str, str], columns: dict[str, ColumnDefinition]
self._executor = ExecutorFactory.create(InitData(gd_sdk, self._server_options, self._table_options, columns))
self._executor.validate_columns_def()

def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None): # type: ignore
def execute(self, quals: list[Qual], columns: list[str], sortkeys: Optional[list[Any]] = None):
_log_debug(f"query in fdw with {self._server_options}; {self._table_options}; columns {columns}; quals={quals}")
try:
return self._executor.execute(quals, columns, sortkeys)
Expand All @@ -50,7 +50,7 @@ def import_schema(
options: dict[str, str],
restriction_type: Optional[str],
restricts: list[str],
) -> list[TableDefinition]: # type: ignore
) -> list[TableDefinition]:
_log_info(
f"import fdw {schema} (srv_options={srv_options}, "
f"options={options}, restriction_type={restriction_type}, restricts={restricts})"
Expand All @@ -76,14 +76,14 @@ def import_schema(
raise e

@property
def rowid_column(self): # type: ignore
def rowid_column(self):
return super().rowid_column

def insert(self, values): # type: ignore
def insert(self, values):
return super().insert(values)

def update(self, oldvalues, newvalues): # type: ignore
def update(self, oldvalues, newvalues):
return super().update(oldvalues, newvalues)

def delete(self, oldvalues): # type: ignore
def delete(self, oldvalues):
return super().delete(oldvalues)
2 changes: 1 addition & 1 deletion packages/gooddata-fdw/src/gooddata_fdw/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class InsightColumnNamingStrategy:
def col_name_for_attribute(self, attr: sdk.VisualizationAttribute) -> str:
raise NotImplementedError()

def col_name_for_metric(self, attr: sdk.VisualizationMetric) -> str:
def col_name_for_metric(self, metric: sdk.VisualizationMetric) -> str:
raise NotImplementedError()


Expand Down
4 changes: 2 additions & 2 deletions packages/gooddata-fdw/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ setenv =
commands =
pytest -v --cov=src/gooddata_fdw --cov-report=xml tests {posargs}

[testenv:mypy]
[testenv:type-check]
runner = uv-venv-lock-runner
skip_install = true
dependency_groups =
type
commands =
mypy src/gooddata_fdw
uv run ty check src/gooddata_fdw

[testenv:docs]
basepython = python3.14
Expand Down
26 changes: 0 additions & 26 deletions packages/gooddata-flexconnect/mypy.ini

This file was deleted.

3 changes: 3 additions & 0 deletions packages/gooddata-flexconnect/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ type = [
"pydantic~=2.12.0",
]

[tool.ty.analysis]
allowed-unresolved-imports = ["jsonschema.**", "referencing"]

[tool.hatch.build.targets.wheel]
packages = ["src/gooddata_flexconnect"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_report_execution_context_deser(sample_report_execution_context_dict):
"""
deserialized = ExecutionContext.from_dict(sample_report_execution_context_dict)

assert deserialized is not None
assert deserialized.execution_type == ExecutionType.REPORT
assert deserialized.organization_id == "default"
assert deserialized.label_elements_execution_request is None
Expand All @@ -42,14 +43,17 @@ def test_label_elements_execution_context_deser(sample_label_execution_context_d
"""
deserialized = ExecutionContext.from_dict(sample_label_execution_context_dict)

assert deserialized is not None
assert deserialized.execution_type == ExecutionType.LABEL_ELEMENTS
assert deserialized.organization_id == "default"
assert deserialized.report_execution_request is None

assert deserialized.label_elements_execution_request is not None
assert isinstance(deserialized.label_elements_execution_request.filter_by, CatalogFilterBy)
assert deserialized.label_elements_execution_request.filter_by.label_type == "REQUESTED"
assert deserialized.label_elements_execution_request.depends_on is not None
assert isinstance(deserialized.label_elements_execution_request.depends_on[0], CatalogDependsOn)
assert deserialized.label_elements_execution_request.validate_by is not None
assert isinstance(deserialized.label_elements_execution_request.validate_by[0], CatalogValidateByItem)

assert isinstance(deserialized.attributes[0], ExecutionContextAttribute)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def fake_ctx():
# need to ensure that the functions are registered correctly and that
# their on_load() initializers are called
return ServerContext(
config=None,
config=None, # type: ignore[arg-type]
location=pyarrow.flight.Location.for_grpc_tcp("localhost", 6666),
settings=None,
task_executor=None,
health=None,
settings=None, # type: ignore[arg-type]
task_executor=None, # type: ignore[arg-type]
health=None, # type: ignore[arg-type]
)


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# (C) 2024 GoodData Corporation
from typing import Optional

import pyarrow
from gooddata_flexconnect.function.function import FlexConnectFunction
Expand All @@ -12,7 +13,7 @@ class Fun1(FlexConnectFunction):
def call(
self,
parameters: dict,
columns: tuple[str, ...],
columns: Optional[tuple[str, ...]],
headers: dict[str, list[str]],
) -> ArrowData:
pass
Expand All @@ -27,7 +28,7 @@ class Fun2(FlexConnectFunction):
def call(
self,
parameters: dict,
columns: tuple[str, ...],
columns: Optional[tuple[str, ...]],
headers: dict[str, list[str]],
) -> ArrowData:
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from pathlib import Path
from typing import Any

import orjson
import pytest
from jsonschema.validators import Draft202012Validator
from orjson import orjson
from referencing import Registry, Resource

SCHEMAS = Path("json_schemas")
Expand Down
6 changes: 3 additions & 3 deletions packages/gooddata-flexconnect/tests/server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from collections.abc import Iterable
from contextlib import closing
from pathlib import Path
from typing import Union
from typing import Iterator, Union

import pytest
from gooddata_flexconnect.function.flight_methods import (
Expand Down Expand Up @@ -39,7 +39,7 @@ def server(
methods: Union[FlightServerMethods, FlightServerMethodsFactory],
tls: bool = False,
mtls: bool = False,
) -> GoodDataFlightServer:
) -> Iterator[GoodDataFlightServer]:
port = _find_free_port()
os.environ["GOODDATA_FLIGHT_SERVER__LISTEN_PORT"] = str(port)
os.environ["GOODDATA_FLIGHT_SERVER__ADVERTISE_HOST"] = "localhost"
Expand Down Expand Up @@ -75,7 +75,7 @@ def flexconnect_server(
modules: Iterable[str],
tls: bool = False,
mtls: bool = False,
) -> GoodDataFlightServer:
) -> Iterator[GoodDataFlightServer]:
funs = ", ".join([f'"{module}"' for module in modules])
funs = f"[{funs}]"

Expand Down
Loading
Loading