python-poetry / python-poetry/poetry
when adding dependencies, insert them at the correct ordering index in the list
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Feature Request
As a python dev team member I'd like to avoid a merge conflict when two users add a different dependency to the project.
Currently all are appended to the end of the dependency list. This causes merge conflict when merging two branches with different dependencies added.
A simple solution to minimize this, is to keep the dependency list ordered alphabetically.
Ideally all new projects would use sorted lists by default, but runtime overhead and existing unordered dependency lists should be considered.
- Add new configuration option: dependencies.sort = false
- If the above option is true, change
poetry addbehaviour to sort all dependency lists by pretty_name and use binary search to insert the new dependencies.
Let me know if this is acceptable and I'll start working on a PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names the poetry add entry point but no files or tests. Start by tracing its current dependency-list insertion behavior, then determine how the proposed dependencies.sort option should interact with existing unordered lists. Done means the ordering behavior and configuration scope are defined well enough for implementation and testing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100