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

poetry init uses existing pyproject.toml if possible #2448

Merged
merged 8 commits into from Sep 29, 2020

Conversation

finswimmer
Copy link
Member

@finswimmer finswimmer commented May 21, 2020

At the moment a poetry init will fail, if a pyproject.toml already exists.

As this file is becoming more and more widely used to store configuration for other tools like black and isort, this PR changes the behavior to only skip creating the content for pyproject.toml if the file already contains a tool.poetry section or a build-system section.

closes: #1639

@finswimmer finswimmer requested a review from a team May 21, 2020
@finswimmer finswimmer added the kind/feature Feature requests/implementations label May 21, 2020
Copy link
Member

@abn abn left a comment

Minor changes. Would be good to add test coverage for this.

poetry/console/commands/init.py Outdated Show resolved Hide resolved
poetry/console/commands/init.py Outdated Show resolved Hide resolved
@tarkatronic
Copy link
Contributor

tarkatronic commented May 27, 2020

Instead of simply raising an error when a different build-system section already exists, would it be possible to prompt the user to convert it to use Poetry?

I recently ran into this when converting a project from setuptools to Poetry. In this case, I already had a pyproject.toml set up for a few other tools, and had a build-system defined. IIRC there can be cases where having a pyproject.toml without a build-system produces errors in pip, so I think this may not be an uncommon scenario.

@finswimmer finswimmer requested a review from abn Jun 1, 2020
@abn
Copy link
Member

abn commented Jun 10, 2020

@finswimmer can we rebase this please?

@finswimmer finswimmer force-pushed the issue-1639-pyproject.toml branch from 32b9bb9 to 3f363da Compare Jun 10, 2020
Copy link
Member

@abn abn left a comment

Looks good. We should add test coverage for this.

@finswimmer finswimmer force-pushed the issue-1639-pyproject.toml branch from 3f363da to 9cad9fb Compare Sep 16, 2020
@finswimmer finswimmer changed the base branch from develop to master Sep 16, 2020
poetry/console/commands/init.py Outdated Show resolved Hide resolved
@abn
Copy link
Member

abn commented Sep 27, 2020

@finswimmer here is an example for the init command test cases: abn@e378a88

@finswimmer finswimmer force-pushed the issue-1639-pyproject.toml branch from 9cad9fb to 50e68b6 Compare Sep 28, 2020
@finswimmer finswimmer requested a review from abn Sep 28, 2020
@abn
Copy link
Member

abn commented Sep 28, 2020

@finswimmer rebase please.

@finswimmer finswimmer force-pushed the issue-1639-pyproject.toml branch from e5846e3 to 3f5bb7d Compare Sep 28, 2020
@finswimmer
Copy link
Member Author

finswimmer commented Sep 28, 2020

I'v expected this @abn :) Is done.

@abn
Copy link
Member

abn commented Sep 28, 2020

Instead of simply raising an error when a different build-system section already exists, would it be possible to prompt the user to convert it to use Poetry?

@tarkatronic I thinnk that should be a new feature request as the scope of that is a bit larger than what is changed here.

@tarkatronic
Copy link
Contributor

tarkatronic commented Sep 28, 2020

Instead of simply raising an error when a different build-system section already exists, would it be possible to prompt the user to convert it to use Poetry?

@tarkatronic I thinnk that should be a new feature request as the scope of that is a bit larger than what is changed here.

That is totally reasonable. 😄

@finswimmer finswimmer force-pushed the issue-1639-pyproject.toml branch from 3f5bb7d to 45dcc24 Compare Sep 29, 2020
Copy link
Member

@abn abn left a comment

Looking good, minor changes.

poetry/console/commands/init.py Outdated Show resolved Hide resolved
poetry/console/commands/init.py Outdated Show resolved Hide resolved
@finswimmer finswimmer requested a review from abn Sep 29, 2020
abn
abn approved these changes Sep 29, 2020
@abn abn merged commit 30a9b13 into python-poetry:master Sep 29, 2020
@abn abn added this to In progress in 1.1 via automation Sep 29, 2020
@abn abn added this to the 1.1 milestone Sep 29, 2020
@abn abn moved this from In progress to Done in 1.1 Sep 29, 2020
@sdispater sdispater mentioned this pull request Sep 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations
Projects
No open projects
1.1
  
Done
Development

Successfully merging this pull request may close these issues.

'poetry init' should use existing pyproject.toml file
3 participants