aspect-build / aspect-build/rules_py

[Bug]: pyi_deps, pyi_srcs not supported by py_library

Open
#1,514 0 comments 0 reactions 1 assignee Claimed by @xangcastle View on GitHub
bug
Dominant language
Starlark
Stars
145
Forks
97
Avg merge
1d 1h
Merged PRs (30d)
71

Description

### What happened?

When running Gazelle on a Python target that contains
```python
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from lib.my_module import AnExampleClass
```
Gazelle will attempt to create a `pyi_deps` item of `"//lib:my_module"`. `pyi_deps` is not supported in the `rules_py` `py_library` API at this time and will create a build failure.

Minimal example for repro:

https://github.com/addisonjones3/rules_py_pyi_repro

`main` branch fails on `bazel build //...`
`pre-gazelle` is the state prior to `bazel run //:gazelle_python`

### Version

Development (host) and target OS/architectures: Linux amd64

Output of `bazel --version`: 7.7.1

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
```python
bazel_dep(name = "aspect_gazelle_prebuilt", version = "0.0.24")
bazel_dep(name = "aspect_rules_py", version = "1.8.4")
```

Language(s) and/or frameworks involved:

### How to reproduce
Clone repro repo

To verify failure:
```shell
bazel build //...
```

To show Gazelle is automatically creating those deps when run:
Switch to `pre-gazelle` branch
```shell
bazel run //:gazelle_python & \
bazel build //...
```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.