-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Improve error message for packages in src folder #10236
base: main
Are you sure you want to change the base?
Improve error message for packages in src folder #10236
Conversation
Reviewer's Guide by SourceryThis pull request improves the user experience by adding a warning message when a Poetry project has a potential misconfiguration: an empty directory in the project root with the same name as the project, while the actual package resides in the No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @martinvotruba-r7 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a test case where the root
project_name
directory exists but is not empty.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.Summary by Sourcery
Tests: