-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding parameters to the CLI to select where a pypi dependency is added to a pyproject.toml
manifest
#2493
Comments
+1 In this line, I also observed the issue that #pyproject.toml
...
[project.optional-dependencies]
develop = ["pytest>=8.1", "pytest-cov>=5.0.0"]
... Running: pixie upgrade --feature develop pytest results in: #pyproject.toml
...
[project.optional-dependencies]
develop = [ "pytest-cov>=5.0.0"]
...
[dependency-groups]
develop = ["pytest>=8.3.4,<9"]
... (minor detail: also note the white-space in |
Maybe following "The --dev, --group, or --optional flags can be used to add a dependencies to an alternative table." Source: https://docs.astral.sh/uv/concepts/projects/dependencies/#adding-dependencies For |
Problem description
With #2448, pixi can now read pypi dependencies (and add them to the relevant features) in a
pyproject.toml
manifest from:[project.dependencies]
array[project.optional-dependencies]
table[dependency-groups]
table[tool.pixi.pypi-dependencies]
tableHowever using
pixi add --pypi
will always add a pypi dependency to:[project.dependencies]
array if no feature / the default feature is specified[dependency-groups]
table if a non-default feature is specified[tool.pixi.pypi-dependencies]
tableWe may consider adding an additional flag to
pixi add --pypi
to allow selecting the array / table where the dependency will be added.We could:
--location
argument:--location
topixi
would force adding the pypi dependency to the[tool.pixi.pypi-dependencies]
table.--location
tooptional-dependencies
would force adding the pypi dependency to the project.optional-dependencies table (this will only have an effect if a non-default feature is also specified).--optional-dependencies [OPTIONAL_GROUP]
and--dependency-group [DEPENDENCY_GROUP]
. using the--feature
flag would add the dependency to the[tool.pixi.pypi-dependencies]
table.A few thoughts on pros & cons:
pyproject.toml
manifest. This is not ideal in that regard, as (I believe?) this would be a (bad) first.--location optional-dependencies
would only do something if a non-default feature is also specified (an error or warning could be thrown). However, that option does keep--feature
as a key parameter, irrespective of the manifest, limiting the divergence in API betweenpyproject.toml
andpixi.toml
manifestspyproject.toml
andpixi.toml
manifests. Also, I feel it will become less clear to the user that using--optional-dependencies FEATURE
,--dependency-group FEATURE
or--feature FEATURE
will do exactly the same thing from a pixi standpoint.The text was updated successfully, but these errors were encountered: