Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Do not raise error if package is already in pyproject.toml on poetry add #2886

Merged
merged 3 commits into from
Sep 23, 2020

Conversation

finswimmer
Copy link
Member

@finswimmer finswimmer commented Sep 6, 2020

At the moment poetry raises a ValueError when trying to add a package that is already in the pyproject.toml. This PR change the behaviour as follows:

  • Do not raise ValueError if a dependency is added via poetry add and this dependency is already in pyproject.toml.
  • Instead just print a warning and skip this package

Pull Request Check List

Resolves: #98

  • Added tests for changed code.
  • Updated documentation for changed code.

@finswimmer finswimmer marked this pull request as ready for review September 6, 2020 20:28
@finswimmer finswimmer requested a review from a team September 6, 2020 20:28
@finswimmer finswimmer force-pushed the allow-adding-known-package branch 2 times, most recently from 74adf7e to 29efdde Compare September 10, 2020 17:11
@sdispater
Copy link
Member

I think from a purely UX standpoint, a good approach would be to display some guidance for user, for instance:

"package" is already present in the pyproject.toml file.

If you want to update it to the latest compatible version you can use `poetry update package`.
If you prefer to upgrade it to the latest available version you use `poetry add package@latest`.

@finswimmer finswimmer requested a review from abn September 21, 2020 16:39
@finswimmer finswimmer force-pushed the allow-adding-known-package branch from 644b371 to 5aca16e Compare September 21, 2020 18:06
@finswimmer finswimmer requested a review from abn September 21, 2020 18:11
@abn abn merged commit ce3f763 into python-poetry:master Sep 23, 2020
@abn abn added this to the 1.1 milestone Sep 23, 2020
@sdispater sdispater mentioned this pull request Sep 25, 2020
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
3 participants