Skip to content

Commit 52e0dd8

Browse files
authored
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 remove the advice to use "@@//name")
1 parent f83f70c commit 52e0dd8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

readme.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,11 @@ 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

78-
> [!NOTE]
79-
> The label passed to `mypy_ini` needs to be absolute (a prefix of `@@` means the root repo).
80-
8178
> [!NOTE]
8279
> mypy.ini files should likely contain the following lines to suppress type-checking 3rd party modules.
8380
>
@@ -107,7 +104,7 @@ And in your `aspects.bzl` (or similar) file:
107104
load("@rules_mypy//mypy:mypy.bzl", "mypy")
108105

109106
mypy_aspect = mypy(
110-
mypy_cli = ":mypy_cli",
107+
mypy_cli = Label(":mypy_cli"),
111108
types = types,
112109
)
113110
```

0 commit comments

Comments
 (0)