diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8a61a70..0c3dbc9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,11 +3,6 @@ variables: TUTOR_PYPI_PACKAGE: tutor-deck GITHUB_REPO: overhangio/tutor-deck -build-css: - script: - - make scss - stage: build - include: - project: "community/tutor-ci" file: "plugin-gitlab-ci.yml" diff --git a/.hatch_build.py b/.hatch_build.py index 9af73ce..2b52525 100644 --- a/.hatch_build.py +++ b/.hatch_build.py @@ -1,12 +1,20 @@ # https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/ import os +import subprocess import typing as t +from hatchling.builders.hooks.plugin.interface import BuildHookInterface from hatchling.metadata.plugin.interface import MetadataHookInterface HERE = os.path.dirname(__file__) +class CustomBuildHook(BuildHookInterface): + def initialize(self, version, build_data): + # This runs before the build starts + subprocess.check_call(["make", "scss"]) + + class MetaDataHook(MetadataHookInterface): def update(self, metadata: dict[str, t.Any]) -> None: about = load_about() diff --git a/pyproject.toml b/pyproject.toml index 76d6741..d44ec32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,5 +69,9 @@ strict-naming = false include = [ "/tutordeck", ".hatch_build.py"] exclude = ["tests*"] +[tool.hatch.build.targets.sdist.hooks.custom] +# Build static assets prior to running sdist +path = ".hatch_build.py" + [tool.hatch.build.targets.wheel] packages = ["tutordeck"]