Skip to content

Keep comments in pyproject.toml when updating dependencies - #122

Merged
ericof merged 1 commit into
mainfrom
issue-91
Dec 3, 2026
Merged

ericof merged 1 commit into
mainfrom
issue-91

Conversation

@ericof

@ericof ericof commented Dec 3, 2026

Copy link
Copy Markdown
Member

repoplone deps constraints, and deps upgrade for a python component, rewrote pyproject.toml and dropped the comments people had written in it. tomlkit keeps comments only while a document is edited in place, and repoplone replaced whole arrays (dependencies, constraint-dependencies, classifiers) with new ones built from scratch.

The arrays are now updated in place: an entry whose value changes keeps its line and its comment, new entries are added, and removed ones go. Comments in the rest of the file, including whole-line comments between entries and after tables, survive.

Entries that already exist keep their order. Constraints and classifiers used to be re-sorted on every update; now a new entry is appended at the end and the existing order is kept. An array that does not exist yet is still created sorted. The comment and blank-line filtering of the constraint input from the remote source is unchanged.

Closes #91

The dependencies, constraint-dependencies and classifiers arrays were
rebuilt from scratch on every update, which dropped the comments written
on their entries. The arrays are now edited in place: a changed entry
keeps its line and its trailing comment, removed entries are removed,
and new entries are appended. Comments elsewhere in the file are kept
because the document is no longer replaced.

Refs #91
@ericof
ericof requested a review from a team as a code owner December 3, 2026 16:21
@ericof ericof self-assigned this Dec 3, 2026
@ericof
ericof merged commit 42010b1 into main Dec 3, 2026
9 checks passed
@ericof
ericof deleted the issue-91 branch December 3, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repoplone removes comments from pyproject.toml

1 participant