Add python stub file
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 19 Jul 2025 10:50:22 +0000 (12:50 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 7 Aug 2025 22:17:06 +0000 (00:17 +0200)
Improve IDE integration by providing a stub file.

pyffish.pyi [new file with mode: 0644]
setup.py

diff --git a/pyffish.pyi b/pyffish.pyi
new file mode 100644 (file)
index 0000000..c955f22
--- /dev/null
@@ -0,0 +1,39 @@
+from typing import Any
+
+FEN_OK: int
+NOTATION_DEFAULT: int
+NOTATION_JANGGI: int
+NOTATION_LAN: int
+NOTATION_SAN: int
+NOTATION_SHOGI_HODGES: int
+NOTATION_SHOGI_HODGES_NUMBER: int
+NOTATION_SHOGI_HOSKING: int
+NOTATION_THAI_LAN: int
+NOTATION_THAI_SAN: int
+NOTATION_XIANGQI_WXF: int
+VALUE_DRAW: int
+VALUE_MATE: int
+
+class error(Exception): ...
+
+def version() -> tuple[int, int, int]: ...
+def info() -> str: ...
+def variants() -> list[str]: ...
+def set_option(name: str, value: Any) -> None: ...
+def load_variant_config(config: str) -> None: ...
+def start_fen(variant: str) -> str: ...
+def two_boards(variant: str) -> bool: ...
+def captures_to_hand(variant: str) -> bool: ...
+def get_san(variant: str, fen: str, move: str, chess960: bool = False, notation: int = NOTATION_DEFAULT) -> str: ...
+def get_san_moves(variant: str, fen: str, movelist: list[str], chess960: bool = False, notation: int = NOTATION_DEFAULT) -> list[str]: ...
+def legal_moves(variant: str, fen: str, movelist: list[str], chess960: bool = False) -> list[str]: ...
+def get_fen(variant: str, fen: str, movelist: list[str], chess960: bool = False, sfen: bool = False, show_promoted: bool = False, count_started: int = 0) -> str: ...
+def gives_check(variant: str, fen: str, movelist: list[str], chess960: bool = False) -> bool: ...
+def is_capture(variant: str, fen: str, movelist: list[str], move: str, chess960: bool = False) -> bool: ...
+def piece_to_partner(variant: str, fen: str, movelist: list[str], chess960: bool = False) -> str: ...
+def game_result(variant: str, fen: str, movelist: list[str], chess960: bool = False) -> int: ...
+def is_immediate_game_end(variant: str, fen: str, movelist: list[str], chess960: bool = False) -> tuple[bool, int]: ...
+def is_optional_game_end(variant: str, fen: str, movelist: list[str], chess960: bool = False, count_started: int = 0) -> tuple[bool, int]: ...
+def has_insufficient_material(variant: str, fen: str, movelist: list[str], chess960: bool = False) -> tuple[bool, bool]: ...
+def validate_fen(fen: str, variant: str, chess960: bool = False) -> int: ...
+def get_fog_fen(fen: str, variant: str, chess960: bool = False) -> str: ...
index 81d4683..707042c 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -49,5 +49,6 @@ setup(name="pyffish", version="0.0.88",
       classifiers=CLASSIFIERS,
       url="https://github.com/gbtami/Fairy-Stockfish",
       python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
-      ext_modules=[pyffish_module]
+      ext_modules=[pyffish_module],
+      data_files=[("", ["pyffish.pyi"])]
       )