Skip to content

Commit 227f346

Browse files
committed
Don't use bazel for third-party python dependencies.
1 parent 09fe866 commit 227f346

File tree

56 files changed

+28
-432
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+28
-432
lines changed

.github/workflows/ci.yaml

+1-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ jobs:
5858

5959
- name: Install python dependencies
6060
run: |
61-
python3 -m pip install --upgrade pip
62-
# Install python dependencies that fail with bazel pip import.
63-
grep -E '(numpy|torch)' programl/requirements.txt | xargs python3 -m pip install
64-
python3 -m pip install setuptools
61+
python3 -m pip install -r requirements.txt
6562
echo /home/runner/.local/bin >> $GITHUB_PATH
6663
6764
- name: whoami

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ flow analysis labels.
185185
download and use the correct bazel version).
186186
* Python ≥ 3.6
187187

188+
Install the python dependencies using:
189+
190+
```
191+
$ python -m pip install -r requirements.txt
192+
```
193+
188194
Once you have the above requirements installed, test that everything is working
189195
by building and running full test suite:
190196

WORKSPACE

-55
Original file line numberDiff line numberDiff line change
@@ -29,31 +29,6 @@ load("@com_github_chriscummins_rules_bats//:bats.bzl", "bats_deps")
2929

3030
bats_deps()
3131

32-
# === Python requirements ===
33-
34-
load(
35-
"@rules_python//python:pip.bzl",
36-
"pip3_import",
37-
"pip_repositories",
38-
)
39-
40-
pip_repositories()
41-
42-
# //programl:requirements.txt
43-
44-
pip3_import(
45-
name = "programl_requirements",
46-
timeout = 3600,
47-
requirements = "@programl//:programl/requirements.txt",
48-
)
49-
50-
load(
51-
"@programl_requirements//:requirements.bzl",
52-
programl_pip_install = "pip_install",
53-
)
54-
55-
programl_pip_install()
56-
5732
# === Protocol buffers ===
5833

5934
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
@@ -73,33 +48,3 @@ load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
7348
grpc_extra_deps()
7449

7550
# ----------------- End ProGraML dependencies -----------------
76-
77-
# //tasks:requirements.txt
78-
79-
pip3_import(
80-
name = "tasks_requirements",
81-
timeout = 3600,
82-
requirements = "@programl//:tasks/requirements.txt",
83-
)
84-
85-
load(
86-
"@tasks_requirements//:requirements.bzl",
87-
tasks_pip_install = "pip_install",
88-
)
89-
90-
tasks_pip_install()
91-
92-
# //tests:requirements.txt
93-
94-
pip3_import(
95-
name = "tests_requirements",
96-
timeout = 3600,
97-
requirements = "@programl//:tests/requirements.txt",
98-
)
99-
100-
load(
101-
"@tests_requirements//:requirements.bzl",
102-
tests_pip_install = "pip_install",
103-
)
104-
105-
tests_pip_install()

bin/BUILD

-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ py_binary(
116116
"//programl/proto:programl_py",
117117
"//programl/util/py:init_app",
118118
"//programl/util/py:stdin_fmt",
119-
"//third_party/py/absl",
120119
],
121120
)
122121

@@ -143,7 +142,6 @@ py_binary(
143142
"//programl/util/py:init_app",
144143
"//programl/util/py:stdin_fmt",
145144
"//programl/util/py:stdout_fmt",
146-
"//third_party/py/absl",
147145
],
148146
)
149147

programl/graph/format/py/BUILD

-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ py_library(
3131
deps = [
3232
"//programl/proto:programl_py",
3333
"//programl/util/py:runfiles_path",
34-
"//third_party/py/absl",
3534
],
3635
)
3736

@@ -61,7 +60,6 @@ py_library(
6160
srcs = ["graph_tuple.py"],
6261
visibility = ["//visibility:public"],
6362
deps = [
64-
"//third_party/py/numpy",
6563
],
6664
)
6765

@@ -72,7 +70,6 @@ py_library(
7270
deps = [
7371
":graph_tuple",
7472
"//programl/proto:programl_py",
75-
"//third_party/py/numpy",
7673
],
7774
)
7875

@@ -104,6 +101,5 @@ py_library(
104101
visibility = ["//visibility:public"],
105102
deps = [
106103
"//programl/proto:programl_py",
107-
"//third_party/py/networkx",
108104
],
109105
)

programl/ir/llvm/BUILD

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ py_library(
5454
"//programl/util/py:pbutil",
5555
"//programl/util/py:progress",
5656
"//programl/util/py:runfiles_path",
57-
"//third_party/py/absl",
58-
"//third_party/py/ncc/inst2vec:inst2vec_preprocess",
59-
"//third_party/py/numpy",
57+
"//third_party/ncc/inst2vec:inst2vec_preprocess",
6058
],
6159
)
6260

programl/ir/llvm/inst2vec_encoder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from programl.proto import node_pb2, program_graph_pb2
2828
from programl.util.py import decorators, pbutil, progress
2929
from programl.util.py.runfiles_path import runfiles_path
30-
from third_party.py.ncc.inst2vec import inst2vec_preprocess
30+
from third_party.ncc.inst2vec import inst2vec_preprocess
3131

