diff --git a/.dockerignore b/.dockerignore index 9b2a558846c28..3ddf7344a430a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -52,6 +52,7 @@ !.github !empty !Dockerfile +!hatch_build.py # This folder is for you if you want to add any packages to the docker context when you build your own # docker image. most of other files and any new folder you add will be excluded by default diff --git a/Dockerfile.ci b/Dockerfile.ci index a7a3396925e00..1d5c88d9badee 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -1180,7 +1180,7 @@ COPY generated/* ${AIRFLOW_SOURCES}/generated/ COPY constraints/* ${AIRFLOW_SOURCES}/constraints/ COPY LICENSE ${AIRFLOW_SOURCES}/LICENSE COPY dev/airflow_pre_installed_providers.txt ${AIRFLOW_SOURCES}/dev/airflow_pre_installed_providers.txt -COPY dev/hatch_build.py ${AIRFLOW_SOURCES}/dev/hatch_build.py +COPY hatch_build.py ${AIRFLOW_SOURCES}/ COPY --from=scripts install_airflow.sh /scripts/docker/ # The goal of this line is to install the dependencies from the most current pyproject.toml from sources diff --git a/dev/hatch_build.py b/hatch_build.py similarity index 97% rename from dev/hatch_build.py rename to hatch_build.py index afbf35df63a03..844bd39dcaf2e 100644 --- a/dev/hatch_build.py +++ b/hatch_build.py @@ -32,7 +32,7 @@ log_level = logging.getLevelName(os.getenv("CUSTOM_AIRFLOW_BUILD_LOG_LEVEL", "INFO")) log.setLevel(log_level) -AIRFLOW_ROOT_PATH = Path(__file__).parent.parent.resolve() +AIRFLOW_ROOT_PATH = Path(__file__).parent.resolve() GENERATED_PROVIDERS_DEPENDENCIES_FILE = AIRFLOW_ROOT_PATH / "generated" / "provider_dependencies.json" DEV_DIR_PATH = AIRFLOW_ROOT_PATH / "dev" PREINSTALLED_PROVIDERS_FILE = DEV_DIR_PATH / "airflow_pre_installed_providers.txt" @@ -84,7 +84,7 @@ def clean(self, directory: str, versions: Iterable[str]) -> None: run(cmd, cwd=work_dir.as_posix(), check=True, shell=True) def get_version_api(self) -> dict[str, Callable[..., str]]: - """Custom build target for standard package preparation.""" + """Get custom build target for standard package preparation.""" return {"standard": self.build_standard} def build_standard(self, directory: str, artifacts: Any, **build_data: Any) -> str: @@ -149,7 +149,7 @@ class CustomBuildHook(BuildHookInterface[BuilderConfig]): def initialize(self, version: str, build_data: dict[str, Any]) -> None: """ - This occurs immediately before each build. + Initialize hook immediately before each build. Any modifications to the build data will be seen by the build target. """ diff --git a/pyproject.toml b/pyproject.toml index eb6f6b8322a38..36411e4f3f1b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1221,13 +1221,13 @@ features = [] path = "airflow/__init__.py" [tool.hatch.build.targets.wheel.hooks.custom] -path = "./dev/hatch_build.py" +path = "./hatch_build.py" [tool.hatch.build.hooks.custom] -path = "./dev/hatch_build.py" +path = "./hatch_build.py" [tool.hatch.build.targets.custom] -path = "./dev/hatch_build.py" +path = "./hatch_build.py" [tool.hatch.build.targets.sdist] include = [