From 5fb60a5198a2d912d9db16d1d7c715fe98fce93c Mon Sep 17 00:00:00 2001 From: Timofey Peshin Date: Fri, 13 Jun 2025 14:09:18 -0700 Subject: [PATCH] Mark Application.abort() as NoReturn Otherwise, type checkers (like PyRight) require an `assert False` after `self.app.abort()` in build hooks. --- backend/src/hatchling/bridge/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/hatchling/bridge/app.py b/backend/src/hatchling/bridge/app.py index b54d110d6..50d1f0087 100644 --- a/backend/src/hatchling/bridge/app.py +++ b/backend/src/hatchling/bridge/app.py @@ -2,7 +2,7 @@ import os import sys -from typing import Any +from typing import Any, NoReturn class Application: @@ -80,7 +80,7 @@ def display_mini_header(self, message: str = '', **kwargs: Any) -> None: # noqa if self.__verbosity >= 0: _display(f'[{message}]') - def abort(self, message: str = '', code: int = 1, **kwargs: Any) -> None: # noqa: ARG002 + def abort(self, message: str = '', code: int = 1, **kwargs: Any) -> NoReturn: # noqa: ARG002 """ Terminate the program with the given return code. """