-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mypy to latest and turn on everywhere (#5171)
- Loading branch information
Showing
26 changed files
with
127 additions
and
579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Under the Hood | ||
body: Mypy -> 0.942 + fixed import logic to allow for full mypy coverage | ||
time: 2022-04-27T11:21:27.499359-05:00 | ||
custom: | ||
Author: iknox-fa | ||
Issue: "4805" | ||
PR: "5171" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# N.B. | ||
# This will add to the package’s __path__ all subdirectories of directories on sys.path named after the package which effectively combines both modules into a single namespace (dbt.adapters) | ||
# The matching statement is in plugins/postgres/dbt/__init__.py | ||
|
||
from pkgutil import extend_path | ||
|
||
__path__ = extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# N.B. | ||
# This will add to the package’s __path__ all subdirectories of directories on sys.path named after the package which effectively combines both modules into a single namespace (dbt.adapters) | ||
# The matching statement is in plugins/postgres/dbt/adapters/__init__.py | ||
|
||
from pkgutil import extend_path | ||
|
||
__path__ = extend_path(__path__, __name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
from typing import Set, Any | ||
|
||
SELECTED_RESOURCES = [] | ||
|
||
|
||
def set_selected_resources(selected_resources): | ||
def set_selected_resources(selected_resources: Set[Any]) -> None: | ||
global SELECTED_RESOURCES | ||
SELECTED_RESOURCES = list(selected_resources) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import os | ||
import glob | ||
import json | ||
from pathlib import Path | ||
from typing import Iterator, List, Optional, Tuple | ||
|
||
import requests | ||
|
@@ -224,6 +225,14 @@ def _get_adapter_plugin_names() -> Iterator[str]: | |
# not be reporting plugin versions today | ||
if spec is None or spec.submodule_search_locations is None: | ||
return | ||
|
||
# https://github.com/dbt-labs/dbt-core/pull/5171 changes how importing adapters works a bit and renders the previous discovery method useless for postgres. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kwigley
Contributor
|
||
# To solve this we manually add that path to the search path below. | ||
# I don't like this solution. Not one bit. | ||
# This can go away when we move the postgres adapter to it's own repo. | ||
postgres_path = Path(__file__ + "/../../../plugins/postgres/dbt/adapters").resolve() | ||
spec.submodule_search_locations.append(str(postgres_path)) | ||
|
||
for adapters_path in spec.submodule_search_locations: | ||
version_glob = os.path.join(adapters_path, "*", "__version__.py") | ||
for version_path in glob.glob(version_glob): | ||
|
Oops, something went wrong.
I'm not sure what this does, so take this with a grain of salt. All installed adapter packages, including
dbt-postgres
, are available atdbt.adapters
. When an adapter package is installed, it is located in<python site-packages>/dbt/adapters/<name of adapter>
. The relative path below (/../../../plugins/postgres/dbt/adapters
) is relative to the directory in the repository, but I don't think that holds true when installed in a python env.For example in a fresh python env: