poetry
poetry copied to clipboard
`poetry show <package>` outputs incorrect version when `poetry.lock` contains multiple version for same package.
- Poetry version: 1.7.1
- Python version: 3.12.1
- OS version and name: Ubuntu 22.04
- pyproject.toml: Refer to the following
- [x] I am on the latest stable Poetry version, installed using a recommended method.
- [x] I have searched the issues of this repo and believe that this is not a duplicate.
- [x] I have consulted the FAQ and blog for any relevant entries or release notes.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option) and have included the output below.
Issue
I am developing the python tool which supports python version from 3.8 to 3.12. The tool requires numpy.
I written the bellow pyproject.toml
, and I execute poetry install
command in python 3.12.
[tool.poetry]
name = "install-test-312"
version = "0.1.0"
description = ""
authors = ["yuji38kwmt"]
readme = "README.md"
packages = [{include = "install_test_312"}]
[tool.poetry.dependencies]
python = "^3.8"
numpy = [
{version = ">=1.26", python = ">=3.9"},
{version = "<1.25", python = "=3.8"}
]
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
I expected that numpy 1.26.3 was installed. Actually numpy 1.26.3 was installed.
$ poetry run python -c "import numpy; print(numpy.__version__);"
1.26.3
poetry show
command also outputs numpy 1.26.3
.
$ poetry show
numpy 1.26.3 Fundamental package for array computing in Python
But poetry show numpy
command outputs numpy 1.24.4
$ poetry show numpy
name : numpy
version : 1.24.4
description : Fundamental package for array computing in Python
I think that poetry show numpy
command affects python environment.
code is here, please submit a merge request if you have improvements