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 show [package] 'required by' output is confusing #9749

Closed
elliot-100 opened this issue Oct 10, 2024 · 7 comments · Fixed by #9750
Closed

poetry show [package] 'required by' output is confusing #9749

elliot-100 opened this issue Oct 10, 2024 · 7 comments · Fixed by #9750
Labels
area/show Related to `poetry show` area/ux Features and improvements related to the user experience kind/bug Something isn't working as expected

Comments

@elliot-100
Copy link
Contributor

elliot-100 commented Oct 10, 2024

Description

Here's an example.

Extract from my project's poetry.lock:

[[package]]
name = "playwright"
version = "1.47.0"
description = "A high-level API to automate web browsers"
optional = false
python-versions = ">=3.8"
files = [--snipped--]

[package.dependencies]
greenlet = "3.0.3"
pyee = "12.0.0"
> poetry show greenlet
 name         : greenlet                                      
 version      : 3.0.3                                         
 description  : Lightweight in-process concurrent programming 

required by
 - playwright 3.0.3

Playwright's latest version is 1.47; it looks like the locked version of greenlet is being shown here instead.

Notes:

  • Re 'How did you install Poetry?' I am not sure of the answer - is there a way to verify?
  • I will try to check on other platforms

Workarounds

Examining poetry.lock and not trusting poetry show [package].

Poetry Installation Method

install.python-poetry.org

Operating System

Windows 11

Poetry Version

1.8.3

Poetry Configuration

cache-dir = "C:\\Users\\--user-redacted--\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
repositories.testpypi.url = "https://test.pypi.org/legacy/"
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = false


### Python Sysconfig

```bash session
Platform: "win-amd64"
Python version: "3.12"
Current installation scheme: "venv"

Paths: 
        data = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12"
        include = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312\Include"
        platinclude = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312\Include"
        platlib = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12\Lib\site-packages"
        platstdlib = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12\Lib"
        purelib = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12\Lib\site-packages"
        scripts = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12\Scripts"
        stdlib = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312\Lib"

Variables: 
        BINDIR = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12\Scripts"
        BINLIBDEST = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12\Lib"
        EXE = ".exe"
        EXT_SUFFIX = ".cp312-win_amd64.pyd"
        INCLUDEPY = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312\Include"  
        LIBDEST = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312\Lib"        
        TZPATH = ""
        VERSION = "312"
        VPATH = "..\.."
        abiflags = ""
        base = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12"
        exec_prefix = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12"
        installed_base = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312"     
        installed_platbase = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312" 
        platbase = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12"
        platlibdir = "DLLs"
        prefix = "C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12"
        projectbase = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312"        
        py_version = "3.12.7"
        py_version_nodot = "312"
        py_version_nodot_plat = "312"
        py_version_short = "3.12"
        srcdir = "C:\Users\--user-redacted--\AppData\Local\Programs\Python\Python312"
        userbase = "C:\Users\--user-redacted--\AppData\Roaming\Python"

Example pyproject.toml

[tool.poetry]
name = "britishcycling-clubs"
version = "0.10.0.post1"
description = "Unofficial library to automate aspects of British/Scottish/Welsh Cycling's club Membership Manager system"
authors = ["elliot-100 <[email protected]>"]
readme = "README.md"
homepage = "https://github.com/elliot-100/britishcycling-clubs"
repository = "https://github.com/elliot-100/britishcycling-clubs"
packages = [{include = "britishcycling_clubs"}]
include = ["CHANGELOG.md"]
license = "GPL-3.0-only"

[tool.poetry.dependencies]
python = ">=3.8"
beautifulsoup4 = ">=4.12.2"
requests = ">=2.23.1"
playwright = ">=1.39.0"

[tool.poetry.group.dev.dependencies]
pdoc = ">=14.6.0"
ruff = ">=0.5.7"

[tool.poetry.group.test.dependencies]
mypy = ">=1.11.1"
pytest = ">=7.4.4"
types-requests = ">=2.32.0"
types-beautifulsoup4 = ">=4.12.0"

[tool.mypy]
strict = true

[[tool.mypy.overrides]]
module = "playwright"
disallow_untyped_calls = false

[tool.ruff]
target-version = "py38"  # Ruff doesn't respect Python version in [tool.poetry.dependencies]

[tool.ruff.lint]
select = ["ALL"]

# Ignore rules that conflict with Ruff formatter:
#   COM812 Trailing comma missing
#   ISC001 Implicitly concatenated string literals on one line
ignore = ["COM812", "ISC001"]

[tool.ruff.lint.per-file-ignores]
# Ignore rules that aren't relevant/useful in tests:
#   PLR2004 Magic value used in comparison
#   S101 Use of assert detected
"**/{tests}/*" = ["PLR2004", "S101"]
# Ignore rules that aren't relevant/useful in example scripts:
#   T203 `pprint` found
"example*.py" = ["T203"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Poetry Runtime Logs

Loading configuration file C:\Users\--user-redacted--\AppData\Roaming\pypoetry\config.toml
Using virtualenv: C:\Users\--user-redacted--\AppData\Local\pypoetry\Cache\virtualenvs\britishcycling-clubs-_kmXzTV9-py3.12
 name         : greenlet                                      
 version      : 3.0.3                                         
 description  : Lightweight in-process concurrent programming 

required by
 - playwright 3.0.3
@elliot-100 elliot-100 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 10, 2024
@Secrus Secrus added the area/show Related to `poetry show` label Oct 10, 2024
@dimbleby
Copy link
Contributor

it's not saying that playwright 3.0.3 requires greenlet, it's saying that playwright requires greenlet at exactly version 3.0.3

@Secrus
Copy link
Member

Secrus commented Oct 10, 2024

it's not saying that playwright 3.0.3 requires greenlet, it's saying that playwright requires greenlet at exactly version 3.0.3

It is still confusing (confused me too). Issue is valid as bad UX.

@Secrus Secrus added area/ux Features and improvements related to the user experience and removed status/triage This issue needs to be triaged labels Oct 10, 2024
@dimbleby
Copy link
Contributor

sure, no disagreement, just pointing out what it is that poetry is actually telling you

@elliot-100
Copy link
Contributor Author

it's not saying that playwright 3.0.3 requires greenlet, it's saying that playwright requires greenlet at exactly version 3.0.3

From my point of view, it's not saying that at all, and I'm not sure that anyone could reasonably say it does. The documentation has no detail at all here. But it's good to have the intended behaviour confirmed.

I will try to submit a PR to add to the documentation.

What if the command output said:

> poetry show my-package
 name         : my-package                                      
 version      : 1.2.3                                         
 description  : Example 

required by:
 - another-package requires my-package 1.2.3

?

@dimbleby
Copy link
Contributor

dimbleby commented Oct 10, 2024

might as well just tweak the code directly, rather than leave it confusing but documented-as-confusing.

fwiw requiring an exact version is unusual - playwright is likely wrong to do this, though I know nothing about that project.

The current output is somewhat less confusing when it says something like

required by 
  - playwright >=2.3.4
  - another >=3,<4
```

@elliot-100
Copy link
Contributor Author

Thanks for pointing me in the right direction @dimbleby - PR raised to change output.

@elliot-100 elliot-100 changed the title poetry show [package] gives version of required by package that doesn't match poetry.lock poetry show [package] 'required by' output is confusing Oct 10, 2024
Copy link

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 Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/show Related to `poetry show` area/ux Features and improvements related to the user experience kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants