Skip to content

Commit 094ca58

Browse files
committed
Update mypy config file examples to use Label
Some mypy label references are used between repos (main and rules_mypy) so it is important that they are declared relative to the original bzl file correctly. Use `Label()` at the construction site to do this. (This is the "correct" fix for needing the full canonical name in string form, so update the advice to use "@@//name")
1 parent f83f70c commit 094ca58

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ mypy's behavior may be customized using a [mypy config file](https://mypy.readth
7070

7171
```starlark
7272
mypy_aspect = mypy(
73-
mypy_ini = "@@//:mypy.ini",
73+
mypy_ini = Label("//:mypy.ini"),
7474
types = types,
7575
)
7676
```
7777

7878
> [!NOTE]
79-
> The label passed to `mypy_ini` needs to be absolute (a prefix of `@@` means the root repo).
79+
> The label passed to `mypy_ini` is used across modules, so ensure you pass a `Label` (will be qualified relative to construction location) and not a regular string.
8080
8181
> [!NOTE]
8282
> mypy.ini files should likely contain the following lines to suppress type-checking 3rd party modules.
@@ -107,7 +107,7 @@ And in your `aspects.bzl` (or similar) file:
107107
load("@rules_mypy//mypy:mypy.bzl", "mypy")
108108

109109
mypy_aspect = mypy(
110-
mypy_cli = ":mypy_cli",
110+
mypy_cli = Label(":mypy_cli"),
111111
types = types,
112112
)
113113
```

0 commit comments

Comments
 (0)