3232
DICTIONARY = runfiles_path(
3333
"programl/programl/ir/llvm/internal/inst2vec_augmented_dictionary.pickle"

programl/ir/llvm/py/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ py_library(
2929
deps = [
3030
"//programl/proto:programl_py",
3131
"//programl/util/py:runfiles_path",
32-
"//third_party/py/absl",
3332
],
3433
)
3534

programl/ir/xla/py/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ py_library(
2828
visibility = ["//visibility:public"],
2929
deps = [
3030
"//programl/proto:programl_py",
31-
"//third_party/py/networkx",
3231
"//third_party/tensorflow:xla_py",
3332
],
3433
)

programl/models/BUILD

-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ py_library(
2323
deps = [
2424
":base_batch_builder",
2525
"//programl/util/py:humanize",
26-
"//third_party/py/absl",
2726
],
2827
)
2928

@@ -53,11 +52,6 @@ py_library(
5352
name = "batch_results",
5453
srcs = ["batch_results.py"],
5554
visibility = ["//visibility:public"],
56-
deps = [
57-
"//third_party/py/absl",
58-
"//third_party/py/numpy",
59-
"//third_party/py/scikit_learn",
60-
],
6155
)
6256

6357
py_library(
@@ -80,7 +74,6 @@ py_library(
8074
"//programl/models:rolling_results_builder",
8175
"//programl/proto:programl_py",
8276
"//programl/util/py:progress",
83-
"//third_party/py/absl",
8477
],
8578
)
8679

@@ -103,6 +96,5 @@ py_library(
10396
":batch_data",
10497
":batch_results",
10598
":rolling_results",
106-
"//third_party/py/tqdm",
10799
],
108100
)

programl/models/ggnn/BUILD

-17
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ py_library(
2020
name = "aux_readout",
2121
srcs = ["aux_readout.py"],
2222
deps = [
23-
"//third_party/py/torch",
2423
],
2524
)
2625

@@ -42,9 +41,6 @@ py_library(
4241
"//programl/models:model",
4342
"//programl/proto:programl_py",
4443
"//programl/util/py:progress",
45-
"//third_party/py/absl",
46-
"//third_party/py/numpy",
47-
"//third_party/py/torch",
4844
],
4945
)
5046

@@ -55,15 +51,13 @@ py_library(
5551
deps = [
5652
"//programl/graph/format/py:graph_tuple",
5753
"//programl/proto:programl_py",
58-
"//third_party/py/numpy",
5954
],
6055
)
6156

6257
py_library(
6358
name = "ggnn_layer",
6459
srcs = ["ggnn_layer.py"],
6560
deps = [
66-
"//third_party/py/torch",
6761
],
6862
)
6963

@@ -76,8 +70,6 @@ py_library(
7670
":loss",
7771
":metrics",
7872
":node_embeddings",
79-
"//third_party/py/absl",
80-
"//third_party/py/torch",
8173
],
8274
)
8375

@@ -88,23 +80,20 @@ py_library(
8880
":ggnn_layer",
8981
":messaging_layer",
9082
":readout",
91-
"//third_party/py/torch",
9283
],
9384
)
9485

9586
py_library(
9687
name = "linear_net",
9788
srcs = ["linear_net.py"],
9889
deps = [
99-
"//third_party/py/torch",
10090
],
10191
)
10292

10393
py_library(
10494
name = "loss",
10595
srcs = ["loss.py"],
10696
deps = [
107-
"//third_party/py/torch",
10897
],
10998
)
11099

@@ -114,32 +103,27 @@ py_library(
114103
deps = [
115104
":linear_net",
116105
":position_embeddings",
117-
"//third_party/py/torch",
118106
],
119107
)
120108

121109
py_library(
122110
name = "metrics",
123111
srcs = ["metrics.py"],
124112
deps = [
125-
"//third_party/py/torch",
126113
],
127114
)
128115

129116
py_library(
130117
name = "node_embeddings",
131118
srcs = ["node_embeddings.py"],
132119
deps = [
133-
"//third_party/py/numpy",
134-
"//third_party/py/torch",
135120
],
136121
)
137122

138123
py_library(
139124
name = "position_embeddings",
140125
srcs = ["position_embeddings.py"],
141126
deps = [
142-
"//third_party/py/torch",
143127
],
144128
)
145129

@@ -148,6 +132,5 @@ py_library(
148132
srcs = ["readout.py"],
149133
deps = [
150134
":linear_net",
151-
"//third_party/py/torch",
152135
],
153136
)

programl/models/lstm/BUILD

-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ py_library(
2626
"//programl/models:model",
2727
"//programl/proto:programl_py",
2828
"//programl/util/py:progress",
29-
"//third_party/py/absl",
30-
"//third_party/py/numpy",
3129
],
3230
)
3331

programl/util/py/BUILD

-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ py_library(
3434
visibility = ["//visibility:public"],
3535
deps = [
3636
"//programl",
37-
"//third_party/py/absl",
3837
],
3938
)
4039

@@ -43,7 +42,6 @@ py_library(
4342
srcs = ["pbutil.py"],
4443
visibility = ["//visibility:public"],
4544
deps = [
46-
"//third_party/py/protobuf",
4745
],
4846
)
4947

@@ -53,8 +51,6 @@ py_library(
5351
visibility = ["//visibility:public"],
5452
deps = [
5553
":humanize",
56-
"//third_party/py/absl",
57-
"//third_party/py/tqdm",
5854
],
5955
)
6056

@@ -73,8 +69,6 @@ py_library(
7369
visibility = ["//visibility:public"],
7470
deps = [
7571
"//programl/util/py:pbutil",
76-
"//third_party/py/absl",
77-
"//third_party/py/protobuf",
7872
],
7973
)
8074

@@ -83,8 +77,6 @@ py_library(
8377
srcs = ["stdout_fmt.py"],
8478
visibility = ["//visibility:public"],
8579
deps = [
86-
"//third_party/py/absl",
87-
"//third_party/py/protobuf",
8880
],
8981
)
9082

0 commit comments

Comments
 (0)