claude-sdk-tutor 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,22 @@
1
+ # Personal Claude
2
+
3
+ A TUI application built with Textual and the Claude Agent SDK.
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ uv sync
9
+ ```
10
+
11
+ ## Run
12
+
13
+ ```bash
14
+ uv run python main.py
15
+ ```
16
+
17
+ ## Tech Stack
18
+
19
+ - Python 3.13+
20
+ - Textual (TUI framework)
21
+ - Claude Agent SDK
22
+ - uv (package manager)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ryan Wiley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ .PHONY: dev
2
+
3
+ dev:
4
+ uv run textual run --dev app.py
@@ -0,0 +1,72 @@
1
+ Metadata-Version: 2.4
2
+ Name: claude-sdk-tutor
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.13
7
+ Requires-Dist: claude-agent-sdk>=0.1.26
8
+ Requires-Dist: textual-dev>=1.8.0
9
+ Requires-Dist: textual>=7.5.0
10
+ Requires-Dist: watchfiles>=1.1.1
11
+ Description-Content-Type: text/markdown
12
+
13
+ # Claude Tutor
14
+
15
+ A terminal-based programming tutor powered by Claude. Built with Textual and the Claude Agent SDK.
16
+
17
+ ## Overview
18
+
19
+ Claude Tutor is a TUI (Terminal User Interface) application designed to help you learn programming concepts. Unlike a typical coding assistant, Claude Tutor focuses on teaching rather than writing code for you. It will:
20
+
21
+ - Explain concepts clearly and thoroughly
22
+ - Guide you toward understanding with questions and hints
23
+ - Provide small examples to illustrate concepts
24
+ - Encourage you to write code yourself
25
+ - Review code you share, pointing out what works well and what could be improved
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ uv sync
31
+ ```
32
+
33
+ Or install from PyPI:
34
+
35
+ ```bash
36
+ uvx claude_tutor
37
+ ```
38
+
39
+ ## Running
40
+
41
+ ```bash
42
+ uv run python app.py
43
+ ```
44
+
45
+ ## Using the TUI
46
+
47
+ When you launch Claude Tutor, you'll see a simple interface with:
48
+
49
+ - A welcome header at the top
50
+ - A chat log area in the middle showing your conversation
51
+ - A text input field at the bottom for typing messages
52
+
53
+ Type your programming questions in the input field and press Enter to send. Claude's responses will appear in the chat log. The interface uses color-coded panels to distinguish between different message types:
54
+
55
+ - **Blue** - Your messages
56
+ - **Red** - Claude's responses
57
+ - **Grey** - Tool usage (when Claude reads files in your codebase)
58
+ - **Green** - Slash command feedback
59
+
60
+ ## Slash Commands
61
+
62
+ | Command | Description |
63
+ |---------|-------------|
64
+ | `/clear` | Clears the conversation history and starts fresh. Your tutor mode setting is preserved. |
65
+ | `/tutor` | Toggles tutor mode on/off. When on (default), Claude acts as a teacher. When off, Claude responds normally without the tutoring constraints. |
66
+
67
+ ## Tech Stack
68
+
69
+ - Python 3.13+
70
+ - [Textual](https://textual.textualize.io/) - TUI framework
71
+ - [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk) - Claude integration
72
+ - [uv](https://github.com/astral-sh/uv) - Package manager
@@ -0,0 +1,60 @@
1
+ # Claude Tutor
2
+
3
+ A terminal-based programming tutor powered by Claude. Built with Textual and the Claude Agent SDK.
4
+
5
+ ## Overview
6
+
7
+ Claude Tutor is a TUI (Terminal User Interface) application designed to help you learn programming concepts. Unlike a typical coding assistant, Claude Tutor focuses on teaching rather than writing code for you. It will:
8
+
9
+ - Explain concepts clearly and thoroughly
10
+ - Guide you toward understanding with questions and hints
11
+ - Provide small examples to illustrate concepts
12
+ - Encourage you to write code yourself
13
+ - Review code you share, pointing out what works well and what could be improved
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ uv sync
19
+ ```
20
+
21
+ Or install from PyPI:
22
+
23
+ ```bash
24
+ uvx claude_tutor
25
+ ```
26
+
27
+ ## Running
28
+
29
+ ```bash
30
+ uv run python app.py
31
+ ```
32
+
33
+ ## Using the TUI
34
+
35
+ When you launch Claude Tutor, you'll see a simple interface with:
36
+
37
+ - A welcome header at the top
38
+ - A chat log area in the middle showing your conversation
39
+ - A text input field at the bottom for typing messages
40
+
41
+ Type your programming questions in the input field and press Enter to send. Claude's responses will appear in the chat log. The interface uses color-coded panels to distinguish between different message types:
42
+
43
+ - **Blue** - Your messages
44
+ - **Red** - Claude's responses
45
+ - **Grey** - Tool usage (when Claude reads files in your codebase)
46
+ - **Green** - Slash command feedback
47
+
48
+ ## Slash Commands
49
+
50
+ | Command | Description |
51
+ |---------|-------------|
52
+ | `/clear` | Clears the conversation history and starts fresh. Your tutor mode setting is preserved. |
53
+ | `/tutor` | Toggles tutor mode on/off. When on (default), Claude acts as a teacher. When off, Claude responds normally without the tutoring constraints. |
54
+
55
+ ## Tech Stack
56
+
57
+ - Python 3.13+
58
+ - [Textual](https://textual.textualize.io/) - TUI framework
59
+ - [Claude Agent SDK](https://github.com/anthropics/claude-agent-sdk) - Claude integration
60
+ - [uv](https://github.com/astral-sh/uv) - Package manager
File without changes
@@ -0,0 +1,134 @@
1
+ import json
2
+
3
+ from claude_agent_sdk import AssistantMessage, ResultMessage
4
+ from rich.markdown import Markdown as RichMarkdown
5
+ from rich.panel import Panel
6
+ from textual.app import App, ComposeResult
7
+ from textual.containers import Vertical
8
+ from textual.widgets import Static, Footer, Input, RichLog, LoadingIndicator
9
+
10
+ from claude.claude_agent import (
11
+ connect_client,
12
+ create_claude_client,
13
+ stream_helpful_claude,
14
+ )
15
+
16
+
17
+ class MyApp(App):
18
+ def __init__(self):
19
+ super().__init__()
20
+ self.tutor_mode = True
21
+ self.client = create_claude_client(tutor_mode=self.tutor_mode)
22
+
23
+ CSS = """
24
+ #main {
25
+ height: 100%;
26
+ }
27
+ Input {
28
+ height: auto;
29
+ margin-top: 1;
30
+ margin-left: 3;
31
+ margin-right: 3;
32
+ margin-bottom: 1;
33
+ }
34
+ #header {
35
+ content-align: center middle;
36
+ width: 100%;
37
+ margin-top: 1;
38
+ margin-bottom: 1;
39
+ height: auto;
40
+ }
41
+ RichLog {
42
+ background: $boost;
43
+ margin-left: 3;
44
+ margin-right: 3;
45
+ height: 1fr;
46
+ }
47
+ LoadingIndicator {
48
+ height: auto;
49
+ margin-left: 3;
50
+ margin-right: 3;
51
+ }
52
+ """
53
+
54
+ def compose(self) -> ComposeResult:
55
+ with Vertical(id="main"):
56
+ yield Static("Welcome to claude tutor!", id="header")
57
+ yield RichLog(markup=True, highlight=True)
58
+ yield LoadingIndicator(id="spinner")
59
+ yield Input()
60
+ yield Footer()
61
+
62
+ async def on_mount(self) -> None:
63
+ self.query_one("#spinner", LoadingIndicator).display = False
64
+ await connect_client(self.client)
65
+
66
+ def write_user_message(self, message: str) -> None:
67
+ log = self.query_one(RichLog)
68
+ log.write(Panel(RichMarkdown(message), title="You", border_style="bright_blue"))
69
+
70
+ def write_system_message(self, message: str) -> None:
71
+ log = self.query_one(RichLog)
72
+ log.write(Panel(RichMarkdown(message), title="Claude", border_style="red"))
73
+
74
+ def write_tool_message(self, name: str, input: dict) -> None:
75
+ log = self.query_one(RichLog)
76
+ input_str = json.dumps(input, indent=2)
77
+ content = f"**{name}**\n```json\n{input_str}\n```"
78
+ log.write(Panel(RichMarkdown(content), title="Tool", border_style="grey50"))
79
+
80
+ def write_slash_message(self, message: str) -> None:
81
+ log = self.query_one(RichLog)
82
+ log.write(Panel(RichMarkdown(message), title="Slash", border_style="green"))
83
+
84
+ def on_input_submitted(self, event: Input.Submitted) -> None:
85
+ self.query_one(Input).value = ""
86
+ command = event.value.strip()
87
+ if command == "/clear":
88
+ self.run_worker(self.clear_conversation())
89
+ return
90
+ if command == "/tutor":
91
+ self.run_worker(self.toggle_tutor_mode())
92
+ return
93
+ self.write_user_message(event.value)
94
+ self.query_one("#spinner", LoadingIndicator).display = True
95
+ self.run_worker(self.get_response(event.value))
96
+
97
+ async def clear_conversation(self) -> None:
98
+ self.query_one(RichLog).clear()
99
+ self.client = create_claude_client(tutor_mode=self.tutor_mode)
100
+ await connect_client(self.client)
101
+ self.write_slash_message("Context cleared")
102
+
103
+ async def toggle_tutor_mode(self) -> None:
104
+ self.tutor_mode = not self.tutor_mode
105
+ self.query_one(RichLog).clear()
106
+ self.client = create_claude_client(tutor_mode=self.tutor_mode)
107
+ await connect_client(self.client)
108
+ status = "on" if self.tutor_mode else "off"
109
+ self.write_slash_message(f"Tutor mode {status}")
110
+
111
+ async def get_response(self, text: str) -> None:
112
+ try:
113
+ async for message in stream_helpful_claude(self.client, text):
114
+ if isinstance(message, AssistantMessage):
115
+ for block in message.content:
116
+ if hasattr(block, "text"):
117
+ self.write_system_message(block.text)
118
+ elif hasattr(block, "name"):
119
+ self.write_tool_message(
120
+ block.name, getattr(block, "input", {})
121
+ )
122
+ elif isinstance(message, ResultMessage):
123
+ pass # Might want to add logging later
124
+ finally:
125
+ self.query_one("#spinner", LoadingIndicator).display = False
126
+
127
+
128
+ def main():
129
+ app = MyApp()
130
+ app.run()
131
+
132
+
133
+ if __name__ == "__main__":
134
+ main()
@@ -0,0 +1,22 @@
1
+ [project]
2
+ name = "claude-sdk-tutor"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ dependencies = [
8
+ "claude-agent-sdk>=0.1.26",
9
+ "textual>=7.5.0",
10
+ "textual-dev>=1.8.0",
11
+ "watchfiles>=1.1.1",
12
+ ]
13
+
14
+ [project.scripts]
15
+ claude_tutor = "app:main"
16
+
17
+ [build-system]
18
+ requires = ["hatchling"]
19
+ build-backend = "hatchling.build"
20
+
21
+ [tool.hatch.build.targets.wheel]
22
+ packages = ["src/claude", "app.py"]
File without changes
File without changes
@@ -0,0 +1,29 @@
1
+ from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
2
+
3
+ TUTOR_SYSTEM_PROMPT = """You are a programming tutor. Your role is to help users learn and understand code, not to write code for them.
4
+
5
+ When a user asks a question:
6
+ - Explain concepts clearly and thoroughly
7
+ - Guide them toward understanding with questions and hints
8
+ - If they're stuck, provide small examples to illustrate concepts
9
+ - Encourage them to write the code themselves
10
+ - Review and explain code they show you, pointing out what works well and what could be improved
11
+
12
+ Never write complete solutions for them. Instead, help them develop the skills to solve problems independently."""
13
+
14
+
15
+ def create_claude_client(tutor_mode: bool = True) -> ClaudeSDKClient:
16
+ options = ClaudeAgentOptions(allowed_tools=["Read", "Glob", "Grep"])
17
+ if tutor_mode:
18
+ options.system_prompt = TUTOR_SYSTEM_PROMPT
19
+ return ClaudeSDKClient(options=options)
20
+
21
+
22
+ async def connect_client(client: ClaudeSDKClient) -> None:
23
+ await client.connect()
24
+
25
+
26
+ async def stream_helpful_claude(client: ClaudeSDKClient, text: str):
27
+ await client.query(prompt=text)
28
+ async for message in client.receive_response():
29
+ yield message