The GitHub Actions job "CI" on tvm-ffi.git/2025-11-29/init has failed.
Run started by GitHub user junrushao (triggered by junrushao).

Head commit for run:
321d8f883e6483c0e6947288ab0d101ddd85aa72 / Junru Shao <[email protected]>
[Stubgen] Introduce `--init-path` for package-level generation

This PR introduces an additional flag `--init-path` to the tool
`tvm-ffi-stubgen`.

When this flag is specified, the tool will actively look for global
functions and objects that are not yet exported into Python, and
generate their type stubs into the path specified by `--init-path`.

To give an example, if a C++ TVM-FFI extension defines two items:
- A global function: `my_ffi_extension.add_one`
- An object: `my_ffi_extension.IntPair`
which are not yet exported to Python, the tool will generate the
following two files if `--init-path=/path/` is set:

```
/path/__init__.py
/path/_ffi_api.py
```

Where `__init__.py` contains:

```python
"""Package my_ffi_extension."""

/# tvm-ffi-stubgen(begin): export/_ffi_api
/# fmt: off
/# isort: off
from ._ffi_api import *  # noqa: F403
from ._ffi_api import __all__ as _ffi_api__all__
if "__all__" not in globals(): __all__ = []
__all__.extend(_ffi_api__all__)
/# isort: on
/# fmt: on
/# tvm-ffi-stubgen(end)
```

and `_ffi_api.py` contains:

```python
"""FFI API bindings for my_ffi_extension."""

/# tvm-ffi-stubgen(begin): import
/# fmt: off
/# isort: off
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
    from tvm_ffi import Object
/# isort: on
/# fmt: on
/# tvm-ffi-stubgen(end)

/# tvm-ffi-stubgen(begin): global/my_ffi_extension
/# fmt: off
/# isort: off
from tvm_ffi import init_ffi_api as _INIT
_INIT("my_ffi_extension", __name__)
/# isort: on
if TYPE_CHECKING:
    def raise_error(_0: str, /) -> None: ...
/# fmt: on
/# tvm-ffi-stubgen(end)

__all__ = [
    # tvm-ffi-stubgen(begin): __all__
    "IntPair",
    "raise_error",
    # tvm-ffi-stubgen(end)
]

/# isort: off
import tvm_ffi
/# isort: on

@tvm_ffi.register_object("my_ffi_extension.IntPair")
class IntPair(tvm_ffi.Object):
    """FFI binding for `my_ffi_extension.IntPair`."""

    /# tvm-ffi-stubgen(begin): object/my_ffi_extension.IntPair
    /# fmt: off
    a: int
    b: int
    if TYPE_CHECKING:
        @staticmethod
        def __c_ffi_init__(_0: int, _1: int, /) -> Object: ...
        @staticmethod
        def static_get_second(_0: IntPair, /) -> int: ...
        def get_first(self, /) -> int: ...
    /# fmt: on
    /# tvm-ffi-stubgen(end)
```

Report URL: https://github.com/apache/tvm-ffi/actions/runs/20223299511

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to