poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Adding `allow-prereleases` breaks Git sub-dependency even when locked

Open daaain opened this issue 5 years ago • 3 comments

  • [x] I am on the latest Poetry version.

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

  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: Debian Buster

  • Poetry version: 1.0.2

Issue

I added Black as a dependency to a shared library so that it would be included in all dependent services now that we adopted it.

black={version = "*", allow-prereleases = true}

This works fine when doing a poetry install in the library itself and correctly installs the latest beta:

...
  - Installing black (19.10b0)
...

However, in the dependent services even before doing a poetry lock to update the dependencies this blows up the installation – see output at the bottom.

Which means that:

  1. Poetry disregards the allow-prereleases flag when it's in a sub-dependency and
  2. it's doing the dependency resolution by looking at the latest Git commit rather than the locked commit hash in poetry.lock.
...
Installing dependencies from lock file

[SolverProblemError]
Because no versions of basis-libraries match !=1.0.0
 and basis-libraries (1.0.0) depends on black (*), every version of basis-libraries requires black (*).
So, because no versions of black match *
 and bike depends on basis-libraries (*), version solving failed.

Traceback (most recent call last):
  File "/home/app/.local/lib/python3.7/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/app/.local/lib/python3.7/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/app/.local/lib/python3.7/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/app/.local/lib/python3.7/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/app/.local/lib/python3.7/site-packages/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/home/app/.local/lib/python3.7/site-packages/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/home/app/.local/lib/python3.7/site-packages/poetry/installation/installer.py", line 225, in _do_install
    ops = solver.solve(use_latest=whitelist)
  File "/home/app/.local/lib/python3.7/site-packages/poetry/puzzle/solver.py", line 36, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/home/app/.local/lib/python3.7/site-packages/poetry/puzzle/solver.py", line 190, in _solve
    raise SolverProblemError(e)

daaain avatar Jan 21 '20 17:01 daaain

Hello @daaain ,

could you please give some more details about how your projects are setup and how the pyproject.toml looks like? At best you gave us a step-by-step manual how we can reproduce your issue.

Thanks a lot!

fin swimmer

finswimmer avatar Jan 21 '20 18:01 finswimmer

Thanks for the quick response @finswimmer!

I managed to reproduce with two minimal repos.

Clone https://github.com/daaain/poetry-bug-app (which depends on https://github.com/daaain/poetry-bug-test) and cd to the directory, then:

docker run --rm -it -v $(pwd):/temp python:3.8.1 /bin/bash
cd temp
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
source $HOME/.poetry/env
poetry install

daaain avatar Jan 21 '20 19:01 daaain

Poetry disregards the allow-prereleases flag when it's in a sub-dependency [...]

This has its own issue now: https://github.com/python-poetry/poetry/issues/4405

MadLittleMods avatar Aug 03 '22 21:08 MadLittleMods

Switching recent poetry into these instructions the installation goes fine.

I guess this should be closed

dimbleby avatar Oct 05 '22 11:10 dimbleby

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[bot] avatar Mar 01 '24 07:03 github-actions[bot]