Skip to content

Commit

Permalink
feat: add autogen header to the generated requirements.txt
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Mar 22, 2023
1 parent dd4101d commit 495e17c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pdm/formats/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def export(
candidates: list[Candidate] | list[Requirement],
options: Namespace,
) -> str:
lines = []
lines = ["# This file is @generated by PDM.\n# Please do not edit it manually.\n\n"]
for candidate in sorted(candidates, key=lambda x: x.identify()):
if isinstance(candidate, Candidate):
req = dataclasses.replace(candidate.req, specifier=f"=={candidate.version}", marker=None)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is @generated by PDM.
# Please do not edit it manually.

certifi==2021.10.8
charset-normalizer==2.0.7
idna==3.3
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/projects/demo-package/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is @generated by PDM.
# Please do not edit it manually.

click==7.1.2 \
--hash=sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a \
--hash=sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc
Expand Down

0 comments on commit 495e17c

Please sign in to comment.