0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】uvのプロキシ設定

0
Last updated at Posted at 2026-01-19

pip installで--proxyが必要な環境でuvを使うときに、環境変数ではなくuv自体にプロキシ設定をもたせておきたい。

注意 (バージョン要件)
uvのプロキシ設定を uv.toml に書く機能は、0.9.23 でリリースされた機能です。

公式

設定方法

uv.tomlの作成、配置

基本、ユーザーレベルの設定に書いておけばよい。

  • Windows
    • %APPDATA%\uv\uv.toml
  • macOS/Linux
    • $XDG_CONFIG_HOME/uv/uv.toml

ディレクトリやファイルがなければ作成する。

uv.toml
http-proxy = "http://[proxy-user]:[proxy-password]@proxy.example.com"
https-proxy = "http://[proxy-user]:[proxy-password]@proxy.example.com"

これでuv addとかuv syncとかしたときに、uv.tomlに書いたプロキシ設定を使ってくれる。

プロキシ除外設定

プロキシを経由させたくないホストがある場合は no-proxy に書く。

uv.toml
no-proxy = ["localhost", "127.0.0.1", ".example.internal"]

おしまい


今まではHTTP(S)_PROXYの環境変数設定してuv addとかしていた。

でもシェル起動する毎に設定するのは面倒だし、他のアプリケーションやプログラムに影響するのでユーザー環境変数とかにも設定したくなかった。

uv自体の設定でできないはずはない、と思ってちゃんと調べたら、ちゃんとできた。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?