Skip to content

Need requirements.txt with fixed package versions #2389

Answered by frostming
pohlt asked this question in Q&A
Discussion options

You must be logged in to vote

No, the final set of packages to be installed may vary depending on which Python version are being used, think of a foo; python_version >= '3.8' dependency, but unfortunately, pdm export lacks the ability to record and possibly merge all those markers to form a static requirements.txt. What it does is to read the current python used when running export and tailor the dependency list to get a requirements.txt. This is because pdm.lock may contain too many packages not needed by the target environment. For example, a lockfile may look like the following(translated to requirements.txt format):

foo==1; python_version<'3.11'
bar==1; python_version<'3.10'
     # bar depends on
     foo; python_…

Replies: 3 comments 8 replies

Comment options

pawamoy
Nov 9, 2023
Maintainer Sponsor

You must be logged in to vote
3 replies
@pohlt
Comment options

@pawamoy
Comment options

pawamoy Nov 9, 2023
Maintainer Sponsor

@pohlt
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@frostming
Comment options

@pohlt
Comment options

@frostming
Comment options

Answer selected by pohlt
@frostming
Comment options

@pohlt
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants