diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cf6c9626ce..acdfc494e9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,7 +7,6 @@ /python/ @brandjon @lberki # But not everything under python/ is the core Python rules. /python/pip.bzl @thundergolfer @andyscott -/python/whl.bzl @thundergolfer @andyscott /python/requirements.txt @thundergolfer @andyscott # Directory containing the Gazelle extension and Go code. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da4b625f43..41dbd96fc2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ fully migrated to Starlark code. Practically, this means that a Bazel team member should approve any PR concerning the core Python logic. This includes everything under the `python/` -directory except for `pip.bzl`, `whl.bzl`, and `requirements.txt`. +directory except for `pip.bzl` and `requirements.txt`. Issues should be triaged as follows: diff --git a/docs/BUILD b/docs/BUILD index 4264bd3ed4..fe883d1c0d 100644 --- a/docs/BUILD +++ b/docs/BUILD @@ -25,7 +25,6 @@ _DOCS = { "packaging": "//docs:packaging-docs", "pip": "//docs:pip-docs", "python": "//docs:core-docs", - "whl": "//docs:whl-docs", } # We define these bzl_library targets here rather than in the //python package @@ -86,10 +85,6 @@ stardoc( deps = [":defs"], ) -# TODO: Consider merging documentation pages for whl and pip. This would -# require re-exporting their symbols from a common .bzl; see -# https://github.com/bazelbuild/skydoc/issues/208. - stardoc( name = "pip-docs", out = "pip.md_", @@ -101,12 +96,6 @@ stardoc( ], ) -stardoc( - name = "whl-docs", - out = "whl.md_", - input = "//python:whl.bzl", -) - stardoc( name = "packaging-docs", out = "packaging.md_", diff --git a/docs/whl.md b/docs/whl.md deleted file mode 100755 index bf8c73f94e..0000000000 --- a/docs/whl.md +++ /dev/null @@ -1,40 +0,0 @@ - - - - -## whl_library - -
-whl_library(name, extras, python_interpreter, requirements, whl) -- -A rule for importing `.whl` dependencies into Bazel. - -This rule is currently used to implement `pip_import`. It is not intended to -work standalone, and the interface may change. See `pip_import` for proper -usage. - -This rule imports a `.whl` file as a `py_library`: -```python -whl_library( - name = "foo", - whl = ":my-whl-file", - requirements = "name of pip_import rule", -) -``` - -This rule defines `@foo//:pkg` as a `py_library` target. - - -**ATTRIBUTES** - - -| Name | Description | Type | Mandatory | Default | -| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | -| name | A unique name for this repository. | Name | required | | -| extras | A subset of the "extras" available from this
.whl for which requirements has the dependencies. | List of strings | optional | [] |
-| python_interpreter | The command to run the Python interpreter used when unpacking the wheel. | String | optional | "python" |
-| requirements | The name of the pip_import repository rule from which to load this .whl's dependencies. | String | optional | "" |
-| whl | The path to the .whl file. The name is expected to follow [this convention](https://www.python.org/dev/peps/pep-0427/#file-name-convention)). | Label | required | |
-
-
diff --git a/python/BUILD b/python/BUILD
index 9470ad6024..96df38348e 100644
--- a/python/BUILD
+++ b/python/BUILD
@@ -46,7 +46,6 @@ filegroup(
"defs.bzl",
"packaging.bzl",
"pip.bzl",
- "whl.bzl",
"//python/private:bzl",
],
visibility = ["//:__pkg__"],
@@ -135,5 +134,4 @@ alias(
exports_files([
"packaging.bzl",
"pip.bzl",
- "whl.bzl",
])
diff --git a/python/whl.bzl b/python/whl.bzl
deleted file mode 100644
index 336a782f03..0000000000
--- a/python/whl.bzl
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright 2017 Google Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Import .whl files into Bazel."""
-
-def _whl_impl(repository_ctx):
- """Core implementation of whl_library."""
-
- args = [
- repository_ctx.attr.python_interpreter,
- repository_ctx.path(repository_ctx.attr._script),
- "--whl",
- repository_ctx.path(repository_ctx.attr.whl),
- "--requirements",
- repository_ctx.attr.requirements,
- ]
-
- if repository_ctx.attr.extras:
- args += [
- "--extras=%s" % extra
- for extra in repository_ctx.attr.extras
- ]
-
- result = repository_ctx.execute(args)
- if result.return_code:
- fail("whl_library failed: %s (%s)" % (result.stdout, result.stderr))
-
-whl_library = repository_rule(
- attrs = {
- "extras": attr.string_list(doc = """
-A subset of the "extras" available from this `.whl` for which
-`requirements` has the dependencies.
-"""),
- "python_interpreter": attr.string(default = "python", doc = """
-The command to run the Python interpreter used when unpacking the wheel.
-"""),
- "requirements": attr.string(doc = """
-The name of the `pip_import` repository rule from which to load this
-`.whl`'s dependencies.
-"""),
- "whl": attr.label(
- mandatory = True,
- allow_single_file = True,
- doc = """
-The path to the `.whl` file. The name is expected to follow [this
-convention](https://www.python.org/dev/peps/pep-0427/#file-name-convention)).
-""",
- ),
- "_script": attr.label(
- executable = True,
- default = Label("//tools:whltool.par"),
- cfg = "host",
- ),
- },
- implementation = _whl_impl,
- doc = """A rule for importing `.whl` dependencies into Bazel.
-
-This rule is currently used to implement `pip_import`. It is not intended to
-work standalone, and the interface may change. See `pip_import` for proper
-usage.
-
-This rule imports a `.whl` file as a `py_library`:
-```python
-whl_library(
- name = "foo",
- whl = ":my-whl-file",
- requirements = "name of pip_import rule",
-)
-```
-
-This rule defines `@foo//:pkg` as a `py_library` target.
-""",
-)