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 Sep 6, 2020
@finswimmer finswimmer requested a review from a team Sep 6, 2020
@finswimmer finswimmer force-pushed the allow-adding-known-package branch 2 times, most recently from 74adf7e to 29efdde Compare Sep 10, 2020
poetry/console/commands/add.py Outdated Show resolved Hide resolved
@sdispater
Copy link
Member

sdispater commented Sep 11, 2020

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 Sep 21, 2020
poetry/console/commands/add.py Show resolved Hide resolved
@finswimmer finswimmer force-pushed the allow-adding-known-package branch from 644b371 to 5aca16e Compare Sep 21, 2020
@finswimmer finswimmer requested a review from abn Sep 21, 2020
abn
abn approved these changes Sep 23, 2020
@abn abn merged commit ce3f763 into python-poetry:master Sep 23, 2020
@abn abn added this to In progress in 1.1 via automation Sep 23, 2020
@abn abn added this to the 1.1 milestone Sep 23, 2020
@abn abn moved this from In progress to Done in 1.1 Sep 23, 2020
@sdispater sdispater mentioned this pull request Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
1.1
  
Done
3 participants