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

Confusing error msg if path in "packages" doesn't exist #2139

Closed
2 tasks done
geckon opened this issue Mar 6, 2020 · 5 comments
Closed
2 tasks done

Confusing error msg if path in "packages" doesn't exist #2139

geckon opened this issue Mar 6, 2020 · 5 comments
Labels
area/error-handling Bad error messages/insufficient error handling

Comments

@geckon
Copy link

geckon commented Mar 6, 2020

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Could poetry please handle typos/errors in tool.poetry.packages better?

If you make a typo or another error in specifying packages to include into your package and the modules specified in pyproject.toml don't exist, you'll get a very user-unfriendly message:

$ poetry build
Building dummy_package (1.49.1)

[IndexError]
list index out of range

Let's say you have a package called dummy_package and in it you have python modules dummy1 and dummy2 you want to include into the package. Then you'd like to put this into your pyproject.toml:

packages = [
    { include = "dummy1" },
    { include = "dummy2" },    
]

If instead you make a mistake and have e.g. this there:

packages = [
    { include = "dumny1" },
    { include = "dumny2" },    
]

You ge tthe above mentioned error which is very confusing and not helpful at all.

The error happens because you mention a module that doesn't exist in your project directory. The actual error happens in method check_elements() (specifically on line 37 in current master) in poetry/masonry/utils/package_include.py but I think it might be detectable in poetry/masonry/utils/include.py where it tries to expand the path. Maybe there it could issue a warning or something?

The issue was mentioned e.g. in #1247 but that issue is closed and I'd like this to get a little more attention as I spent a few hours debugging this.

Thank you!

@geckon geckon added the kind/feature Feature requests/implementations label Mar 6, 2020
@finswimmer finswimmer added area/error-handling Bad error messages/insufficient error handling and removed kind/feature Feature requests/implementations labels Mar 6, 2020
@autoferrit
Copy link

I have the same issue. for me I believe it is because of this portion of my pyproject.toml

packages = [
    { include = "bohemian", from = "src"}
]

I am mostly doing this, because my project is inside a src directory. This happens in CI when I add the pyproject.toml and poetry.lock into a container and run install, when my apps code isnt there yet.
But it work when I install with

poetry install --no-root

and then don't install or run poetry build until I add my code into the repo.

@aaugustin
Copy link

I have been hitting this error as well.

I considered moving to a src layout, then changed my mind, and eventually ran poetry with from = "src" in my pyproject.toml while my package wasn't in a src directory.

This is clearly a user error on my side but the error message is less than helpful and the traceback with -v isn't any better.

@PierreAndreNoel
Copy link

Got the same meaningless error, but should be fixed by #2265

@mkniewallner
Copy link
Member

As already mentioned, this was fixed by #2265.

Copy link

github-actions bot commented Mar 2, 2024

This issue 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 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/error-handling Bad error messages/insufficient error handling
Projects
None yet
Development

No branches or pull requests

6 participants