From ea923146c42b399c26dc71ff9b343d8476245ce1 Mon Sep 17 00:00:00 2001 From: Melbin J Paulose <91303803+melbinjp@users.noreply.github.com> Date: Tue, 18 Aug 2026 01:09:28 +0530 Subject: [PATCH 1/2] docs: import Command and Application from where they live `src/cleo/__init__.py` defines only `__version__`, so every documented example fails on its first line: >>> from cleo import Command ImportError: cannot import name 'Command' from 'cleo' Six occurrences across three documents, including the first code block in the introduction - the one a new user copies before anything else. Corrected to the paths the project's own tests use: from cleo.commands.command import Command from cleo.application import Application Both verified to import against this tree. --- docs/introduction.rst | 8 ++++---- docs/single_command_tool.rst | 2 +- docs/usage.rst | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/introduction.rst b/docs/introduction.rst index f53ea12f..4f6a921f 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -6,7 +6,7 @@ create ``greet_command.py`` and add the following to it: .. code-block:: python - from cleo import Command + from cleo.commands.command import Command class GreetCommand(Command): @@ -40,7 +40,7 @@ an ``Application`` and adds commands to it: #!/usr/bin/env python from greet_command import GreetCommand - from cleo import Application + from cleo.application import Application application = Application() application.add(GreetCommand()) @@ -406,7 +406,7 @@ console: import pytest - from cleo import Application + from cleo.application import Application from cleo.testers.command_tester import CommandTester def test_execute(self): @@ -430,7 +430,7 @@ as a string to the ``CommandTester.execute()`` method: import pytest - from cleo import Application + from cleo.application import Application from cleo.testers.command_tester import CommandTester def test_execute(self): diff --git a/docs/single_command_tool.rst b/docs/single_command_tool.rst index c7d8509a..6ee029b8 100644 --- a/docs/single_command_tool.rst +++ b/docs/single_command_tool.rst @@ -7,7 +7,7 @@ it is possible to remove this need by using `default()` when adding a command: .. code-block:: python - from cleo import Application + from cleo.application import Application command = GreetCommand() diff --git a/docs/usage.rst b/docs/usage.rst index 6c441017..5ed9fcba 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -14,7 +14,7 @@ built-in options as well as a couple of built-in commands for Cleo. #!/usr/bin/env python # application.py - from cleo import Application + from cleo.application import Application application = Application() # ... From 27c9a85ee9abf59c52ad1f5b85bdc76f04b79d25 Mon Sep 17 00:00:00 2001 From: Melbin J Paulose <91303803+melbinjp@users.noreply.github.com> Date: Tue, 18 Aug 2026 06:42:50 +0530 Subject: [PATCH 2/2] docs: add news fragment for #539 --- news/539.docs.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/539.docs.md diff --git a/news/539.docs.md b/news/539.docs.md new file mode 100644 index 00000000..f02780ec --- /dev/null +++ b/news/539.docs.md @@ -0,0 +1 @@ +Corrected the example imports in the documentation: `Command` and `Application` are imported from `cleo.commands.command` and `cleo.application`.