LinuxCommandLibrary

poetry-show

Show project or package details

TLDR

Display all packages

$ poetry show
copy

Show details of a specific package
$ poetry show [package_name]
copy

Show details as a dependency tree
$ poetry show [[-t|--tree]]
copy

Only show top-level packages (those explicitly defined in pyproject.toml)
$ poetry show [[-T|--top-level]]
copy

Show outdated packages
$ poetry show [[-o|--outdated]]
copy

Show the latest versions for all packages
$ poetry show [[-l|--latest]]
copy

Exclude a specific dependency group/s
$ poetry show --without [group1,group2,...]
copy

Only show a specific dependency group/s
$ poetry show --only [group1,group2,...]
copy

SYNOPSIS

poetry show [] []

PARAMETERS

[package]
    The name of a specific package to inspect, displaying its details and dependencies.

--tree
    Displays the dependencies of the project or a specified package in a hierarchical tree format.

--latest
    Shows the latest available version for each package in addition to the installed version.

--outdated
    Lists packages that have newer versions available, indicating both installed and latest versions.

--patch
    Used with --outdated, limits the output to only patch-level updates.

--minor
    Used with --outdated, limits the output to only minor-level updates.

--major
    Used with --outdated, limits the output to only major-level updates.

--direct
    Displays only the direct dependencies of the project, excluding transitive ones.

-D, --dev
    Includes development dependencies in the output.

-P, --prod
    Includes production dependencies in the output (default if no other dependency option is given).

-f FORMAT, --format FORMAT
    Specifies the output format. Valid options are pretty (default), json, or raw.

-l, --locked
    Shows packages as they are defined in the poetry.lock file, ensuring consistency.

-o, --only-dev
    Shows only development dependencies, excluding production ones.

-N, --only-prod
    Shows only production dependencies, excluding development ones.

-A, --all-packages
    Displays all packages, including transitive dependencies, without filtering.

-i, --only-installable
    Filters the output to show only packages that are currently installable.

--why
    Explains why a specific package is required by showing its dependants.

--ansi
    Forces the use of ANSI escape codes for colored output, even if not automatically detected.

--no-ansi
    Disables ANSI escape codes, resulting in plain text output.

DESCRIPTION

poetry show is a versatile command within the Poetry ecosystem, primarily used to inspect the installed packages and their dependencies for the current project. It offers various options to drill down into specific details, such as a list of all installed packages, details about a particular package, or a graphical representation of the dependency tree. This command is indispensable for developers who need to understand their project's dependency graph, troubleshoot package conflicts, or verify installed versions.

It helps in maintaining a clean and understandable project environment by providing clear insights into the package landscape. Whether you're debugging, reviewing, or simply exploring your project's components, poetry show serves as a powerful diagnostic and informational tool for Python projects managed with Poetry.

CAVEATS

The command requires Poetry to be installed and the project to be initialized with Poetry. Output can be extensive for large projects, especially when using options like --all-packages or --tree. Version updates shown by --latest or --outdated are based on available package sources and might not necessarily be compatible with the current project's constraints in pyproject.toml.

OUTPUT FORMATS

The --format option allows seamless integration with other tools or scripting by providing json output, which is highly useful for programmatic parsing and automation workflows.

DEPENDENCY TYPES

The clear distinction between development and production dependencies, along with the ability to filter them using options like --dev, --prod, --only-dev, and --only-prod, helps in managing different environments effectively.

UPDATE CHECKS

The various --outdated options (--patch, --minor, --major) provide fine-grained control over checking for available updates, helping maintainers decide on specific upgrade strategies tailored to their project's stability requirements.

HISTORY

Poetry itself emerged as a modern Python dependency management and packaging tool, designed to simplify project creation, dependency resolution, and package publishing. The show command has been a core part of Poetry from its early versions, providing essential introspection capabilities into the project's dependency graph. Its functionality has evolved with Poetry itself, with new options like --why being added to address more specific use cases and improve debugging. It aims to offer a more robust and consistent experience compared to traditional tools like pip and setuptools by managing virtual environments and locking dependencies effectively.

SEE ALSO

poetry add, poetry remove, poetry install, poetry update, pip freeze(1)

Copied to clipboard