pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Editable dep on poetry pyproject.toml with editable dep succeeds once, then crashes after

Open gene-maniro opened this issue 8 months ago • 4 comments

Checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

Both __init__.py files are empty.

~/delme$ tree
.
├── foo
│   ├── pyproject.toml
│   └── src
│       └── foo
│           └── __init__.py
├── my-dep
│   ├── pyproject.toml
│   └── src
│       └── my_dep
│           └── __init__.py
├── pixi.lock
└── pixi.toml

7 directories, 6 files

pixi.toml

[project]
channels = ["conda-forge"]
description = "Add a short description here"
name = "delme"
platforms = ["linux-64"]
version = "0.1.0"

[pypi-dependencies]
my-dep = { path = "./my-dep", editable = true }

[dependencies]
python = ">=3.13.3,<3.14"

my-dep pyproject.toml

[tool.poetry]
name = "my-dep"
version = "0.1.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dependencies]
foo = { path = "../foo", develop = true }

foo pyproject.toml

[tool.poetry]
name = "foo"
version = "0.1.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Issue description

See https://discord.com/channels/1082332781146800168/1365025446374281298/1365025446374281298 @Hofer-Julian

After the first, successful run of any pixi command, all subsequent pixi commands fail with:

pixi run python

thread 'main2' panicked at crates/pixi_uv_conversions/src/requirements.rs:246:30:
cannot get extension: MissingExtensionPath("/home/gene/delme/foo", Dist)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

thread 'main' panicked at src/main.rs:49:10:
Tokio executor failed, was there a panic?: Any { .. }

Expected behavior

Subsequent pixi commands succeed, just like the first.

gene-maniro avatar Apr 25 '25 11:04 gene-maniro

I was able to reproduce this on my machine. First command works, all subsequent fail.

Here is the git repo: https://github.com/Hofer-Julian/editable-poetry

Hofer-Julian avatar Apr 25 '25 11:04 Hofer-Julian

Manually changing this section in pixi.lock from:

- pypi: ./my-dep
  name: my-dep
  version: 0.1.0
  sha256: de9ac4b45d87b172a6eea5047b386de22ed079ce456178a38250ceaf5fb81a26
  requires_dist:
  - foo @ file:///home/gene/delme/foo
  editable: true

to (removing the file version spec)

- pypi: ./my-dep
  name: my-dep
  version: 0.1.0
  sha256: de9ac4b45d87b172a6eea5047b386de22ed079ce456178a38250ceaf5fb81a26
  requires_dist:
  - foo
  editable: true

lets pixi commands work again

gene-maniro avatar Apr 25 '25 11:04 gene-maniro

Hi! So @Hofer-Julian is doing a fix to at least get rid of the panic for now. This is not going to be the final fix though, we could look at supporting this use-case a bit later, seems like poetry is making it into an absolute pep508 requirement path which we are not supporting very well.

Alternatively, from next release onward you should be able to use: https://pixi.sh/dev/python/pyproject_toml/#development-dependencies-with-tooluvsources instead which would probably be what you are looking for :)

tdejager avatar Apr 25 '25 12:04 tdejager

Thanks @Hofer-Julian and @tdejager - that's great!

gene-maniro avatar Apr 25 '25 16:04 gene-maniro

Hi! So @Hofer-Julian is doing a fix to at least get rid of the panic for now. This is not going to be the final fix though, we could look at supporting this use-case a bit later, seems like poetry is making it into an absolute pep508 requirement path which we are not supporting very well.

Alternatively, from next release onward you should be able to use: https://pixi.sh/dev/python/pyproject_toml/#development-dependencies-with-tooluvsources instead which would probably be what you are looking for :)

tool.uv.sources works like a charm! One last annoyance here - we commit our pixi.lock files, and now each different machine / repo we run this in results in changes to the pixi.lock file (because the absolute path to the other package in the monorepo is recorded in the pixi.lock file). Happy to open a new issue for this if that helps.

gene-maniro avatar May 21 '25 13:05 gene-maniro

@gene-maniro yes, please open a separate issue for that!

Hofer-Julian avatar May 21 '25 14:05 Hofer-Julian

I think I tried to record relative paths were possible so sounds like an issue for sure 🙂 Would great to have a repro!

tdejager avatar May 22 '25 10:05 tdejager

I think I tried to record relative paths were possible so sounds like an issue for sure 🙂 Would great to have a repro!

Cool, thanks for following up :) I put the repro in the new issue, #3810 , but basically just clone that repro example above to two different locations, pixi install both, then diff the lockfiles. At least on my system I see (differing) absolute paths in both

gene-maniro avatar May 22 '25 13:05 gene-maniro