diff --git a/pyproject.toml b/pyproject.toml index 61699c3..6dbdcba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,4 +94,4 @@ responses = "responses" [tool.deptry.per_rule_ignores] DEP001 = [ "backports" ] -DEP002 = [ "backports-datetime-fromisoformat" ] +DEP002 = [ "backports-datetime-fromisoformat", "requests" ] diff --git a/tap_dbt/client.py b/tap_dbt/client.py index b62b0f1..9aefeb2 100644 --- a/tap_dbt/client.py +++ b/tap_dbt/client.py @@ -2,16 +2,18 @@ from __future__ import annotations +import importlib.resources import typing as t from abc import abstractmethod from functools import cache -from pathlib import Path import yaml from singer_sdk import RESTStream from singer_sdk._singerlib import resolve_schema_references from singer_sdk.authenticators import APIAuthenticatorBase, SimpleAuthenticator +from tap_dbt import schemas + @cache def load_openapi() -> dict[str, t.Any]: @@ -20,8 +22,8 @@ def load_openapi() -> dict[str, t.Any]: Returns: The OpenAPI specification as a dict. """ - schema_path = Path(__file__).parent / "schemas" / "openapi_v2.yaml" - with Path.open(schema_path) as schema: + schema_path = importlib.resources.files(schemas) / "openapi_v2.yaml" + with schema_path.open() as schema: return yaml.safe_load(schema) diff --git a/tap_dbt/schemas/__init__.py b/tap_dbt/schemas/__init__.py new file mode 100644 index 0000000..a6a6118 --- /dev/null +++ b/tap_dbt/schemas/__init__.py @@ -0,0 +1 @@ +"""OpenAPI schema for dbt Cloud."""