Skip to content

Commit fe4330c

Browse files
author
Jonathon Belotti
authored
Merge pull request #13 from dillon-giacoppo/jonathon/README-improvement-21jan2020
Make requirement.txt instructions more detailed
2 parents 41777ee + 125f1cb commit fe4330c

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,36 @@ Contains Bazel rules to fetch and install Python dependencies from a requirement
44

55
## Usage
66

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+
824
```
9-
cryptography==2.8
1025
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
1134
```
1235

13-
In `WORKSPACE`
36+
#### Setup `WORKSPACE`
1437

1538
```python
1639
rules_python_external_version = "{COMMIT_SHA}"
@@ -47,6 +70,8 @@ py_binary(
4770
)
4871
```
4972

73+
Note that above you do not need to add transitively required packages to `deps = [ ... ]`
74+
5075
## Development
5176

5277
### Testing

0 commit comments

Comments
 (0)