carstencodes / pdm-bump

A small PEP440 compliant bump utility for the Python development master.
MIT License
41 stars 8 forks source link

`pdm bump` removes comments from `pyproject.toml` #327

Closed znichollscr closed 3 weeks ago

znichollscr commented 2 months ago

I've noticed that running pdm bump removes any comments that are in my pyproject.toml. That isn't the end of the world, but it might be a good thing to document. I'm happy to write a PR that adds that, I just wanted to check two questions:

  1. Is the re-write of pyproject.toml deliberate?
  2. Is there an easy way to avoid it, or is preserving comments really difficult?
carstencodes commented 1 month ago

Currently, the data is parsed into a dictionary using tomli or tomllib. Than tomli-w writes the data back.

The comments are not preserved during parsing.

I have to rework the pyproject.toml handling anyway, I can take care of it in the next days.

carstencodes commented 1 month ago

I could update this, so that pyproject.toml is a special case of dynamic. Would take a bit. Hopefully sunday...