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 06:58
@finswimmer finswimmer added the kind/feature Feature requests/implementations label May 21, 2020
Copy link
Member

@abn abn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

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 June 1, 2020 05:55
@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 June 10, 2020 18:06
Copy link
Member

@abn abn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. We should add test coverage for this.

@finswimmer finswimmer force-pushed the issue-1639-pyproject.toml branch from 3f363da to 9cad9fb Compare September 16, 2020 04:10
@finswimmer finswimmer changed the base branch from develop to master September 16, 2020 04:13
@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 September 28, 2020 04:15
@finswimmer finswimmer requested a review from abn September 28, 2020 04:40
@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 September 28, 2020 17:27
@finswimmer
Copy link
Member Author

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

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 September 29, 2020 19:00
Copy link
Member

@abn abn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 September 29, 2020 20:08
@abn abn merged commit 30a9b13 into python-poetry:master Sep 29, 2020
@abn abn added this to the 1.1 milestone Sep 29, 2020
@sdispater sdispater mentioned this pull request Sep 30, 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
kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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