pdm
pdm copied to clipboard
pdm export with the --group option
Problem
I want to create a requirement file using the pdm export
command for a specific --group
. Though, I cannot seem to make it work except if I do some workaround.
Here is a pyproject.toml
that can be used:
[project]
name = "test_pdm"
version = "0.1.0"
description = "Default template for PDM package"
authors = [
{name = "renaudjester", email = "hello"},
]
dependencies = [
"sentry-sdk>=1.44.1",
]
requires-python = "==3.9.*"
readme = "README.md"
license = {text = "MIT"}
[project.optional-dependencies]
group1 = [
"pandas>=2.2.1",
]
group2 = [
"aiohttp>=3.9.3",
]
[tool.pdm]
distribution = false
[tool.pdm.dev-dependencies]
dev = [
"black>=24.3.0",
]
To be able to get only the "group1" I am doing:
pdm export --group group1 --no-default --prod -o requirements.txt
What I expect
Something more concise like:
pdm export --group group1 -o requirements.txt
as for me the --no-default --prod
is not very natural and well documented. It seems quite confusing to use those two options at the same time.
I think that poetry has --only
and --with
options, that could be a great addition.
Maybe I am missing something and if it's the case I'd be happy to get a proper way to do this!