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

chore: update rules_python to latest release #61

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 5 additions & 5 deletions config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Provides functions to support (optionally) passing the MyPy configuration file
to this integration.
"""

def _create_config_impl(ctx):
if ctx.attr.config_filepath:
user_mypy_config_contents = ctx.read(ctx.attr.config_filepath)
def _create_config_impl(rctx):
if rctx.attr.config_filepath:
user_mypy_config_contents = rctx.read(rctx.attr.config_filepath)
else:
user_mypy_config_contents = "[mypy]"

ctx.file(
rctx.file(
"mypy.ini",
content = user_mypy_config_contents,
executable = False,
)
ctx.file(
rctx.file(
"BUILD",
content = "exports_files(['mypy.ini'])",
executable = False,
Expand Down
23 changes: 13 additions & 10 deletions repositories/py_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
Provides functions to pull the external Mypy package dependency.
"""

load("@rules_python//python:pip.bzl", "pip_install")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@rules_python//python:pip.bzl", _pip_install = "pip_install")

def pip_install(name, **kwargs):
maybe(_pip_install, name = name, **kwargs)

# buildifier: disable=function-docstring-args
def py_deps(mypy_requirements_file, python_interpreter, python_interpreter_target, extra_pip_args):
Expand All @@ -15,12 +19,11 @@ def py_deps(mypy_requirements_file, python_interpreter, python_interpreter_targe
already.
"""
external_repo_name = "mypy_integration_pip_deps"
excludes = native.existing_rules().keys()
if external_repo_name not in excludes:
pip_install(
name = external_repo_name,
requirements = mypy_requirements_file,
python_interpreter = python_interpreter or "python3", # mypy requires Python3
python_interpreter_target = python_interpreter_target,
extra_pip_args = extra_pip_args,
)

pip_install(
name = external_repo_name,
requirements = mypy_requirements_file,
python_interpreter = python_interpreter or "python3", # mypy requires Python3
python_interpreter_target = python_interpreter_target,
extra_pip_args = extra_pip_args,
)
45 changes: 24 additions & 21 deletions repositories/repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
"""Rules to load all dependencies of this project."""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

# buildifier: disable=function-docstring
def repositories():
excludes = native.existing_rules().keys()
def http_archive(name, **kwargs):
maybe(_http_archive, name = name, **kwargs)

rules_python_version = "0.1.0"
versions = struct(
bazel_skylib = "1.0.2",
rules_python = "0.8.1",
)

if "rules_python" not in excludes:
http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/archive/{version}.tar.gz".format(version = rules_python_version),
strip_prefix = "rules_python-{version}".format(version = rules_python_version),
sha256 = "48f7e716f4098b85296ad93f5a133baf712968c13fbc2fdf3a6136158fe86eac",
)
# buildifier: disable=function-docstring
def repositories():
http_archive(
name = "rules_python",
sha256 = "29a801171f7ca190c543406f9894abf2d483c206e14d6acbd695623662320097",
strip_prefix = "rules_python-0.18.1",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.18.1/rules_python-0.18.1.tar.gz",
)

if "bazel_skylib" not in excludes:
http_archive(
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
],
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
)
http_archive(
name = "bazel_skylib",
sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
],
)