Skip to content

Commit a8512e1

Browse files
authored
Add docs about private PyPI indexes (#1072)
1 parent 32190b0 commit a8512e1

File tree

2 files changed

+35
-19
lines changed

2 files changed

+35
-19
lines changed

docs/deployments/python-packages.md

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,28 @@ You can install your required PyPI packages and import them in your Python files
1414
└── requirements.txt
1515
```
1616

17-
If you want to use `conda` to install your python packages, see the [Conda section](#conda) below.
17+
If you want to use `conda` to install your python packages, see the [Conda section](#conda-packages) below.
1818

1919
Note that some packages are pre-installed by default (see "pre-installed packages" for your Predictor type in the [Predictor documentation](predictors.md)).
2020

21-
## Installing with Setup
21+
## Private PyPI packages
2222

23-
Python packages can also be installed by providing a `setup.py` that describes your project's modules. Here's an example directory structure:
23+
To install packages from a private PyPI index, create a `pip.conf` inside the same directory as `requirements.txt`, and add the following contents:
2424

2525
```text
26-
./iris-classifier/
27-
├── cortex.yaml
28-
├── predictor.py
29-
├── ...
30-
├── mypkg
31-
│ └── __init__.py
32-
├── requirements.txt
33-
└── setup.py
26+
[global]
27+
extra-index-url = https://<username>:<password>@<my-private-index>.com/pip
3428
```
3529

36-
In this case, `requirements.txt` will have this form:
37-
```text
38-
# requirements.txt
30+
In same directory, create a [`dependencies.sh` script](system-packages.md#bash-script) and add the following contents:
3931

40-
.
32+
```bash
33+
cp pip.conf /etc/pip.conf
4134
```
4235

43-
## Installing from GitHub
36+
You may now add packages to `requirements.txt` which are found in the private index.
37+
38+
## GitHub packages
4439

4540
You can also install public/private packages from git registries (such as GitHub) by adding them to `requirements.txt`. Here's an example for GitHub:
4641

@@ -56,7 +51,29 @@ git+https://<personal access token>@github.com/<username>/<repo name>.git@<tag o
5651

5752
On GitHub, you can generate a personal access token by following [these steps](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).
5853

59-
## Conda
54+
## Installing with Setup
55+
56+
Python packages can also be installed by providing a `setup.py` that describes your project's modules. Here's an example directory structure:
57+
58+
```text
59+
./iris-classifier/
60+
├── cortex.yaml
61+
├── predictor.py
62+
├── ...
63+
├── mypkg
64+
│ └── __init__.py
65+
├── requirements.txt
66+
└── setup.py
67+
```
68+
69+
In this case, `requirements.txt` will have this form:
70+
```text
71+
# requirements.txt
72+
73+
.
74+
```
75+
76+
## Conda packages
6077

6178
Cortex supports installing Conda packages. We recommend only using Conda when your required packages are not available in PyPI. Cortex looks for a `conda-packages.txt` file in the top level Cortex project directory (i.e. the directory which contains `cortex.yaml`):
6279

docs/deployments/system-packages.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ Cortex looks for a file named `dependencies.sh` in the top level Cortex project
1414
└── dependencies.sh
1515
```
1616

17-
`dependencies.sh` is executed during the initialization of each replica (before installing Python packages in `requirements.txt` or `conda-packages.txt`). Typical use cases include installing required system packages to be used in your Predictor, building Python packages from source, etc.
17+
`dependencies.sh` is executed with `bash` shell during the initialization of each replica (before installing Python packages in `requirements.txt` or `conda-packages.txt`). Typical use cases include installing required system packages to be used in your Predictor, building Python packages from source, etc.
1818

1919
Here is an example `dependencies.sh`, which installs the `tree` utility:
2020

2121
```bash
22-
#!/bin/bash
2322
apt-get update && apt-get install -y tree
2423
```
2524

0 commit comments

Comments
 (0)