Skip to content

Commit a2ab03f

Browse files
committed
Hatchlings build
1 parent 3bff544 commit a2ab03f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

build-module.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
import os
1919
import shutil
2020
from pathlib import Path
21+
from typing import Any
22+
2123
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
2224

2325
allowed_to_fail = os.environ.get("CIBUILDWHEEL", "0") != "1"
2426

27+
2528
class CythonBuildHook(BuildHookInterface):
26-
def initialize(self, version, build_data):
29+
def build_cython_extensions(self) -> None:
2730
import Cython.Compiler.Options
2831
from Cython.Build import build_ext, cythonize
2932
from setuptools import Extension
@@ -64,3 +67,9 @@ def initialize(self, version, build_data):
6467
relative_extension = output.relative_to(cmd.build_lib)
6568
shutil.copyfile(output, relative_extension)
6669

70+
def initialize(self, version: str, build_data: dict[str, Any]) -> None:
71+
try:
72+
self.build_cython_extensions()
73+
except Exception:
74+
if not allowed_to_fail:
75+
raise

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ ignore_missing_imports = true
331331
module = "setuptools.*"
332332
ignore_missing_imports = true
333333

334+
[[tool.mypy.overrides]]
335+
module = "hatchling.*"
336+
ignore_missing_imports = true
337+
334338
[[tool.mypy.overrides]]
335339
module = "tenacity.*"
336340
ignore_missing_imports = true

0 commit comments

Comments
 (0)