Rye: myths vs facts for Python packaging teams
Rye manages Python installations, dependencies, and virtual environments, but development has stopped in favor of uv. While Rye offers a unique sources API for private repositories, its maintainers recommend migrating to uv for better performance and maintenance.
Rye manages Python installation, pyproject.toml projects, dependencies, virtual environments, and global tool installation. It was designed as a one-stop tool for Python users to handle everything from Python versions to complex monorepos. Development on Rye has stopped, and its maintainers recommend uv as the successor. uv is actively maintained and used more widely than Rye. Rye uses uv under the hood, so it benefits from uv’s updates. Rye’s universal mode uses the universal resolver from uv. Rye provides global Python shims that automatically use the virtual environment with the correct Python version. These shims prevent users from using system Python and avoid versioning headaches. Rye also includes a sources API to specify private repositories. This feature helps teams that need to pull from company-specific indexes. Rye works well on Windows, which helps developers who work across RHEL and Windows environments. Users of the openai-python library use Rye to manage dependencies. Rye’s ability to generate requirements.txt files also simplifies Docker builds. The installation process prompts if global shims should be enabled.
Comparing Rye, uv, and Poetry
Poetry struggles with dependency resolution speed, with some users reporting it takes an entire day to finish. One developer found that Poetry failed to resolve dependencies entirely. Hatch users often find that it pairs well with uv. If your team needs to add multiple additional indexes for different dependencies, uv lacks the sources API that Rye provides, as it only supports the pip-like –extra-index-url functionality for users. This limitation creates problems for machine learning teams that require different sources for various CUDA versions of PyTorch. Rye includes rye fmt and rye lint commands using Ruff, but uv does not ship with these commands. You must manually add Ruff or pytest as dev dependencies to uv. I would skip the built-in commands in Rye if you prefer the flexibility of uv. You already know that managing multiple Python versions is a headache. Rye is a legacy tool that teams should migrate to uv for better maintenance and performance. Rye also supports the Polylith plugin for monorepo setups. In uv, the concept of virtual workspaces has changed, as version 0.4 replaced it with projects that are not packages. To migrate, you can replace [tool.rye] with [tool.uv] in your pyproject.toml. uv can download Python and generate lockfiles via uv lock and uv sync.
| Feature | Rye | uv | Poetry |
|---|---|---|---|
| Python management | Yes | Yes | No |
| Integrated lint/fmt | Yes | No | No |
| Private index API | Yes | No | Yes |
| Dependency speed | Moderate | Fast | Slow |
The difficulties of Python packaging
Python packaging remains difficult. Users often struggle with system package managers that provide Python versions older than 3.6. Python.org binaries can trigger glibc errors during execution. Building from source requires new system dependencies and leads to errors for missing header files. The decision to not include byte-compiled code in Wheels was a result of premature optimization by the authors of the Wheel format, who wanted to save space for programmers publishing their packages across different platforms. This forces the interpreter to byte-compile files during loading rather than during installation. This behavior causes permission errors when users attempt to install packages with the –user option. When a user runs a command with sudo, the interpreter may break trying to put byte-compiled files in a directory not owned by the user. Pip 10.0 introduced support for the pyproject.toml file, yet many users still face difficulties. Pip allows specifying arbitrary URLs for dependencies, which makes auditing and stable builds difficult. When an index lacks a package for a specific architecture, pip builds the package from source locally. This often produces packages with API mismatches, such as NumPy arrays having the wrong bit depth. One researcher encountered a bug where NumPy arrays were assumed to have 16 bit integers but actually contained 32 bit integers, which led to significant errors in the analysis of ECG data. This error happened because the package was built from source rather than using a pre-built wheel. Python’s lack of a way to specify package versions during imports makes virtual environments necessary to prevent multiple versions of a package from causing conflicts in the system. Will uv eventually implement a direct replacement for the Rye sources API?