8000 Remove mention and usage of Bazel Federation (#339) · rahulmutt/rules_python@2c117e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2c117e3

Browse files
authored
Remove mention and usage of Bazel Federation (bazel-contrib#339)
It's currently a stalled project so it's not useful for us to direct new users there in our README. Separately it is harder to develop on rules_python since it is currently not self-contained. For example it's hard to find or adjust the version of rules_pkg without looking/editing in the federation repo. Tony says this is an okay change: bazelbuild/bazel-federation@63f9746#commitcomment-40577834
1 parent 32e9648 commit 2c117e3

File tree

3 files changed

+107
-63
lines changed

3 files changed

+107
-63
lines changed

README.md

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,32 +50,7 @@ contribute](CONTRIBUTING.md) page for information on our development workflow.
5050
## Getting started
5151

5252
To import rules_python in your project, you first need to add it to your
53-
`WORKSPACE` file. If you are using the [Bazel
54-
Federation](https://github.com/bazelbuild/bazel-federation), you just need to
55-
[import the Federation](https://github.com/bazelbuild/bazel-federation#example-workspace)
56-
and call the rules_python setup methods:
57-
58-
```python
59-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
60-
61-
http_archive(
62-
name = "bazel_federation",
63-
url = "https://github.com/bazelbuild/bazel-federation/releases/download/0.0.1/bazel_federation-0.0.1.tar.gz",
64-
sha256 = "506dfbfd74ade486ac077113f48d16835fdf6e343e1d4741552b450cfc2efb53",
65-
)
66-
67-
load("@bazel_federation//:repositories.bzl", "rules_python_deps")
68-
69-
rules_python_deps()
70-
load("@bazel_federation//setup:rules_python.bzl", "rules_python_setup")
71-
rules_python_setup(use_pip=True)
72-
```
73-
74-
Note the `use_pip` argument: rules_python may be imported either with or
75-
without support for the packaging rules.
76-
77-
If you are not using the Federation, you can simply import rules_python
78-
directly and call its initialization methods as follows:
53+
`WORKSPACE` file:
7954

8055
```python
8156
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
@@ -85,9 +60,11 @@ http_archive(
8560
strip_prefix = "rules_python-0.0.2",
8661
sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c",
8762
)
88-
load("@rules_python//python:repositories.bzl", "py_repositories")
89-
py_repositories()
90-
# Only needed if using the packaging rules.
63+
```
64+
65+
If you want to use the pip packaging rules, also add:
66+
67+
```python
9168
load("@rules_python//python:pip.bzl", "pip_repositories")
9269
pip_repositories()
9370
```

WORKSPACE

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,9 @@
1414

1515
workspace(name = "rules_python")
1616

17-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
17+
load("//python:pip.bzl", "pip_repositories")
1818

19-
# Load our production dependencies using the federation, except that instead of
20-
# calling rules_python() (which would define the @rules_python repo), we just
21-
# call rules_python_deps().
22-
23-
http_archive(
24-
name = "bazel_federation",
25-
sha256 = "506dfbfd74ade486ac077113f48d16835fdf6e343e1d4741552b450cfc2efb53",
26-
url = "https://github.com/bazelbuild/bazel-federation/releases/download/0.0.1/bazel_federation-0.0.1.tar.gz",
27-
)
28-
29-
load("@bazel_federation//:repositories.bzl", "rules_python_deps")
30-
31-
rules_python_deps()
32-
33-
load("@bazel_federation//setup:rules_python.bzl", "rules_python_setup")
34-
35-
rules_python_setup(use_pip = True)
19+
pip_repositories()
3620

3721
# Everything below this line is used only for developing rules_python. Users
3822
# should not copy it to their WORKSPACE.

internal_deps.bzl

Lines changed: 99 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,118 @@
11
"""Dependencies that are needed for rules_python tests and tools."""
22

3-
load("@bazel_federation//:repositories.bzl", "bazel_stardoc", "rules_pkg")
4-
load("@bazel_federation//:third_party_repositories.bzl", "futures_2_whl", "futures_3_whl", "google_cloud_language_whl", "grpc_whl", "mock_whl", "subpar")
3+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
5+
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
56
load("@rules_python//python:pip.bzl", "pip_import")
67

78
def rules_python_internal_deps():
89
"""Fetches all required dependencies for rules_python tests and tools."""
9-
bazel_stardoc()
1010

11-
subpar()
11+
maybe(
12+
http_archive,
13+
name = "bazel_skylib",
14+
strip_prefix = "bazel-skylib-1.0.2",
15+
url = "https://github.com/bazelbuild/bazel-skylib/archive/1.0.2.zip",
16+
type = "zip",
17+
sha256 = "64ad2728ccdd2044216e4cec7815918b7bb3bb28c95b7e9d951f9d4eccb07625",
18+
)
19+
20+
maybe(
21+
http_archive,
22+
name = "rules_pkg",
23+
urls = [
24+
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
25+
"https://github.com/bazelbuild/rules_pkg/releases/download/0.2.4/rules_pkg-0.2.4.tar.gz",
26+
],
27+
sha256 = "4ba8f4ab0ff85f2484287ab06c0d871dcb31cc54d439457d28fd4ae14b18450a",
28+
)
29+
30+
maybe(
31+
http_archive,
32+
name = "io_bazel_skydoc",
33+
url = "https://github.com/bazelbuild/skydoc/archive/0.3.0.tar.gz",
34+
sha256 = "c2d66a0cc7e25d857e480409a8004fdf09072a1bd564d6824441ab2f96448eea",
35+
strip_prefix = "skydoc-0.3.0",
36+
)
1237

1338
# Test data for WHL tool testing.
14-
futures_2_whl()
15-
futures_3_whl()
16-
google_cloud_language_whl()
17-
grpc_whl()
18-
mock_whl()
39+
maybe(
40+
http_file,
41+
name = "futures_2_2_0_whl",
42+
downloaded_file_path = "futures-2.2.0-py2.py3-none-any.whl",
43+
sha256 = "9fd22b354a4c4755ad8c7d161d93f5026aca4cfe999bd2e53168f14765c02cd6",
44+
# From https://pypi.python.org/pypi/futures/2.2.0
45+
urls = [
46+
"https://mirror.bazel.build/pypi.python.org/packages/d7/1d/68874943aa37cf1c483fc61def813188473596043158faa6511c04a038b4/futures-2.2.0-py2.py3-none-any.whl",
47+
"https://pypi.python.org/packages/d7/1d/68874943aa37cf1c483fc61def813188473596043158faa6511c04a038b4/futures-2.2.0-py2.py3-none-any.whl",
48+
],
49+
)
1950

20-
piptool()
21-
examples()
51+
maybe(
52+
http_file,
53+
name = "futures_3_1_1_whl",
54+
downloaded_file_path = "futures-3.1.1-py2-none-any.whl",
55+
sha256 = "c4884a65654a7c45435063e14ae85280eb1f111d94e542396717ba9828c4337f",
56+
# From https://pypi.python.org/pypi/futures
57+
urls = [
58+
"https://mirror.bazel.build/pypi.python.org/packages/a6/1c/72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/futures-3.1.1-py2-none-any.whl",
59+
"https://pypi.python.org/packages/a6/1c/72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/futures-3.1.1-py2-none-any.whl",
60+
],
61+
)
62+
63+
maybe(
64+
http_file,
65+
name = "google_cloud_language_whl",
66+
downloaded_file_path = "google_cloud_language-0.29.0-py2.py3-none-any.whl",
67+
sha256 = "a2dd34f0a0ebf5705dcbe34bd41199b1d0a55c4597d38ed045bd183361a561e9",
68+
# From https://pypi.python.org/pypi/google-cloud-language
69+
urls = [
70+
"https://mirror.bazel.build/pypi.python.org/packages/6e/86/cae57e4802e72d9e626ee5828ed5a646cf4016b473a4a022f1038dba3460/google_cloud_language-0.29.0-py2.py3-none-any.whl",
71+
"https://pypi.python.org/packages/6e/86/cae57e4802e72d9e626ee5828ed5a646cf4016b473a4a022f1038dba3460/google_cloud_language-0.29.0-py2.py3-none-any.whl",
72+
],
73+
)
2274

23-
# For packaging and distribution
24-
rules_pkg()
75+
maybe(
76+
http_file,
77+
name = "grpc_whl",
78+
downloaded_file_path = "grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl",
79+
sha256 = "c232d6d168cb582e5eba8e1c0da8d64b54b041dd5ea194895a2fe76050916561",
80+
# From https://pypi.python.org/pypi/grpcio/1.6.0
81+
urls = [
82+
"https://mirror.bazel.build/pypi.python.org/packages/c6/28/67651b4eabe616b27472c5518f9b2aa3f63beab8f62100b26f05ac428639/grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl",
83+
"https://pypi.python.org/packages/c6/28/67651b4eabe616b27472c5518f9b2aa3f63beab8f62100b26f05ac428639/grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl",
84+
],
85+
)
2586

26-
def piptool():
27-
"""Fetches all required dependencies for pip."""
28-
pip_import(
87+
maybe(
88+
http_file,
89+
name = "mock_whl",
90+
downloaded_file_path = "mock-2.0.0-py2.py3-none-any.whl",
91+
sha256 = "5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1",
92+
# From https://pypi.python.org/pypi/mock
93+
urls = [
94+
"https://mirror.bazel.build/pypi.python.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl",
95+
"https://pypi.python.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl",
96+
],
97+
)
98+
99+
maybe(
100+
git_repository,
101+
name = "subpar",
102+
remote = "https://github.com/google/subpar",
103+
# tag = "2.0.0",
104+
commit = "35bb9f0092f71ea56b742a520602da9b3638a24f",
105+
shallow_since = "1557863961 -0400",
106+
)
107+
108+
maybe(
109+
pip_import,
29110
name = "piptool_deps",
30111
requirements = "@rules_python//python:requirements.txt",
31112
)
32113

114+
examples()
115+
33116
def examples():
34117
"""Fetches all required dependencies for rules_python examples."""
35118
pip_import(

0 commit comments

Comments
 (0)
0