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

Top level dependencies not showing with --top-level/-T flag #8070

Closed
4 tasks done
jorgebodega opened this issue Jun 6, 2023 · 2 comments · Fixed by #8076
Closed
4 tasks done

Top level dependencies not showing with --top-level/-T flag #8070

jorgebodega opened this issue Jun 6, 2023 · 2 comments · Fixed by #8076
Labels
kind/bug Something isn't working as expected

Comments

@jorgebodega
Copy link

jorgebodega commented Jun 6, 2023

  • 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

First of all, as is a recently deployed feature, I didn't find anything in recent issues. If there is any existing issue, let me know.

In a newly created project, we are using the --top-level/-T to keep tracking of manually defined deps until we have some automation (like renovate), and we found a problem: the packages using extras are not being showed when the command poetry show -lT is executed.

In my example, the pyproject.toml is the following:

[tool.poetry]
name = "poetry-toplevel"
version = "0.1.0"
description = ""
authors = ["Jorge Bodega Fernanz <[email protected]>"]
license = "MIT"
readme = "README.md"
packages = [{ include = "poetry_toplevel" }]

[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.31.0"
black = { extras = ["d"], version = "^23.3.0" }


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

With those packages installed, if I run poetry show -l, this is the result:

aiohttp            3.8.4    3.8.4    Async http client/server framework (asyncio)
aiosignal          1.3.1    1.3.1    aiosignal: a list of registered asynchronous callbacks
async-timeout      4.0.2    4.0.2    Timeout context manager for asyncio programs
attrs              23.1.0   23.1.0   Classes Without Boilerplate
black              23.3.0   23.3.0   The uncompromising code formatter.
certifi            2023.5.7 2023.5.7 Python package for providing Mozilla's CA Bundle.
charset-normalizer 3.1.0    3.1.0    The Real First Universal Charset Detector. Open, modern and actively main...
click              8.1.3    8.1.3    Composable command line interface toolkit
frozenlist         1.3.3    1.3.3    A list-like structure which implements collections.abc.MutableSequence
idna               3.4      3.4      Internationalized Domain Names in Applications (IDNA)
multidict          6.0.4    6.0.4    multidict implementation
mypy-extensions    1.0.0    1.0.0    Type system extensions for programs checked with the mypy type checker.
packaging          23.1     23.1     Core utilities for Python packages
pathspec           0.11.1   0.11.1   Utility library for gitignore style pattern matching of file paths.
platformdirs       3.5.1    3.5.1    A small Python package for determining appropriate platform-specific dirs...
requests           2.31.0   2.31.0   Python HTTP for Humans.
urllib3            2.0.2    2.0.2    HTTP library with thread-safe connection pooling, file post, and more.
yarl               1.9.2    1.9.2    Yet another URL library

Seems very normal. But this is the result using the new flag (poetry show -lT):

requests           2.31.0   2.31.0   Python HTTP for Humans.

Using the verbose flag (poetry show -lT -vvv), seems like black is being detected, but not printed:

Source (PyPI): 1 packages found for aiohttp >=3.8.4
Source (PyPI): 1 packages found for aiosignal >=1.3.1
Source (PyPI): 1 packages found for async-timeout >=4.0.2
Source (PyPI): 1 packages found for attrs >=23.1.0
Source (PyPI): 1 packages found for black >=23.3.0
Source (PyPI): 1 packages found for certifi >=2023.5.7
Source (PyPI): 1 packages found for charset-normalizer >=3.1.0
Source (PyPI): 1 packages found for click >=8.1.3
Source (PyPI): 1 packages found for frozenlist >=1.3.3
Source (PyPI): 1 packages found for idna >=3.4
Source (PyPI): 1 packages found for multidict >=6.0.4
Source (PyPI): 1 packages found for mypy-extensions >=1.0.0
Source (PyPI): 1 packages found for packaging >=23.1
Source (PyPI): 1 packages found for pathspec >=0.11.1
Source (PyPI): 1 packages found for platformdirs >=3.5.1
Source (PyPI): 1 packages found for requests >=2.31.0
Source (PyPI): 1 packages found for urllib3 >=2.0.2
Source (PyPI): 1 packages found for yarl >=1.9.2

Is this a bug? Or maybe I didn't understand well the functionality.

@jorgebodega jorgebodega added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 6, 2023
@dimbleby
Copy link
Contributor

dimbleby commented Jun 7, 2023

can be fixed with

diff --git a/src/poetry/console/commands/show.py b/src/poetry/console/commands/show.py
index 090e5ca1..0a6952f1 100644
--- a/src/poetry/console/commands/show.py
+++ b/src/poetry/console/commands/show.py
@@ -320,7 +320,7 @@ lists all packages available."""
             install_marker = ""

             if show_top_level and not any(
-                locked.is_same_package_as(r) for r in requires
+                locked.satisfies(r) for r in requires
             ):
                 continue

probably, but you'll want to add a unit test too

@ralbertazzi ralbertazzi removed the status/triage This issue needs to be triaged label Jun 7, 2023
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 Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants