Skip to content

Commit

Permalink
Use importlib.resources
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 14, 2024
1 parent 20c9d4d commit 5bc863f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ responses = "responses"

[tool.deptry.per_rule_ignores]
DEP001 = [ "backports" ]
DEP002 = [ "backports-datetime-fromisoformat" ]
DEP002 = [ "backports-datetime-fromisoformat", "requests" ]
8 changes: 5 additions & 3 deletions tap_dbt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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)


Expand Down
1 change: 1 addition & 0 deletions tap_dbt/schemas/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""OpenAPI schema for dbt Cloud."""

0 comments on commit 5bc863f

Please sign in to comment.