Improve error message for packages in src folder #800
+74
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem description
Currently when a
poetry install
command is run on a project, which has source stored undersrc/project_name
, but a folder namedproject_name
exists in the root, the command will fail withproject_name is not a package.
It can be rather hard to determine the root cause, as one might easily overlook the empty folder.Steps to reproduce
poetry new poetry-demo
poetry_demo/__init__.py
tosrc/poetry_demo/__init__.py
poetry install
The command will fail with the following
This is caused by the presence of poetry_demo folder in the root.
When I remove the poetry_demo folder, the
poetry install
command succeeds.Resolution
To provide more information about the actual root cause of the issue, I have added another validation method to the Factory class. This will output a warning when there is both
project_name
folder in the rootsrc/project_name
folderThe provided warning message is the following
If there is a better place / method how to alert user to the empty
project_name
folder, I am happy to hear it and adjust my implementation.