poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Add a check after running poetry build

Open mazinesy opened this issue 2 years ago • 1 comments

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

Feature

Add a way to ensure a built wheel or sdist file is actually resolvable by poetry. I'm unsure of the implementation detail, it could be:

poetry build --check-resolvable

Or

poetry check

Or it could be a default on poetry build that warns you when the built file is not resolvable.

Why

This bug caused me a lot of headaches when trying to understand why poetry version resolving was failing. Having this check/warning would be of great help.

mazinesy avatar Sep 16 '22 18:09 mazinesy

I don't know what you mean by "resolvable". What check are you asking poetry to perform?

~Per https://github.com/python-poetry/poetry/issues/6519#issuecomment-1249794969, I suspect that you are asking poetry to be responsible for pip bugs.~

~I don't know that that's reasonable, or likely to happen...~

I still don't think this is likely to happen because I don't see a reasonable way to do it: but pip is not at fault!

dimbleby avatar Sep 16 '22 21:09 dimbleby

@mazinesy could you explain what exactly you mean?

Secrus avatar Jan 03 '23 23:01 Secrus

@Secrus It has to do with this issue comment.

Given two libraries parent and child.

# child <pyproject.toml>
[tool.poetry.dependencies]
parent = "^1.0.0"

# parent 1.0.0 <pyproject.toml>
[tool.poetry.dependencies]
alpha_lib = "^0.0.2-alpha.21"

Here's how we I faced the issue (with an older poetry version as the comment issue was fixed)

  1. Build the parent package with poetry build. When it, the .whl will contain the restriction: alpha_lib (>=0.0.2-alpha.21,<0.0.2)
  2. Publish the parent package
  3. Run poetry install (or maybe even poetry add parent) on the child package
  4. Poetry will fail saying : unable to resolve alpha_lib <empty>

The source of the problem is the fact that poetry was able building a wheel with an version constraint it, itself, was unable to resolve later on.

In an ideal world, this adds a check after a build that the current wheel can be installed (resolved). If the check passes, then the build is valid, otherwise, the build fails.

mazinesy avatar Jan 04 '23 15:01 mazinesy