Skip to content

Commit

Permalink
Merge pull request bazel-contrib#62 from UebelAndre/repo
Browse files Browse the repository at this point in the history
Replace `mypy_integration_config` repo with label flag
  • Loading branch information
alexeagle authored Jun 10, 2022
2 parents abd7039 + 56f6f2f commit ad1d482
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://mypy.readthedocs.io/en/stable/config_file.html
[mypy]
7 changes: 7 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@ licenses(["notice"]) # MIT
exports_files([
"LICENSE",
"version.bzl",
".mypy.ini",
])

label_flag(
name = "mypy_config",
build_setting_default = "//:.mypy.ini",
visibility = ["//visibility:public"],
)
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,14 @@ mypy_test(
### Configuration

To support the [MyPy configuration file](https://mypy.readthedocs.io/en/latest/config_file.html) you can add the
following to your `WORKSPACE`:
following to your `.bazelrc`:

```text
build --@mypy_integration//:mypy_config=//:mypy.ini
```
load("@mypy_integration//:config.bzl", "mypy_configuration")
mypy_configuration("//tools/typing:mypy.ini")
```

where `//tools/typing:mypy.ini` is a [valid MyPy config file](https://mypy.readthedocs.io/en/latest/config_file.html#config-file-format).

where `//:mypy.ini` is a [valid MyPy config file](https://mypy.readthedocs.io/en/latest/config_file.html#config-file-format)
within your projects workspace.

## 🛠 Development

Expand Down
4 changes: 0 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ load(

mypy_integration_repositories()

load("//:config.bzl", "mypy_configuration")

mypy_configuration()

load("//repositories:deps.bzl", mypy_integration_deps = "deps")

mypy_integration_deps("//:current_mypy_version.txt")
Expand Down
5 changes: 5 additions & 0 deletions config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ create_config = repository_rule(
)

def mypy_configuration(mypy_config_file = None):
"""**Deprecated**: Instead, see https://github.com/bazel-contrib/bazel-mypy-integration/blob/main/README.md#configuration
Args:
mypy_config_file (Label, optional): The label of a mypy configuration file
"""
create_config(
name = "mypy_integration_config",
config_filepath = mypy_config_file,
Expand Down
2 changes: 1 addition & 1 deletion mypy.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DEFAULT_ATTRS = {
cfg = "host",
),
"_mypy_config": attr.label(
default = Label("@mypy_integration_config//:mypy.ini"),
default = Label("//:mypy_config"),
allow_single_file = True,
),
}
Expand Down

0 comments on commit ad1d482

Please sign in to comment.