-
-
Notifications
You must be signed in to change notification settings - Fork 471
/
Copy pathsources.md
132 lines (93 loc) · 3.4 KB
/
sources.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Dependency Sources
+++ 0.2.0
Normally Rye loads packages from PyPI only. However it is possible to instruct it to
load packages from other indexes as well.
## Adding a Source
An index can be added to a project or workspace (via `pyproject.toml`) or into the
[global config](config.md#config-file). Rye will always consult both files where the
`pyproject.toml` file wins over the global config.
Each source needs to have a unique name. The default source is always called `default`
and out of the box points to PyPI.
=== "Global Source"
Add this to `~/.rye/config.toml`:
```toml
[[sources]]
name = "company-internal"
url = "https://company.internal/simple/"
```
=== "Project Source"
Add this to `pyproject.toml`:
```toml
[[tool.rye.sources]]
name = "company-internal"
url = "https://company.internal/simple/"
```
+/- 0.4.0
Sources in the global config are also considered for tool installations.
### Index Types
Rye supports different types of sources and also allows overriding the `default`
PyPI index. If you give another source the name `default`, PyPI will no longer be
used for resolution.
=== "Regular Index"
```toml
[[sources]]
name = "company-internal"
url = "https://company.internal/simple/"
type = "index" # this is implied
```
=== "Find Links"
```toml
[[sources]]
name = "company-internal"
url = "https://company.internal/"
type = "find-links"
```
=== "Default Index"
```toml
[[sources]]
name = "default"
url = "https://company.internal/simple/"
```
!!! Warning
Please take note that the default index cannot be of type `find-links`.
## Source Types
The two sources types (`index` vs `find-links`) are determined by the underlying pip
infrastructure:
### `index`
This is a [PEP 503](https://www.python.org/dev/peps/pep-0503/) type index as provided
by tools such as PyPI or [devpi](https://github.com/devpi/devpi). It corresponds to
the arguments `--index-url` or `--extra-index-url` in pip.
Note: see the [`uv` documentation](https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#packages-that-exist-on-multiple-indexes)
for more on the use of multiple indexes.
### `find-links`
This is a source that can be of a variety of types and has to point to a file path
or hosted HTML page linking to packages. It corresponds to the `--find-links`
argument. The format of the HTML page is somewhat underspecified but generally
all HTML links pointing to `.tar.gz` or `.whl` files are considered.
## Index Authentication
HTTP basic auth is supported for index authentication. It can be supplied in two
ways. `username` and `password` can be directly embedded in the config, or they
can be supplied with environment variables.
=== "Configured Credentials"
```toml
[[sources]]
name = "company-internal"
url = "https://company.internal/simple/"
username = "username"
password = "super secret"
```
=== "Environment Variables"
```toml
[[sources]]
name = "company-internal"
url = "https://${INDEX_USERNAME}:${INDEX_PASSWORD}@company.internal/simple/"
```
## SSL/TLS Verification
By default a source needs to be SSL/TLS protected. If not, rye will refuse to honor
the source. You can override this by setting `verify-ssl` to `false`:
```toml
[[sources]]
name = "company-internal"
url = "http://company.internal/simple/"
verify-ssl = false
```