Skip to content

Commit 37e7e68

Browse files
authored
Deleted legacy pip_import rule (bazel-contrib#582)
1 parent beed9a2 commit 37e7e68

36 files changed

+9
-1229
lines changed

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
# This lets us glob() up all the files inside the examples to make them inputs to tests
44
# (Note, we cannot use `common --deleted_packages` because the bazel version command doesn't support it)
55
# To update these lines, run tools/bazel_integration_test/update_deleted_packages.sh
6-
build --deleted_packages=examples/build_file_generation,examples/legacy_pip_import/boto,examples/legacy_pip_import/extras,examples/legacy_pip_import/helloworld,examples/pip_install,examples/pip_parse,examples/py_import,examples/relative_requirements
7-
query --deleted_packages=examples/build_file_generation,examples/legacy_pip_import/boto,examples/legacy_pip_import/extras,examples/legacy_pip_import/helloworld,examples/pip_install,examples/pip_parse,examples/py_import,examples/relative_requirements
6+
build --deleted_packages=examples/build_file_generation,examples/pip_install,examples/pip_parse,examples/py_import,examples/relative_requirements
7+
query --deleted_packages=examples/build_file_generation,examples/pip_install,examples/pip_parse,examples/py_import,examples/relative_requirements
88

99
test --test_output=errors
1010

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
Please check if your PR fulfills the following requirements:
44

5-
- [ ] Does not include precompiled binaries, eg. `.par` files. See [CONTRIBUTING.md](https://github.com/bazelbuild/rules_python/blob/master/CONTRIBUTING.md) for info
65
- [ ] Tests for the changes have been added (for bug fixes / features)
76
- [ ] Docs have been added / updated (for bug fixes / features)
87

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
/bazel-genfiles
3838
/bazel-out
3939
/bazel-testlogs
40+
user.bazelrc
4041

4142
# vim swap files
4243
*.swp
@@ -45,4 +46,4 @@
4546
# Go/Gazelle files
4647
# These otherwise match patterns above
4748
!go.mod
48-
!BUILD.out
49+
!BUILD.out

CONTRIBUTING.md

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,6 @@ bazel run //docs:update
5252
This needs to be done whenever the docstrings in the corresponding .bzl files
5353
are changed; a test failure will remind you to run this command when needed.
5454

55-
### Precompiled tools
56-
57-
The packaging rules depend on two precompiled binaries, `tools/piptool.par` and
58-
`tools/whltool.par`. We need these to be precompiled because they are invoked
59-
during `WORKSPACE` evaluation, before Bazel itself is able to build anything
60-
from source. The .par files can be regenerated by running this script in the
61-
repository root:
62-
63-
```shell
64-
# You can pass --nodocker if Docker is not available on your system.
65-
./update_tools.sh
66-
```
67-
68-
This needs to be done whenever the corresponding sources in the `packaging/`
69-
directory are updated.
70-
71-
Since these are binary files and therefore unreviewable, for security
72-
reasons<sup>1</sup> we will regenerate the .par files for you when merging your
73-
pull request.
74-
75-
<sup>1</sup> See "[Reflections on Trusting Trust](https://en.wikipedia.org/wiki/Backdoor_(computing)#Compiler_backdoors)".
76-
7755
## Core rules
7856

7957
The bulk of this repo is owned and maintained by the Bazel Python community.

README.md

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,6 @@ load("@my_deps//:requirements.bzl", "install_deps")
154154
install_deps()
155155
```
156156

157-
### Importing `pip` dependencies with `pip_import` (legacy)
158-
159-
The deprecated `pip_import` can still be used if needed. It is the only packaging rule that supports Python 2,
160-
which has been [sunsetted since January 1st, 2020](https://www.python.org/doc/sunset-python-2/).
161-
162-
```
163-
load("@rules_python//python/legacy_pip_import:pip.bzl", "pip_import", "pip_repositories")
164-
165-
# Create a central repo that knows about the dependencies needed for requirements.txt.
166-
pip_import(
167-
name = "my_deps",
168-
requirements = "//path/to:requirements.txt",
169-
)
170-
171-
# Load the central repo's install function from its `//:requirements.bzl` file, and call it.
172-
load("@my_deps//:requirements.bzl", "pip_install")
173-
pip_install()
174-
```
175-
176-
An example can be found in [`examples/legacy_pip_import`](examples/legacy_pip_import).
177-
178157
### Consuming `pip` dependencies
179158

180159
Each extracted wheel repo contains a `py_library` target representing the

docs/pip.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@ It also generates two targets for running pip-compile:
3535
| kwargs | other bazel attributes passed to the "_test" rule | none |
3636

3737

38-
<a name="#pip_import"></a>
39-
40-
## pip_import
41-
42-
<pre>
43-
pip_import(<a href="#pip_import-kwargs">kwargs</a>)
44-
</pre>
45-
46-
Rule for installing packages listed in a requirements file.
47-
48-
**PARAMETERS**
49-
50-
51-
| Name | Description | Default Value |
52-
| :-------------: | :-------------: | :-------------: |
53-
| kwargs | <p align="center"> - </p> | none |
54-
55-
5638
<a name="#pip_install"></a>
5739

5840
## pip_install

examples/BUILD

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ package(default_visibility = ["//visibility:public"])
1717

1818
licenses(["notice"]) # Apache 2.0
1919

20-
bazel_integration_test(
21-
name = "legacy_pip_import_example",
22-
timeout = "long",
23-
)
24-
2520
bazel_integration_test(
2621
name = "pip_install_example",
2722
timeout = "long",

examples/legacy_pip_import/.bazelrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/legacy_pip_import/README.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/legacy_pip_import/WORKSPACE

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/legacy_pip_import/boto/BUILD

Lines changed: 0 additions & 33 deletions
This file was deleted.

examples/legacy_pip_import/boto/boto_test.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/legacy_pip_import/boto/requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/legacy_pip_import/extras/BUILD

Lines changed: 0 additions & 31 deletions
This file was deleted.

examples/legacy_pip_import/extras/extras_test.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/legacy_pip_import/extras/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/legacy_pip_import/extras/version_test.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

examples/pip_install/.bazelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
test --test_output=errors
1+
# https://docs.bazel.build/versions/main/best-practices.html#using-the-bazelrc-file
2+
try-import %workspace%/user.bazelrc

examples/pip_parse/.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# https://docs.bazel.build/versions/main/best-practices.html#using-the-bazelrc-file
2+
try-import %workspace%/user.bazelrc

internal_deps.bzl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
"""Dependencies that are needed for rules_python tests and tools."""
22

3-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
43
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
54
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
6-
load("@rules_python//python/legacy_pip_import:pip.bzl", "pip_import")
75

86
def rules_python_internal_deps():
97
"""Fetches all required dependencies for rules_python tests and tools."""
@@ -120,21 +118,6 @@ def rules_python_internal_deps():
120118
],
121119
)
122120

123-
maybe(
124-
git_repository,
125-
name = "subpar",
126-
remote = "https://github.com/google/subpar",
127-
# tag = "2.0.0",
128-
commit = "35bb9f0092f71ea56b742a520602da9b3638a24f",
129-
shallow_since = "1557863961 -0400",
130-
)
131-
132-
maybe(
133-
pip_import,
134-
name = "piptool_deps",
135-
requirements = "@rules_python//python:requirements.txt",
136-
)
137-
138121
maybe(
139122
http_archive,
140123
name = "build_bazel_integration_testing",

internal_setup.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,13 @@
33
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
44
load("@build_bazel_integration_testing//tools:repositories.bzl", "bazel_binaries")
55
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
6-
7-
# Requirements for building our piptool.
8-
load(
9-
"@piptool_deps//:requirements.bzl",
10-
_piptool_install = "pip_install",
11-
)
126
load("//:version.bzl", "SUPPORTED_BAZEL_VERSIONS")
137
load("//gazelle:deps.bzl", _go_repositories = "gazelle_deps")
148
load("//python/pip_install:repositories.bzl", "pip_install_dependencies")
159

1610
def rules_python_internal_setup():
1711
"""Setup for rules_python tests and tools."""
1812

19-
# Requirements for building our piptool.
20-
_piptool_install()
21-
2213
# Because we don't use the pip_install rule, we have to call this to fetch its deps
2314
pip_install_dependencies()
2415

0 commit comments

Comments
 (0)