Skip to content

Add pixi [pyconde sprints] - #2525

Draft
cdeil wants to merge 2 commits into
conda-forge:mainfrom
cdeil:pixi-dev-support
Draft

Add pixi [pyconde sprints]#2525
cdeil wants to merge 2 commits into
conda-forge:mainfrom
cdeil:pixi-dev-support

Conversation

@cdeil

@cdeil cdeil commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

At the PyConDE sprints most of us trying to work on conda-smithy were running into conda issues in regular terminals or VSCode terminals.

This PR adds support for using pixi to work on conda-smithy keeping conda support unchanged.

The large diff in environment.yml is a one-time format change due to order and formatting of the pixi export.

The CI check to ensure consistency of dependencies in environment.yml and pyproject.toml between conda and pixi users is following the example HERE suggested by @jaimergp

Comment thread .gitignore
Comment thread pixi.lock Outdated
Comment thread .gitattributes Outdated
Comment thread environment.yml
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml Outdated
Comment thread pyproject.toml
isuruf
isuruf previously requested changes Apr 13, 2026

@isuruf isuruf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This requires keeping environment.yml and pyproject.toml to be in sync. Please add a test that checks that these two lists are identical so that we don't accidentally change one list and not the other.

@cdeil

cdeil commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

@jaimergp - could you please do a second review? I did a follow-up commit to try and address your feedback.

@cdeil

cdeil commented Apr 13, 2026

Copy link
Copy Markdown
Contributor Author

This requires keeping environment.yml and pyproject.toml to be in sync. Please add a test that checks that these two lists are identical so that we don't accidentally change one list and not the other.

@isuruf - is the existing check OK?

@isuruf
isuruf dismissed their stale review April 13, 2026 16:34

Outdated

Comment thread environment.yml
Comment on lines +39 to +40
- pip:
- -e .

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove this please

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is added by pixi workspace export conda-environment because of the pypi-dependencies table, and I see no way to disable that. We may need to edit it out by hand with sed or something.

@cdeil, if you are into Rust, adding a --no-pip flag to the subcommand in Pixi would be straightforward. This the Rust module: https://github.com/prefix-dev/pixi/blob/802105d11f030187916ee812e66572a388c76c3d/crates/pixi_cli/src/workspace/export/conda_environment.rs#L166-L170

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just out of curiosity, why do you want to remove this? Isnt it just as nice that you dont have to run pip install -e anymore?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't like tools doing sneaky things. It's a hack anyway that -e . works at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I implemented the --no-pypi prefix-dev/pixi#6380

pixi workspace export conda-environment --name conda-smithy | sed '/^$/d' > environment.yml
if ! git diff --exit-code environment.yml; then
echo "error: pyproject.toml [tool.pixi] and environment.yml are out of sync"
echo "Run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please post the diff here? There's no need for a developer to force pixi to figure out this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The diff is currently empty because the two files are consistent.
This CI check guarantees they will remain in sync moving forward.

In the future if a dev adjusts a dependency they have to do it in pyproject.toml and environment.yml consistently, or they just do it in pyproject.toml and run the pixi workspace export command which applies the correct consistent change to environment.yml.

As far as I know there is no better way to do it. But seems OK, no?

@isuruf Does this answer your question?
(Apologies if I misunderstood/don't get what you are looking for)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean report the failing diff in the CI test, so that a PR author can apply the diff without needing to have pixi.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AFAIK the line if ! git diff --exit-code environment.yml is not redirecting output anywhere, so it'll be printed by default 🤔 See this example with a single line change in README.md:

❯ git status
On branch linter-revamp
Your branch is up to date with 'origin/linter-revamp'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")
❯ if ! git diff --exit-code; then
∙   echo "There are changes"
∙ fi
diff --git i/README.md w/README.md
index f10ed6ba..08723d03 100644
--- i/README.md
+++ w/README.md
@@ -15,6 +15,8 @@ Overview
 [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
 [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
 
+A change
+
 Installation
 ------------
 
There are changes

pixi workspace export conda-environment --name conda-smithy | sed '/^$/d' > environment.yml
if ! git diff --exit-code environment.yml; then
echo "error: pyproject.toml [tool.pixi] and environment.yml are out of sync"
echo "Run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
echo "Run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"
echo "Please apply the above diff or run: pixi workspace export conda-environment --name conda-smithy | sed '/^\$/d' > environment.yml"

Comment thread news/pixi-dev-support.rst
Comment on lines +3 to +4
* Add Pixi dev support in `pyproject.toml`, keeping `conda` support as-is.
This is for devs working on `conda-smithy`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* Add Pixi dev support in `pyproject.toml`, keeping `conda` support as-is.
This is for devs working on `conda-smithy`.
* Add Pixi-driven development support in `pyproject.toml`, keeping `conda` support as-is. (#2525)

Comment thread environment.yml
Comment on lines +36 to +37
- rattler-build-conda-compat >=1.4.5,<2.0.0a0
- python >=3.9

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- rattler-build-conda-compat >=1.4.5,<2.0.0a0
- python >=3.9
- rattler-build-conda-compat >=1.4.12,<2.0.0a0
- python >=3.11

As per recently merged PRs.

Comment thread pyproject.toml
exceptiongroup = "*"
# py-rattler's API subject to change, pin to minor
py-rattler = ">=0.22,<0.23"
rattler-build-conda-compat = ">=1.4.5,<2.0.0a0"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
rattler-build-conda-compat = ">=1.4.5,<2.0.0a0"
rattler-build-conda-compat = ">=1.4.12,<2.0.0a0"

As per recently merged PRs.

@baszalmstra

Copy link
Copy Markdown
Member

@cdeil Are you planning on continuing with this?

@cdeil

cdeil commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@cdeil Are you planning on continuing with this?

No. Would be great if someone from the team could finish this up.

@baszalmstra

Copy link
Copy Markdown
Member

@jaimergp Do you think instead of using a dynamic version, it would be ok to use rever to update the version in the pyproject.toml instead?

@jaimergp

Copy link
Copy Markdown
Member

Do you think instead of using a dynamic version, it would be ok to use rever to update the version in the pyproject.toml instead?

Can you elaborate? 🤔 The dynamic version of what?

@baszalmstra

Copy link
Copy Markdown
Member

The pyproject defines the version of the package as dynamic:

dynamic = ["version"]

@jaimergp

Copy link
Copy Markdown
Member

Ah, that's for the scm integrations. We can change that sure if we want (or other parts of the release process), but why here? I'm not following the connection of Pixi <> scm versioning. Any documented gotchas I'm not aware? 🤔

@baszalmstra

Copy link
Copy Markdown
Member

Ah sorry I completely missed adding the context 😅

Im asking because I was trying to turn conda-smithy into (optionally) a pixi build package. That makes it easy to (amongst others) use it directly as a git dependency.

However, currently pixi doesnt support dynamic = ["version"].

@jaimergp

Copy link
Copy Markdown
Member

I see. I guess we can discuss it, but it'll have to be separate from this PR.

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.

5 participants