From 29c5088ef90d595b649185d586f3eb795571226a Mon Sep 17 00:00:00 2001 From: b-long Date: Mon, 29 Jun 2026 20:38:41 -0400 Subject: [PATCH 1/3] fix: publish wheels & sdists to PyPI --- .github/workflows/release-please.yaml | 2 +- .github/workflows/test-suite.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 1bff56c..05ca19f 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -66,7 +66,7 @@ jobs: - name: Build package shell: bash run: | - uv build --wheel --package otdf-python + uv build --package otdf-python - name: Test import shell: bash diff --git a/.github/workflows/test-suite.yaml b/.github/workflows/test-suite.yaml index 1e5b1f9..72485e3 100644 --- a/.github/workflows/test-suite.yaml +++ b/.github/workflows/test-suite.yaml @@ -69,7 +69,7 @@ jobs: - name: Build otdf-python wheel using uv run: | uv sync --frozen - uv build --wheel --package otdf-python + uv build --package otdf-python shell: bash - name: Check wheel with twine From 7610fba37f676dab5883c1d997e31024b5ac9ce1 Mon Sep 17 00:00:00 2001 From: b-long Date: Mon, 29 Jun 2026 20:47:47 -0400 Subject: [PATCH 2/3] fix sdist build for otdf-python package --- packages/otdf-python/hatch_build.py | 34 +++++++++++++++++++++++++++++ packages/otdf-python/pyproject.toml | 11 ++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 packages/otdf-python/hatch_build.py diff --git a/packages/otdf-python/hatch_build.py b/packages/otdf-python/hatch_build.py new file mode 100644 index 0000000..a4eb32e --- /dev/null +++ b/packages/otdf-python/hatch_build.py @@ -0,0 +1,34 @@ +"""Hatchling build hook for otdf-python.""" + +from pathlib import Path + +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + + +class CustomBuildHook(BuildHookInterface): + """Dynamically resolves proto sources for wheel builds from source tree or sdist.""" + + def initialize(self, version, build_data): + """Set force_include for otdf_python_proto based on build context.""" + if self.target_name != "wheel": + return + + root = Path(self.root) + + # When building from source tree, the proto package is a sibling directory. + # When building from an sdist, we embed the protos at _proto/ inside the sdist root. + source_tree_path = ( + root / ".." / "otdf-python-proto" / "src" / "otdf_python_proto" + ).resolve() + sdist_path = (root / "_proto" / "otdf_python_proto").resolve() + + if source_tree_path.is_dir(): + proto_src = str(source_tree_path) + elif sdist_path.is_dir(): + proto_src = str(sdist_path) + else: + raise FileNotFoundError( + f"otdf_python_proto sources not found at {source_tree_path!r} or {sdist_path!r}" + ) + + build_data["force_include"][proto_src] = "otdf_python_proto" diff --git a/packages/otdf-python/pyproject.toml b/packages/otdf-python/pyproject.toml index f8deb60..433d1ff 100644 --- a/packages/otdf-python/pyproject.toml +++ b/packages/otdf-python/pyproject.toml @@ -47,9 +47,16 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["src/otdf_python"] +# force-include for proto sources is handled dynamically by hatch_build.py +# to support both source-tree builds and sdist-based builds -[tool.hatch.build.targets.wheel.force-include] -"../otdf-python-proto/src/otdf_python_proto" = "otdf_python_proto" +[tool.hatch.build.targets.sdist] +packages = ["src/otdf_python"] + +[tool.hatch.build.targets.sdist.force-include] +"../otdf-python-proto/src/otdf_python_proto" = "_proto/otdf_python_proto" + +[tool.hatch.build.hooks.custom] [dependency-groups] dev = [ From fff3523936c4963dae359ccc855a81aaf6bfde74 Mon Sep 17 00:00:00 2001 From: b-long Date: Mon, 29 Jun 2026 20:51:53 -0400 Subject: [PATCH 3/3] run 'pre-commit autoupdate' --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 136a279..d92f64f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.15.16 + rev: v0.15.20 hooks: # Run the linter. - id: ruff-check