Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace mypy_integration_config repo with label flag #62

Merged
merged 1 commit into from
Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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