Maintenance points for Rye environment construction in dotfiles management#
Taking the opportunity of migrating from Poetry to Rye, we reorganized the procedure for building a Python development environment using bare-repo style dotfiles management.
This article summarizes the maintenance points on the dotfiles side when introducing Rye.
Background and purpose#
Up until now, I’ve been using poetry to manage packages for my Python projects, but I’ve moved to rye, which is lighter and faster.
dotfiles also automates and clarifies Rye installation procedures and settings in order to be able to automatically reproduce setups in multiple development environments.
Outline of response policy#
In principle, files under
.rye/are not managed with dotfiles (reproducible products)Describe Rye installation process in
install.shPATH settings and completion settings are specified in shell configuration files such as
.zshrcManage only
.rye/settings.tomlif necessary
Specific implementation details#
Example addition to install.sh#
# ~/.config/bootstrap/install.sh の一部
export RYE_HOME="$HOME/.rye"
if [ -x "$RYE_HOME/shims/rye" ]; then
echo "[INFO] Rye is already installed."
else
echo "[INFO] Installing Rye..."
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
fi
echo "[INFO] Installing global tools..."
rye install ruff doc8 pre-commit doit
Settings in .zshrc (managed by dotfiles)#
Shell settings are not automatically added from install.sh, but are explicitly written in .zshrc managed by dotfiles.
# Rye の shim を PATH に追加
export PATH="$HOME/.rye/shims:$PATH"
# Rye の補完を有効化
eval "$(rye self completion)"
This makes configuration explicit and reproducible without relying on dynamic manipulation in scripts.
Exclusion specification with .gitignore#
.rye/
!.rye/settings.toml # 必要に応じてのみ管理
Organizing maintenance targets and exclusion targets#
item |
Management target |
remarks |
|---|---|---|
install.sh |
○ |
Rye installation automation process |
.zshrc |
○ |
Explicitly describe PATH and completion settings |
.rye/shims/ |
× |
automatically generated |
.rye/venvs/ |
× |
virtual environment. Exclusion required |
.rye/tools/ |
× |
Reinstallable products |
.rye/settings.toml |
△ (optional) |
Setting uses such as default-python |
summary#
Rye is very simple to deploy and works well with dotfiles.
In particular, install.sh focuses on installation and tool installation, and by explicitly managing configuration files (.zshrc, etc.), you can build a highly reproducible and readable development environment.
For those considering Rye as a lighter-weight option than Poetry, we recommend implementing it in combination with dotfiles.
Article information
- author:
Mr. Takagi
- Release date:
2025-06-01