Skip to content

ModuleNotFoundError: No module named 'typing_extensions' when using rich-click as a dependency #310

@JacobCallahan

Description

@JacobCallahan

Hello,

When using rich-click as a dependency in our project, we encountered a ModuleNotFoundError for typing_extensions when running our CLI.

Steps to Reproduce

  1. Create a new project with a pyproject.toml file.
  2. Add rich-click as a dependency. The project also requires Python >= 3.10.
[project]
name = "my-cli"
requires-python = ">=3.10"
dependencies = [
    "click",
    "rich-click",
]
  1. Create a simple CLI application that uses rich-click.
  2. Install the project dependencies into a clean virtual environment using pip install ..
  3. Run the CLI.

Expected Behavior

The CLI should run without any ModuleNotFoundError. All necessary transitive dependencies, including typing_extensions, should be automatically installed when rich-click is installed.

Actual Behavior

The application fails with the following traceback, indicating that typing_extensions is not installed:

    1 Traceback (most recent call last):
    2   File "<path_to_cli_entry_point>", line 5, in <module>
    3     from my_cli.commands import cli
    4   File "/path/to/my_cli/commands.py", line 2, in <module>
    5     import rich_click as click
    6   File "/path/to/venv/lib/python3.11/site-packages/rich_click/__init__.py", line 74, in <module>
    7     from rich_click.decorators import command as command
    8   File "/path/to/venv/lib/python3.11/site-packages/rich_click/decorators.py", line 6, in <module>
    9     from typing_extensions import Concatenate, ParamSpec
   10 ModuleNotFoundError: No module named 'typing_extensions'

Workaround

The issue was resolved by manually adding typing-extensions to our project's dependencies in pyproject.toml.

dependencies = [
    "click",
    "rich-click",
    "typing-extensions", # Manually added
]

It seems that rich-click has a dependency on typing_extensions but does not declare it in its own packaging metadata, forcing downstream projects to fix the transitive dependency
themselves.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions