diff --git a/pyproject.toml b/pyproject.toml index d69035f..c5effbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,8 @@ [build-system] -requires = ["hatchling"] +requires = [ + "hatchling", + "requests" +] build-backend = "hatchling.build" [project] @@ -144,7 +147,6 @@ for = "_APPSIGNAL_BUILD_TRIPLE=\"{args}\" hatch build -t wheel" [tool.hatch.build.targets.wheel.hooks.custom] path = "src/scripts/build_hook.py" -dependencies = ["requests"] [tool.hatch.build.targets.sdist.hooks.custom] path = "src/scripts/sdist_hook.py" diff --git a/src/scripts/build_hook.py b/src/scripts/build_hook.py index 5f05b88..98fef58 100644 --- a/src/scripts/build_hook.py +++ b/src/scripts/build_hook.py @@ -10,7 +10,6 @@ from runpy import run_path from typing import Any -import requests from hatchling.builders.hooks.plugin.interface import BuildHookInterface @@ -79,7 +78,12 @@ class DownloadError(Exception): class CustomBuildHook(BuildHookInterface): + def dependencies(self) -> list[str]: + return ["requests"] + def initialize(self, _version: str, build_data: dict[str, Any]) -> None: + import requests + """ This occurs immediately before each build.