Skip to content
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

auto-resolve and add at install groups that are not in the lock file #2253

Closed
deronnax opened this issue Sep 12, 2023 · 1 comment
Closed
Labels
⭐ enhancement Improvements for existing features

Comments

@deronnax
Copy link
Sponsor Contributor

Is your feature request related to a problem? Please describe.

When you checkout fresh project managed by pdm, if you run an install commands without specifying a group, it automatically does the resolution locking, including the dev group. So if you do a pdm install and then a pdm install -d later, it works fine.
But then if you want to install with an optional group later (let's say all), you get this error:

$ pdm install -G all
[PdmUsageError]: Requested groups not in lockfile: all

It surprised my coworker and they thought something was broken/wrong with their install or the project.

way to reproduce:

cat <<EOF > pyproject.toml
[project]
dependencies = ["requests"]
requires-python = ">=3.11"

[project.optional-dependencies]
all = ["requests-toolbelt"]

[tool.pdm.dev-dependencies]
dev = ["pytest"]
EOF
pdm install 
pdm install -d
pdm install -G all

Describe the solution you'd like

I would expect PDM to re-do the locking with the optional group when asked to install the optional group, rather than erroring.

@deronnax deronnax added the ⭐ enhancement Improvements for existing features label Sep 12, 2023
@deronnax deronnax changed the title auto-resolve groups not in lock file auto-resolve and add at install groups that are not in the lock file Sep 13, 2023
@frostming
Copy link
Collaborator

You should run pdm add -G all to add and install the dependencies. add is more proper than install since it clearly means to add to the existing groups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

2 participants