Skip to content
New issue

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

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

Already on GitHub? Sign in 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
poetry/console/commands/add.py Outdated Show resolved Hide resolved
@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
poetry/console/commands/add.py Show resolved Hide resolved
@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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants