You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-3Lines changed: 28 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,36 @@ Contains Bazel rules to fetch and install Python dependencies from a requirement
4
4
5
5
## Usage
6
6
7
-
In `requirements.txt`
7
+
#### Setup `requirements.txt`
8
+
9
+
`rules_python_external` requires a _transitively-closed_`requirements.txt` file, which would
10
+
be very tedious to produce and maintain manually. To automate the process we recommend [`pip-compile` from `jazzband/pip-tools`](https://github.com/jazzband/pip-tools#example-usage-for-pip-compile).
11
+
12
+
For example, `pip-compile` takes a `requirements.in` like this:
13
+
14
+
```
15
+
boto3~=1.9.227
16
+
botocore~=1.12.247
17
+
click~=7.0
18
+
```
19
+
20
+
These above are the third-party packages you can directly import.
21
+
22
+
`pip-compile` 'compiles' it so you get a transitively-closed `requirements.txt` like this, which should be passed to `pip_install` below:
23
+
8
24
```
9
-
cryptography==2.8
10
25
boto3==1.9.253
26
+
botocore==1.12.253
27
+
click==7.0
28
+
docutils==0.15.2 # via botocore
29
+
jmespath==0.9.4 # via boto3, botocore
30
+
python-dateutil==2.8.1 # via botocore
31
+
s3transfer==0.2.1 # via boto3
32
+
six==1.14.0 # via python-dateutil
33
+
urllib3==1.25.8 # via botocore
11
34
```
12
35
13
-
In`WORKSPACE`
36
+
#### Setup`WORKSPACE`
14
37
15
38
```python
16
39
rules_python_external_version ="{COMMIT_SHA}"
@@ -47,6 +70,8 @@ py_binary(
47
70
)
48
71
```
49
72
73
+
Note that above you do not need to add transitively required packages to `deps = [ ... ]`
0 commit comments