This guide covers how to configure each package manager to use the registry proxy. All examples assume the registry is running at https://packages.example.com. Replace this with your actual registry URL.
pip install --index-url https://packages.example.com/simple/ requests
If the registry uses HTTP (not HTTPS), add --trusted-host:
pip install --index-url http://packages.example.com/simple/ --trusted-host packages.example.com requests
Create or edit ~/.pip/pip.conf (Linux/macOS) or %APPDATA%\pip\pip.ini (Windows):
[global]
index-url = https://packages.example.com/simple/
trusted-host = packages.example.com
export PIP_INDEX_URL=https://packages.example.com/simple/
export PIP_TRUSTED_HOST=packages.example.com
pip install requests
Add at the top of your requirements.txt:
--index-url https://packages.example.com/simple/
requests==2.31.0
django==4.2
pip install --index-url https://user:password@packages.example.com/simple/ requests
Or in pip.conf:
[global]
index-url = https://user:password@packages.example.com/simple/
uv pip install --index-url https://packages.example.com/simple/ requests
Or when using uv add in a project:
uv add --index-url https://packages.example.com/simple/ requests
export UV_INDEX_URL=https://packages.example.com/simple/
uv pip install requests
uv add django
[tool.uv]
index-url = "https://packages.example.com/simple/"
Or using the newer index configuration:
[[tool.uv.index]]
name = "private"
url = "https://packages.example.com/simple/"
default = true
export UV_INDEX_URL=https://user:password@packages.example.com/simple/
uv pip install requests
Or via per-index credentials:
export UV_INDEX_PRIVATE_USERNAME=user
export UV_INDEX_PRIVATE_PASSWORD=password
npm install --registry https://packages.example.com lodash
export NPM_CONFIG_REGISTRY=https://packages.example.com
npm install lodash
Create or edit ~/.npmrc for user-wide configuration:
registry=https://packages.example.com/
Or create .npmrc in the project root for per-project configuration:
registry=https://packages.example.com/
Route only packages under a specific scope to the registry:
# .npmrc
@myorg:registry=https://packages.example.com/
This routes @myorg/* packages through the proxy while everything else uses the default npm registry.
# .npmrc
registry=https://packages.example.com/
//packages.example.com/:_authToken=your-token-here
Or use login:
npm login --registry https://packages.example.com
npm publish --registry https://packages.example.com
Or in package.json:
{
"publishConfig": {
"registry": "https://packages.example.com/"
}
}
yarn add lodash --registry https://packages.example.com
Permanent configuration via ~/.npmrc (yarn classic reads .npmrc):
registry=https://packages.example.com/
One-off (set per-project):
yarn config set npmRegistryServer https://packages.example.com
yarn add lodash
This writes to .yarnrc.yml:
npmRegistryServer: "https://packages.example.com"
For HTTP registries (non-TLS), also configure:
yarn config set unsafeHttpWhitelist '["packages.example.com"]' --json
yarn config set enableStrictSsl false
# .yarnrc.yml
npmScopes:
myorg:
npmRegistryServer: "https://packages.example.com"
# .yarnrc.yml
npmRegistries:
"https://packages.example.com":
npmAuthToken: "your-token-here"
pnpm add lodash --registry https://packages.example.com
export NPM_CONFIG_REGISTRY=https://packages.example.com
pnpm add lodash
pnpm reads .npmrc in the same format as npm:
# ~/.npmrc or project .npmrc
registry=https://packages.example.com/
# .npmrc
@myorg:registry=https://packages.example.com/
# .npmrc
registry=https://packages.example.com/
//packages.example.com/:_authToken=your-token-here
- name: Install Python dependencies
env:
PIP_INDEX_URL: https://packages.example.com/simple/
run: pip install -r requirements.txt
- name: Install Node dependencies
env:
NPM_CONFIG_REGISTRY: https://packages.example.com
run: npm ci
variables:
PIP_INDEX_URL: https://packages.example.com/simple/
NPM_CONFIG_REGISTRY: https://packages.example.com
install:
script:
- pip install -r requirements.txt
- npm ci
# Python
FROM python:3.12
ARG PIP_INDEX_URL=https://packages.example.com/simple/
RUN pip install requests django
# Node
FROM node:20
RUN npm config set registry https://packages.example.com
COPY package*.json ./
RUN npm ci
To confirm packages are being served through the registry proxy:
curl https://packages.example.com/simple/
curl https://packages.example.com/lodash | python3 -m json.tool | head -20
# PyPI packages
curl https://packages.example.com/api/v1/packages
# npm packages
curl https://packages.example.com/api/v1/npm/packages
curl https://packages.example.com/healthz