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 install exit code 0 (success) even if readme file does not exist and fails to install the package #8637

Open
4 tasks done
roy-ht opened this issue Nov 9, 2023 · 4 comments · May be fixed by #9333
Open
4 tasks done
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@roy-ht
Copy link

roy-ht commented Nov 9, 2023

  • Poetry version: Poetry (version 1.7.0)
  • Python version: Python: 3.10.9
  • OS version and name: Ubuntu 22.04
  • pyproject.toml:
[tool.poetry]
name = "test"
version = "1.0.0"
readme = "README_does_not_exist"
authors = ["xxx <xxx@example.com>"]
description = ""

[tool.poetry.dependencies]
python = ">=3.10,<3.11"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

with Poetry 1.6.1, poetry install command fails with exit code != 0:

❯ poetry161 install
Installing dependencies from lock file

[Errno 2] No such file or directory: '/home/jovyan/repo/sarasvati/temp/README_does_not_exist'

but Poetry 1.7.0 do not fail:

❯ poetry install   
Installing dependencies from lock file

Installing the current project: test (1.0.0)
The current project could not be installed: [Errno 2] No such file or directory: '/home/jovyan/repo/sarasvati/temp/README_does_not_exist'
If you do not want to install the current project use --no-root

I guess this behavior was introduced by #8369 .

In daily development, it's ok, one can see the warning messages.

But in my usecase, poetry install in Dockerfile,
docker build doesn't fail if i forget to copy README like COPY README.md.

This result is very confusing, and I expect to return failure exit code if attempting to install package was failed.

Thanks! :)

@roy-ht roy-ht added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 9, 2023
@radoering
Copy link
Member

So with Poetry 1.6, poetry install fails if the readme is missing, but does not fail if the complete package is missing. Quite inconsistent, isn't it?

Poetry 1.7 does not fail, but prints a warning in both cases. I agree that it would be better if it failed, but I think we can only change this after we have a "non-package" mode (cf #1132 (comment)) because there are a lot of users who do not want it to fail.

@roy-ht
Copy link
Author

roy-ht commented Nov 15, 2023

but I think we can only change this after we have a "non-package" mode (cf #1132 (comment)) because there are a lot of users who do not want it to fail.

It’s not a critical issue and i agree with your plan.
Thanks @radoering !

@th0ger
Copy link

th0ger commented Nov 27, 2023

I can confirm this issues as well (poetry 1.7.1).
Docker build with poetry -n install --only-root silently failed due to missing README.md.
I consider this a clear bug. Especially beacuse earlier versions errored correctly (error code 1 thown by poetry 1.5.1 here.)

@jamesbraza
Copy link

Just his this today, I also forgot to COPY the README.md into our Dockerfile. The poetry install command threw a warning, but still gave a 0 error code (which didn't crash the Docker build):

Installing the current project: <redacted>
Warning: The current project could not be installed: [Errno 2] No such file or directory: '/README.md'
If you do not want to install the current project use --no-root.
If you want to use Poetry only for dependency management but not for packaging, you can set the operating mode to "non-package" in your pyproject.toml file.
In a future version of Poetry this warning will become an error!

The last line is promising 🤓 : In a future version of Poetry this warning will become an error!.


Imo since the failure is catastrophic (image build succeeds, but fails at runtime since installation didn't actually happen), the default behavior should definitely be an error, not a warning.

there are a lot of users who do not want it to fail.

I can understand this. Maybe an alternate solution is for poetry to just neglect the missing readme metadata and still proceed with the installation, instead of stopping the install entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants