diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c4b6d4c9..9c135385 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -165,7 +165,7 @@ jobs: rm -r ./venv env: DBT_PSYCOPG2_NAME: psycopg2 - PSYCOPG2_EXPECTED_NAME: psycopg2 + PSYCOPG2_EXPECTED_NAME: psycopg2-binary # we have not implemented the hook yet, so this doesn't work - name: "Test psycopg2 name - manual override" run: | diff --git a/hatch_build.py b/hatch_build.py deleted file mode 100644 index d65fbb5f..00000000 --- a/hatch_build.py +++ /dev/null @@ -1,25 +0,0 @@ -from importlib.metadata import version as get_version -import os -import subprocess -from typing import Any, Dict - -from hatchling.builders.hooks.plugin.interface import BuildHookInterface -from hatchling.plugin import hookimpl - - -class Psycopg2BuildHook(BuildHookInterface): - """ - Replace `psycopg2-binary` with the same version of `psycopg2` - when configured via `DBT_PSYCOPG2_NAME=psycopg2` - """ - - def finalize(self, version: str, build_data: Dict[str, Any], artifact_path: str) -> None: - if os.getenv("DBT_PSYCOPG2_NAME") == "psycopg2": - psycopg2_version = get_version("psycopg2-binary") - subprocess.run("pip", "uninstall", "-y", "psycopg2-binary") - subprocess.run("pip", "install", f"psycopg2=={psycopg2_version}") - - -@hookimpl -def hatch_register_build_hook(): - return Psycopg2BuildHook diff --git a/pyproject.toml b/pyproject.toml index 54a8fa17..40411863 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,9 +43,6 @@ Changelog = "https://github.com/dbt-labs/dbt-postgres/blob/main/CHANGELOG.md" requires = ["hatchling"] build-backend = "hatchling.build" -[tool.hatch.build.hooks.custom] -path = "hatch_build.py" - [tool.hatch.build.targets.sdist] include = ["dbt", "scripts"]