Skip to content

Commit

Permalink
Remove mypy aspect
Browse files Browse the repository at this point in the history
The project providing the aspect does not offer a proper modern bzlmod
integration. Contribution is difficult due to the maintainer having
almost no time.
We do not really need a bazelized solution for this. We already
use the pre-commit framework and it offers as well a mypy integeation.
On top, we can more easily stop ignoring import errors with the
pre-commit based mypy integration.
  • Loading branch information
martis42 committed Jul 26, 2024
1 parent 301edb9 commit a83e326
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 121 deletions.
6 changes: 0 additions & 6 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,5 @@ common --lockfile_mode=off
# See https://github.com/bazelbuild/rules_python/issues/1653
common --nolegacy_external_runfiles

# Mypy integration
build:mypy --aspects=@mypy_integration//:mypy.bzl%mypy_aspect
build:mypy --output_groups=mypy
build:mypy --@mypy_integration//:mypy=//third_party:mypy
build:mypy --@mypy_integration//:mypy_config=//:mypy.ini

# Allow users to provide their own workspace settings
try-import %workspace%/user.bazelrc
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ jobs:
- uses: actions/checkout@v4
- name: Unit tests
run: ./scripts/unit_tests.sh
- name: Execute Mypy
run: ./scripts/mypy.sh
- name: Build aspect integration tests
run: ./scripts/build_aspect_tests.sh
- name: Build examples
Expand Down
20 changes: 0 additions & 20 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,3 @@ python = use_extension(
dev_dependency = True,
)
python.toolchain(python_version = "3.8")

pip = use_extension(
"@rules_python//python/extensions:pip.bzl",
"pip",
dev_dependency = True,
)
pip.parse(
hub_name = "dwyu_mypy_deps",
python_version = "3.8",
requirements_lock = "//third_party:mypy_requirements.txt",
)
use_repo(pip, "dwyu_mypy_deps")

bazel_dep(name = "mypy_integration", dev_dependency = True)
archive_override(
module_name = "mypy_integration",
integrity = "sha256-V1HVImCed4/4/ZdKDoPncNOYZDrceYdvpGW2tCnGfgY=",
strip_prefix = "bazel-mypy-integration-c289c0cd30e53b5cc467b601295834dbc400f4b2",
urls = ["https://github.com/bazel-contrib/bazel-mypy-integration/archive/c289c0cd30e53b5cc467b601295834dbc400f4b2.tar.gz"],
)
7 changes: 0 additions & 7 deletions examples/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
load("@rules_python//python:defs.bzl", "py_library")

# Helper target to enable mypy
py_library(
name = "python_files",
srcs = glob(["*.py"]),
)
5 changes: 0 additions & 5 deletions scripts/mypy.sh

This file was deleted.

7 changes: 0 additions & 7 deletions test/apply_fixes/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
load("@rules_python//python:defs.bzl", "py_library")

# Helper target to enable mypy
py_library(
name = "python_files",
srcs = glob(["**/*.py"]),
)
8 changes: 1 addition & 7 deletions test/aspect/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@rules_python//python:defs.bzl", "py_library", "py_test")
load("@rules_python//python:defs.bzl", "py_test")

py_test(
name = "result_test",
Expand All @@ -23,9 +23,3 @@ py_test(
"version_test.py",
],
)

# Helper target to enable mypy
py_library(
name = "python_files",
srcs = glob(["**/*.py"]),
)
5 changes: 0 additions & 5 deletions test_basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ echo "Execute unit tests"
echo ""
./scripts/unit_tests.sh

echo ""
echo "Executing mypy"
echo ""
./scripts/mypy.sh

echo ""
echo "Build aspect integration tests"
echo ""
Expand Down
14 changes: 0 additions & 14 deletions third_party/BUILD
Original file line number Diff line number Diff line change
@@ -1,14 +0,0 @@
load("@dwyu_mypy_deps//:requirements.bzl", "requirement")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

alias(
name = "mypy",
actual = requirement("mypy"),
visibility = ["//:__pkg__"],
)

compile_pip_requirements(
name = "mypy_requirements",
src = "mypy_requirements.in",
requirements_txt = "mypy_requirements.txt",
)
1 change: 0 additions & 1 deletion third_party/mypy_requirements.in

This file was deleted.

47 changes: 0 additions & 47 deletions third_party/mypy_requirements.txt

This file was deleted.

0 comments on commit a83e326

Please sign in to comment.