bazel-contrib/bazel-mypy-integration

@mypy_integration_pip_deps

Closed this issue · 3 comments

external/mypy_integration/mypy/BUILD:3:10: no such package '@mypy_integration_pip_deps_mypy//': The repository '@mypy_integration_pip_deps_mypy' could not be resolved: Repository '@mypy_integration_pip_deps_mypy' is not defined and referenced by '@mypy_integration//mypy:mypy'

I've correctly copied the bazel WORKSPACE snipped, but can't fix this issue when invoking Python builds.

This is my Python config

#### Build Rules for Python
http_archive(
    name = "rules_python",
    sha256 = "a644da969b6824cc87f8fe7b18101a8a6c57da5db39caa6566ec6109f37d2141",
    strip_prefix = "rules_python-0.20.0",
    url = "https://github.com/bazelbuild/rules_python/releases/download/0.20.0/rules_python-0.20.0.tar.gz",
)


load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

load("@rules_python//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
    name = "python3_10",
    # Available versions are listed in @rules_python//python:versions.bzl.
    # We recommend using the same version your team is already standardized on.
    python_version = "3.10",
)

load("@python3_10//:defs.bzl", "interpreter")


load("@rules_python//python:pip.bzl", "install")

pip_parse(
    name = "pip",
    python_interpreter_target = interpreter,
    requirements_lock = "//third_party/python:requirements.txt",
)

load("@pip//:requirements.bzl", "install_deps")

install_deps()
####### 

I'm also using the aspect integration in .bazelrc:

build --aspects @mypy_integration//:mypy.bzl%mypy_aspect
build --output_groups=+mypy

Also seeing this issue

It's because rules_python was updated in 0.14.0 and updated pip_install to pip_parse. pip_parse requires install_deps to actually download the dependencies. For example,

###############
## MyPy       #
###############
http_archive(
    name = "mypy_integration",
    sha256 = "cf94c102fbaccb587eea8de5cf1cb7f55c5c74396a2468932c3a2a4df989aa1d",
    strip_prefix = "bazel-mypy-integration-0.4.0",
    url = "https://github.com/thundergolfer/bazel-mypy-integration/archive/refs/tags/0.4.0.tar.gz",
)

load(
    "@mypy_integration//repositories:repositories.bzl",
    mypy_integration_repositories = "repositories",
)

mypy_integration_repositories()

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

mypy_configuration("//tools/typing:mypy.ini")

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

mypy_integration_deps(
    "//tools/typing:mypy_version.txt",
    python_interpreter_target = python_interpreter,
)

# Download all the requirements listed in //tools/typing:mypy_version.txt
load("@mypy_integration_pip_deps//:requirements.bzl", mypy_install_deps = "install_deps")
mypy_install_deps()

and this is my mypy_version.txt

mypy==1.4.1
tomli==2.0.1
mypy-extensions==1.0.0
typing_extensions==4.7.1

I'm able to solve it by downgrading rules_python to 0.13.0 too

It's too difficult for this repo to provide the whole mypy toolchain. I'm closing this with a plan of instead having the mypy defined in the user's repository and just passed to the mypy rule as a label. Follow aspect-build/rules_lint#79