Skip to content

Commit

Permalink
feat(cli): add debug tags command
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Feb 2, 2025
1 parent 2ae413d commit 1b54590
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,25 @@ Without `--` this command will fail if `${GITLAB_JOB_TOKEN}` starts with a hyphe
* `--local`: Set/Get settings that are specific to a project (in the local configuration file `poetry.toml`).
* `--migrate`: Migrate outdated configuration settings.

## debug

The `debug` command groups subcommands that are useful for, as the name suggests, debugging issues you might have
when using Poetry with your projects.

### debug info

The `debug info` command shows debug information about Poetry and your project's virtual environment.

### debug resolve

The `debug resolve` command helps when debugging dependency resolution issues. The command attempts to resolve your
dependencies and list the chosen packages and versions.

### debug tags

The `debug tags` command is useful when you want to see the supported packaging tags for your project's active
virtual environment. This is useful when Poetry cannot install any known binary distributions for a dependency.

## env

The `env` command groups subcommands to interact with the virtualenvs
Expand Down
1 change: 1 addition & 0 deletions src/poetry/console/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def _load() -> Command:
# Debug commands
"debug info",
"debug resolve",
"debug tags",
# Env commands
"env activate",
"env info",
Expand Down
17 changes: 17 additions & 0 deletions src/poetry/console/commands/debug/tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from __future__ import annotations

from poetry.console.commands.env_command import EnvCommand


class DebugTagsCommand(EnvCommand):
name = "debug tags"
description = "Shows compatible tags for your project's current active environment."

def handle(self) -> int:
for tag in self.env.get_supported_tags():
self.io.write_line(
f"<c1>{tag.interpreter}</>"
f"-<c2>{tag.abi}</>"
f"-<fg=yellow;options=bold>{tag.platform}</>"
)
return 0

0 comments on commit 1b54590

Please sign in to comment.