Skip to content

fix: python noarch with Conda backend#8349

Merged
jdx merged 1 commit intojdx:mainfrom
wolfv:fix-python-noarch
Feb 25, 2026
Merged

fix: python noarch with Conda backend#8349
jdx merged 1 commit intojdx:mainfrom
wolfv:fix-python-noarch

Conversation

@wolfv
Copy link
Contributor

@wolfv wolfv commented Feb 25, 2026

A little tweak to get Python noarch pacakges to install properly - we need the python version from the transaction to know the proper site-packages directory ... some internal stuff basically.

Should make

mise use -g conda:ruff

work properly. Example currently fails with

mise ERROR Failed to install conda:ruff@latest: failed to link /Users/wolfv/.local/share/mise/conda-packages/ruff-0.15.2-h279115b_0.conda: cannot install noarch python package because there is no python version specified

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @wolfv, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Conda backend to correctly handle the installation of Python noarch packages. Previously, attempts to install such packages would fail due to missing Python environment information. The changes introduce mechanisms to identify the Python version and site-packages directory from the transaction's solved records or package basenames, ensuring that noarch Python packages can be linked properly within the Conda environment.

Highlights

  • Python Noarch Support: Implemented support for installing Python noarch packages using the Conda backend, resolving previous installation failures.
  • PythonInfo Integration: Integrated the PythonInfo struct from the rattler library into the package installation process to provide necessary Python environment details.
  • Python Info Extraction: Added utility functions (python_info_from_records and python_info_from_basenames) to extract Python version and site-packages path from solved records and package basenames, respectively.
Changelog
  • src/backend/conda.rs
    • Imported PythonInfo struct for handling Python environment details.
    • Modified the install_package function signature to accept an optional PythonInfo parameter.
    • Introduced python_info_from_records to parse Python version and site-packages path from RepoDataRecords.
    • Added python_info_from_basenames to extract Python version from package basenames for locked installs.
    • Updated calls to link_package to pass the newly extracted PythonInfo when available.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@greptile-apps
Copy link

greptile-apps bot commented Feb 25, 2026

Greptile Summary

Fixes installation of noarch Python packages (like ruff) by extracting Python version information from the conda transaction. The fix adds two helper functions: python_info_from_records() for fresh installs and python_info_from_basenames() for locked installs. This information is passed to rattler's link_package() to determine the correct site-packages directory path.

  • Added PythonInfo import from rattler::install
  • Added python_info parameter to install_package() method
  • Implemented Python version extraction for both fresh and locked install code paths
  • Uses ArchiveIdentifier parser to extract version from conda package basenames in locked installs

Confidence Score: 5/5

  • Safe to merge - well-structured fix with proper error handling
  • The changes are focused and address a specific bug with noarch Python packages. The implementation follows Rust best practices with proper error handling using Option types and ok() conversions. The logic is symmetrical across both install paths (fresh and locked), and the helper functions are well-documented with clear docstrings.
  • No files require special attention

Important Files Changed

Filename Overview
src/backend/conda.rs Adds PythonInfo extraction logic to correctly install noarch Python packages by determining Python version from transaction records or lockfile basenames

Last reviewed commit: 4992fa4

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses an issue with installing noarch Python packages with the Conda backend by providing PythonInfo to rattler. The implementation introduces helper functions to extract this information from both solved records and package basenames, covering fresh and locked installs. The changes are well-structured and logical. I have one minor suggestion to make the code slightly more idiomatic.

Comment on lines +301 to +306
let id = ArchiveIdentifier::from_str(b).ok()?;
if id.name != "python" {
return None;
}
let version = Version::from_str(&id.version).ok()?;
PythonInfo::from_version(&version, None, platform).ok()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The body of this closure can be made slightly more concise and idiomatic by chaining the last two fallible operations with and_then.

            let id = ArchiveIdentifier::from_str(b).ok()?;
            if id.name != "python" {
                return None;
            }

            Version::from_str(&id.version)
                .ok()
                .and_then(|version| PythonInfo::from_version(&version, None, platform).ok())

@jdx jdx merged commit bfb5786 into jdx:main Feb 25, 2026
35 checks passed
@wolfv wolfv deleted the fix-python-noarch branch February 26, 2026 06:20
mise-en-dev added a commit that referenced this pull request Feb 26, 2026
### 🐛 Bug Fixes

- **(exec)** respect PATH order for virtualenv resolution in mise x by
@jdx in [#8342](#8342)
- **(task)** revert process group changes that cause hangs with nested
mise tasks by @jdx in [#8347](#8347)
- **(task)** resolve vars from subdirectory configs for monorepo tasks
by @jdx in [#8343](#8343)
- **(task)** resolve dependencies before prepare to fix monorepo glob
deps by @jdx in [#8353](#8353)
- python noarch with Conda backend by @wolfv in
[#8349](#8349)

### New Contributors

- @wolfv made their first contribution in
[#8349](#8349)

## 📦 Aqua Registry Updates

#### New Packages (3)

- [`alexhallam/tv`](https://github.com/alexhallam/tv)
- [`arcanist-sh/hx`](https://github.com/arcanist-sh/hx)
- [`dathere/qsv`](https://github.com/dathere/qsv)

#### Updated Packages (3)

- [`astral-sh/ruff`](https://github.com/astral-sh/ruff)
- [`caarlos0/fork-cleaner`](https://github.com/caarlos0/fork-cleaner)
- [`rhysd/actionlint`](https://github.com/rhysd/actionlint)
risu729 pushed a commit to risu729/mise that referenced this pull request Feb 27, 2026
A little tweak to get Python noarch pacakges to install properly - we
need the `python` version from the transaction to know the proper
site-packages directory ... some internal stuff basically.

Should make 

```
mise use -g conda:ruff
```

work properly. Example currently fails with 

```
mise ERROR Failed to install conda:ruff@latest: failed to link /Users/wolfv/.local/share/mise/conda-packages/ruff-0.15.2-h279115b_0.conda: cannot install noarch python package because there is no python version specified
```
risu729 pushed a commit to risu729/mise that referenced this pull request Feb 27, 2026
### 🐛 Bug Fixes

- **(exec)** respect PATH order for virtualenv resolution in mise x by
@jdx in [jdx#8342](jdx#8342)
- **(task)** revert process group changes that cause hangs with nested
mise tasks by @jdx in [jdx#8347](jdx#8347)
- **(task)** resolve vars from subdirectory configs for monorepo tasks
by @jdx in [jdx#8343](jdx#8343)
- **(task)** resolve dependencies before prepare to fix monorepo glob
deps by @jdx in [jdx#8353](jdx#8353)
- python noarch with Conda backend by @wolfv in
[jdx#8349](jdx#8349)

### New Contributors

- @wolfv made their first contribution in
[jdx#8349](jdx#8349)

## 📦 Aqua Registry Updates

#### New Packages (3)

- [`alexhallam/tv`](https://github.com/alexhallam/tv)
- [`arcanist-sh/hx`](https://github.com/arcanist-sh/hx)
- [`dathere/qsv`](https://github.com/dathere/qsv)

#### Updated Packages (3)

- [`astral-sh/ruff`](https://github.com/astral-sh/ruff)
- [`caarlos0/fork-cleaner`](https://github.com/caarlos0/fork-cleaner)
- [`rhysd/actionlint`](https://github.com/rhysd/actionlint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants