feat: preserve existing data in [project]
#84
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #52.
Preserve existing data in
[project]
section ofpyproject.toml
when performing the migration. This can be opted out by setting--replace-project-section
flag.This should also enable support for projects using PEP 621 with Poetry, but official support and tests will be added in another PR.
There are some edge cases that are not handled, but that are I believe not worth handling.
For instance, if a project using Pipenv has the following
Pipfile
:and the following
pyproject.toml
:The project would get migrated to:
where
[tool.uv.sources]
would reference dependencies that do not exist, since we keep the existingdependencies
key.We could conditionally add sources only if
dependencies
is replaced, or consider an option to merge some sections, but I feel like this would make things way more complex, for something that I believe is not really a use case to begin with.