pixi
pixi copied to clipboard
Improve `pixi add --pypi` CLI API features for local source packages
Problem description
At the moment
$ pixi --version
pixi 0.59.0
if one wants to add a local source Python project to a Pixi manifest using the pixi add CLI API one has to do the equivalent of
pixi add --pypi "package-name @ file:///absolute/path/to/package"
which will then produce the following in the Pixi manifest
[pypi-dependencies]
package-name = { path = "/absolute/path/to/package" }
This is not portable across machines, and so the user needs to manually edit the Pixi manifest to use a relative path from the manifest location
[pypi-dependencies]
package-name = { path = "." }
It would be extremely useful if this was available from the pixi add --pypi CLI API through the equivalent of something like
pixi add --pypi "package-name @ ."
Additionally, at the moment there seems to be no way to support installing local Python packages with dependency groups. There is the ability to get dependency groups in a Pixi manifest that you control (https://pixi.sh/latest/python/pyproject_toml/#dependency-groups), but not to interact with a project that you do not control that uses them.
In a similar way that if you provide an extra to a pixi add --pypi command
pixi add --pypi "package-name[dev] @ file:///absolute/path/to/package"
Pixi adds an extras field to the manifest
[pypi-dependencies]
package-name = { path = "/absolute/path/to/package", extras = ["dev"] }
it would be useful to be able to expose a manifest option for the pypi-dependencies that also corresponds to a CLI API option that would enable something along the lines of
pixi add --pypi "package-name[dev] @ file:///absolute/path/to/package" --group test
and
[pypi-dependencies]
package-name = { path = "/absolute/path/to/package", extras = ["dev"], dependency-groups = ["test"] }