-
-
Notifications
You must be signed in to change notification settings - Fork 413
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
feature: Only lock selected groups into the lockfile #1704
Comments
Is it still possible to use the old behavior with a single lockfile after this change? Edit: It seems |
pdm lock -G:all |
I don't think your solution addresses my need to have a single lock file with the union of all possible groups/modes. pdm lock --production --group ':all' produces a different lock file than pdm lock --group ':all' And pdm lock --dev --production --group ':all' is rejected by PDM. |
@sanmai-NL I don't know what you mean. What I said is that P.S. |
Sorry, I meant The problem is that I can't lock all of development, production and groups. I don't know if the first two are groups as well, in your solution vocabulary. If they are, then the docs and behavior of Thanks for your attention and careful development of this great product. |
|
@frostming Can you explain a bit how to understand that
|
It's
Despite of many groups, there are two "species", or "kinds" of dependencies that can have groups: optional dependencies and development dependencies. So what are selected by |
I'll note that to add to the docs one day. |
Should definitely be in the docs and CLI help. The |
It's here: https://pdm.fming.dev/latest/reference/cli/#lock in the |
Is your feature request related to a problem? Please describe.
This could partially solve #564. The biggest barrier to solving this is that we have to resolve ALL dependencies as a whole, to form a viable lock file, even if you only install one group.
Describe the solution you'd like
In #1692 we start to write the groups of requirements that are locked in the lock file. For compatibility, it contains all groups in the
pyproject.toml
by default. We can extend this to only selected groups, details are as below.pdm lock
to recognize the dependency selection options(--group
,--production
,--no-default
), so that:metadata.groups
field in the lock file.pdm sync
andpdm install
, PDM will check the selected groups passed from the option against the ones encoded in the lock file, if the former contain groups that don't exist in the lock file, the installation will abort with an error.pdm update
orpdm remove
to change a dependency that doesn't exist in the groups in the lock file, an error occurs.pdm add <package>
with a target group, another option will be added to add the group to the lockfile, in this case<package>
parameter can be omitted, meaning to add the selected group only.Advantages
With this change, and that we already support specifying the target lock file via
PDM_LOCKFILE
or--lock/-L
, we have improved the multi-lockfile workflow. Imagine you have a default lock filepdm.lock
and many job-specific lockfiles inpdm-locks/
so that:pdm.lock
contains the default(production) group, for deploymentpdm-locks/pdm.lint.lock
contains locked versions for lint dependenciespdm-locks/pdm.doc.lock
contains locked versions for default+doc dependenciesAs a result, you can have different versions of the same packages pinned in
lint
anddoc
dependencies, as a solution to #564. Usingtox
+tox-pdm
, you can achieve this:The text was updated successfully, but these errors were encountered: