設定
Ryeの設定のほとんどは、pyproject.toml
ファイルに含まれています。ただし、Ryeの動作に影響を与えるグローバル設定も少しあります。
ホームフォルダの変更
デフォルトでは、Ryeはすべての設定をUnixでは~/.rye
、Windowsでは%USERPROFILE%\.rye
に配置します。この動作は、RYE_HOME
環境変数を使用して変更できます。これは、Ryeが設定を配置するデフォルトの場所が気に入らない場合、または設定を分離する必要がある場合に便利です。
ホームフォルダの構造
.rye
ホームフォルダには、ユーザー設定と、インストールされたツールチェーンなどのRyeによって管理される状態の両方が含まれています。次のファイルとフォルダは、.rye
フォルダ内に配置されます。すべてが常に存在するわけではないことに注意してください。
config.toml
これは、Ryeの動作に影響を与える設定ファイルです。現在、そこで利用できる設定はごくわずかです。利用可能な設定キーについては、設定ファイルを参照してください。
self
RyeはRustで記述されていますが、内部で多くのPythonツールを使用しています。これらは、この場所に保存されている内部仮想環境で管理されています。
py
このフォルダには、Ryeは異なるツールチェーンを保存します。通常、これらはダウンロードされたPythonディストリビューションを含むフォルダですが、シンボリックリンクまたは特別な参照ファイルにすることもできます。
shims
このフォルダには、シムバイナリが含まれています。これらのバイナリは、たとえば、現在の仮想環境またはグローバルにインストールされたツールに自動的にプロキシするpython
実行可能ファイルです。
設定ファイル
.rye
フォルダにある設定ファイルconfig.toml
は、現在、デフォルトを管理するためにのみ使用されています。これは完全に注釈が付けられた設定ファイルです
[default]
# This is the default value that is written into new pyproject.toml
# files for the `project.requires-python` key
requires-python = ">= 3.8"
# This is the default toolchain that is used
toolchain = "[email protected]"
# This is the default build system that is used
build-system = "hatchling"
# This is the default license that is used
license = "MIT"
# This sets the default author (overrides the defaults from git). The
# format here is "Name <email>".
author = "Full Name <[email protected]>"
# The dependency operator to use by default for dependencies. The options are
# '>=', '~=', and '=='. The default currently is '>='. This affects the behavior
# of `rye add`.
dependency-operator = ">="
[proxy]
# the proxy to use for HTTP (overridden by the http_proxy environment variable)
http = "http://127.0.0.1:4000"
# the proxy to use for HTTPS (overridden by the https_proxy environment variable)
https = "http://127.0.0.1:4000"
[behavior]
# When set to `true` the `managed` flag is always assumed to be `true`.
force-rye-managed = false
# Enables global shims when set to `true`. This means that the installed
# `python` shim will resolve to a Rye-managed toolchain even outside of
# virtual environments.
global-python = false
# Enable or disable automatic `sync` after `add` and `remove`. This defaults
# to `true` when uv is enabled and `false` otherwise.
autosync = true
# Marks the managed .venv in a way that cloud-based synchronization systems
# like Dropbox and iCloud Files will not upload it. This defaults to `true`
# as a .venv in cloud storage typically does not make sense. Set this to
# `false` to disable this behavior.
venv-mark-sync-ignore = true
# When set to `true` Rye will fetch certain interpreters with build information.
# This will increase the space requirements, will put the interpreter into an
# extra folder called `./install/` and place build artifacts adjacent in `./build`.
fetch-with-build-info = false
# An array of tables with optional sources. Same format as in pyproject.toml
[[sources]]
name = "default"
url = "https://pypi.org/simple/"
設定の操作
0.9.0の新機能
設定は、rye config
で読み取りおよび変更できます。キーはドット表記です。 --get
はキーを読み取り、--set
、--set-int
、--set-bool
、および--unset
はキーを変更します。
rye config --set proxy.http=http://127.0.0.1:4000
rye config --set-bool behavior.force-rye-managed=true
rye config --get default.requires-python
詳細については、config
を参照してください。
プロジェクトごとの設定
プロジェクト固有のpyproject.toml
設定については、pyproject.tomlを参照してください。