Experimental This feature is experimental and might change or be removed in the future. We've released it as an experimental feature to provide a preview of functionality we're working on.
Site admins can sync Python packages from any Python package mirror, including open source code from pypi.org or a private mirror such as Nexus, to their Sourcegraph instance so that users can search and navigate the repositories.
To add Python dependencies to Sourcegraph you need to setup a Python dependencies code host:
- As site admin: go to Site admin > Global settings and enable the experimental feature by adding:
{"experimentalFeatures": {"pythonPackages": "enabled"} }
- As site admin: go to Site admin > Manage code hosts
- Select Python Dependencies.
- Configure the connection by following the instructions above the text field. Additional fields can be added using Cmd/Ctrl+Space for auto-completion. See the configuration documentation below.
- Press Add repositories.
There are currently two ways to sync Python dependency repositories.
- Code host configuration: manually list dependencies in the
"dependencies"
section of the JSON configuration when creating the Python dependency code host. This method can be useful to verify that the credentials are picked up correctly without having to run a dependencies search.
Sourcegraph tries to find each dependency repository in all configured "urls"
until it's found. This means you can configure a public mirror first and fallback to a private one second (e.g. "urls": ["https://pypi.org", "https://admin:[email protected]"]
).
Each entry in the "urls"
array can contain basic auth if needed (e.g. https://user:[email protected]
).
By default, requests to the Python package mirrors will be rate-limited based on a default internal limit. (source)
"rateLimit": {
"enabled": true,
"requestsPerHour": 57600
}
where the requestsPerHour
field is set based on your requirements.
Not recommended: Rate-limiting can be turned off entirely as well. This increases the risk of overloading the proxy.
"rateLimit": {
"enabled": false
}
Python dependencies code host connections support the following configuration options, which are specified in the JSON editor in the site admin "Manage code hosts" area.