Skip to content

Commit 1165105

Browse files
feat: Phase 4 PyPI packaging, setup wizard, Homebrew formula
Prepare studyctl for distribution (local only — not published yet): - pyproject.toml: version 2.0.0, PEP 639 license, classifiers, keywords, project-urls, [all] meta-extra - Build verified: uv build --package studyctl --no-sources produces valid wheel with all packages, entry points, and metadata - studyctl setup: interactive first-run wizard (5 steps: study path, AI assistant, NotebookLM, Obsidian, write config). 18 tests. - Formula/studyctl.rb: Homebrew formula draft for personal tap (NetDevAutomate/studyctl) with Language::Python::Virtualenv - .github/workflows/publish.yml: OIDC trusted publishing workflow (no API tokens needed) - scripts/install.sh: detect Homebrew and suggest tap, update next steps to reference studyctl setup 611 tests pass, 4 skipped, 0 failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eab3bf7 commit 1165105

9 files changed

Lines changed: 627 additions & 7 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Publish studyctl to PyPI using OIDC Trusted Publishing (no API tokens needed).
2+
# Trigger: create a GitHub release tagged v2.x.x
3+
#
4+
# Setup once on PyPI:
5+
# 1. Go to https://pypi.org/manage/project/studyctl/settings/publishing/
6+
# 2. Add GitHub as trusted publisher:
7+
# - Owner: NetDevAutomate
8+
# - Repository: Socratic-Study-Mentor
9+
# - Workflow: publish.yml
10+
# - Environment: (leave blank)
11+
12+
name: Publish to PyPI
13+
14+
on:
15+
release:
16+
types: [published]
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v4
29+
30+
- name: Build package
31+
run: uv build --package studyctl --no-sources
32+
33+
- name: Upload artifact
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: dist
37+
path: dist/
38+
39+
publish:
40+
needs: build
41+
runs-on: ubuntu-latest
42+
permissions:
43+
id-token: write # OIDC for PyPI trusted publishing
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/project/studyctl/
47+
steps:
48+
- name: Download artifact
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: dist
52+
path: dist/
53+
54+
- name: Publish to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
# No API token needed -- uses OIDC

‎Formula/studyctl.rb‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Homebrew formula for studyctl
2+
# Install: brew install NetDevAutomate/studyctl/studyctl
3+
# Tap: brew tap NetDevAutomate/studyctl
4+
#
5+
# This formula is for a personal tap (not homebrew-core).
6+
# Resource stanzas can be auto-generated with:
7+
# brew update-python-resources Formula/studyctl.rb
8+
9+
class Studyctl < Formula
10+
include Language::Python::Virtualenv
11+
12+
desc "AuDHD-aware study tool with AI Socratic mentoring and spaced repetition"
13+
homepage "https://github.com/NetDevAutomate/Socratic-Study-Mentor"
14+
url "https://files.pythonhosted.org/packages/source/s/studyctl/studyctl-2.0.0.tar.gz"
15+
sha256 "PLACEHOLDER_SHA256"
16+
license "MIT"
17+
18+
depends_on "python@3.12"
19+
20+
# Resource stanzas generated by: brew update-python-resources Formula/studyctl.rb
21+
# Core deps: click, rich, pyyaml
22+
# Run `brew update-python-resources` after publishing to PyPI to populate these.
23+
24+
def install
25+
virtualenv_install_with_resources
26+
end
27+
28+
def caveats
29+
<<~EOS
30+
studyctl is installed! Get started:
31+
studyctl setup
32+
33+
Optional system dependencies for full functionality:
34+
brew install pandoc # Obsidian markdown to PDF conversion
35+
npm install -g @mermaid-js/mermaid-cli # Mermaid diagram rendering
36+
37+
Optional Python extras:
38+
uv pip install 'studyctl[web]' # FastAPI web UI
39+
uv pip install 'studyctl[tui]' # Terminal dashboard
40+
uv pip install 'studyctl[content]' # PDF splitting (pymupdf)
41+
uv pip install 'studyctl[mcp]' # MCP agent integration
42+
uv pip install 'studyctl[notebooklm]' # NotebookLM API
43+
uv pip install 'studyctl[all]' # Everything
44+
45+
MCP server for AI assistants:
46+
claude mcp add studyctl-mcp
47+
EOS
48+
end
49+
50+
test do
51+
assert_match "studyctl", shell_output("#{bin}/studyctl --version")
52+
assert_match "Usage:", shell_output("#{bin}/studyctl --help")
53+
end
54+
end

‎packages/studyctl/pyproject.toml‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
[project]
22
name = "studyctl"
3-
version = "1.0.0"
4-
description = "AuDHD study pipeline: Obsidian → NotebookLM sync, spaced repetition, study plan management"
3+
version = "2.0.0"
4+
description = "AuDHD-aware study tool with AI Socratic mentoring, spaced repetition, and content pipeline"
55
requires-python = ">=3.12"
66
readme = "README.md"
77
license = "MIT"
88
authors = [{name = "Andy Taylor"}]
9+
keywords = ["study", "flashcards", "spaced-repetition", "audhd", "adhd", "socratic", "notebooklm"]
10+
classifiers = [
11+
"Development Status :: 4 - Beta",
12+
"Environment :: Console",
13+
"Environment :: Web Environment",
14+
"Intended Audience :: Education",
15+
"Topic :: Education",
16+
"Programming Language :: Python :: 3.12",
17+
"Programming Language :: Python :: 3.13",
18+
]
919
dependencies = [
1020
"click>=8.1",
1121
"rich>=13.0",
@@ -18,6 +28,7 @@ notebooklm = ["notebooklm-py>=0.3.4"]
1828
tui = ["textual>=0.80"]
1929
web = ["fastapi>=0.115", "uvicorn[standard]>=0.34"]
2030
mcp = ["mcp[cli]>=1.0.0"]
31+
all = ["studyctl[content,web,notebooklm,tui,mcp]"]
2132

2233
[project.scripts]
2334
studyctl = "studyctl.cli:cli"
@@ -27,6 +38,7 @@ studyctl-mcp = "studyctl.mcp.server:main"
2738
Homepage = "https://github.com/NetDevAutomate/Socratic-Study-Mentor"
2839
Repository = "https://github.com/NetDevAutomate/Socratic-Study-Mentor"
2940
Issues = "https://github.com/NetDevAutomate/Socratic-Study-Mentor/issues"
41+
Documentation = "https://github.com/NetDevAutomate/Socratic-Study-Mentor/tree/main/docs"
3042

3143
[build-system]
3244
requires = ["hatchling"]

‎packages/studyctl/src/studyctl/cli/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"dedup": "studyctl.cli._sync:dedup",
2323
# _state.py — cross-machine state
2424
"state": "studyctl.cli._state:state_group",
25+
# _setup.py — first-run setup wizard
26+
"setup": "studyctl.cli._setup:setup",
2527
# _config.py — configuration
2628
"config": "studyctl.cli._config:config_group",
2729
# _schedule.py — job scheduling + calendar
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
"""Setup wizard — first-run configuration for studyctl.
2+
3+
Guides users through the essential configuration questions one at a time.
4+
Designed to be AuDHD-friendly: clear steps, no overwhelming walls of text,
5+
sensible defaults so pressing Enter always works.
6+
"""
7+
8+
from __future__ import annotations
9+
10+
import contextlib
11+
import subprocess
12+
from pathlib import Path
13+
14+
import click
15+
import yaml
16+
17+
from studyctl.cli._shared import console
18+
from studyctl.settings import CONFIG_DIR
19+
20+
21+
def _validate_path(value: str) -> Path:
22+
"""Expand user and return a Path; raise UsageError if obviously invalid."""
23+
p = Path(value).expanduser()
24+
return p
25+
26+
27+
@click.command(name="setup")
28+
def setup() -> None:
29+
"""First-run setup wizard — configure studyctl in under 2 minutes."""
30+
31+
# ------------------------------------------------------------------
32+
# Banner
33+
# ------------------------------------------------------------------
34+
console.print()
35+
console.print("[bold cyan]studyctl setup[/bold cyan]")
36+
console.print(
37+
"studyctl is your AuDHD study pipeline: it syncs Obsidian notes to "
38+
"NotebookLM, tracks spaced-repetition reviews, and schedules focused "
39+
"study sessions.\n"
40+
)
41+
console.print("[dim]Press Enter to accept the default shown in brackets.[/dim]\n")
42+
43+
config: dict = {}
44+
45+
# ------------------------------------------------------------------
46+
# Step 1 — Study materials directory
47+
# ------------------------------------------------------------------
48+
console.print("[bold]Step 1 of 5[/bold] Where do you store course materials (PDFs, slides)?")
49+
materials_raw = click.prompt(
50+
"Study materials path",
51+
default="~/study-materials",
52+
)
53+
materials_path = _validate_path(materials_raw)
54+
config["content"] = {"base_path": str(materials_raw)}
55+
console.print(f" [dim]Will use: {materials_path}[/dim]\n")
56+
57+
# ------------------------------------------------------------------
58+
# Step 2 — AI coding assistant / MCP registration
59+
# ------------------------------------------------------------------
60+
console.print("[bold]Step 2 of 5[/bold] Do you use an AI coding assistant?")
61+
console.print(" [dim](Claude Code, Kiro, Gemini CLI, etc.)[/dim]")
62+
has_ai = click.confirm(" Use an AI assistant?", default=True)
63+
if has_ai:
64+
assistant = click.prompt(
65+
" Which one",
66+
default="claude-code",
67+
type=click.Choice(
68+
["claude-code", "kiro", "gemini-cli", "other"],
69+
case_sensitive=False,
70+
),
71+
show_choices=True,
72+
)
73+
config["ai_assistant"] = assistant
74+
console.print(
75+
f" [dim]Noted. Run 'studyctl config init' to install agent definitions "
76+
f"for {assistant}.[/dim]\n"
77+
)
78+
else:
79+
console.print(" [dim]No problem — studyctl works fine as a standalone CLI.[/dim]\n")
80+
81+
# ------------------------------------------------------------------
82+
# Step 3 — NotebookLM
83+
# ------------------------------------------------------------------
84+
console.print("[bold]Step 3 of 5[/bold] Do you use Google NotebookLM?")
85+
console.print(" [dim](Optional — enables audio overview generation from your notes)[/dim]")
86+
use_nlm = click.confirm(" Enable NotebookLM integration?", default=False)
87+
config["notebooklm"] = {"enabled": use_nlm}
88+
if use_nlm:
89+
console.print(
90+
" [dim]NotebookLM enabled. You'll need a Google account"
91+
" with NotebookLM access.[/dim]\n"
92+
)
93+
else:
94+
console.print(" [dim]Skipped — you can enable this later in config.yaml.[/dim]\n")
95+
96+
# ------------------------------------------------------------------
97+
# Step 4 — Obsidian vault
98+
# ------------------------------------------------------------------
99+
console.print("[bold]Step 4 of 5[/bold] Where is your Obsidian vault?")
100+
console.print(" [dim](Optional — enables note sync and spaced repetition)[/dim]")
101+
use_obsidian = click.confirm(" Configure Obsidian integration?", default=True)
102+
if use_obsidian:
103+
obsidian_raw = click.prompt(" Obsidian vault path", default="~/Obsidian")
104+
obsidian_path = _validate_path(obsidian_raw)
105+
config["obsidian_base"] = str(obsidian_raw)
106+
if not obsidian_path.exists():
107+
console.print(
108+
f" [yellow]Note: {obsidian_path} does not exist yet. "
109+
f"Create it before running sync.[/yellow]\n"
110+
)
111+
else:
112+
console.print(f" [green]Found vault at {obsidian_path}[/green]\n")
113+
else:
114+
console.print(" [dim]Skipped — you can set obsidian_base in config.yaml later.[/dim]\n")
115+
116+
# ------------------------------------------------------------------
117+
# Step 5 — Write config
118+
# ------------------------------------------------------------------
119+
console.print("[bold]Step 5 of 5[/bold] Writing configuration...")
120+
121+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
122+
config_path = CONFIG_DIR / "config.yaml"
123+
124+
# Preserve any existing keys by loading first, then merging
125+
existing: dict = {}
126+
if config_path.exists():
127+
with contextlib.suppress(yaml.YAMLError):
128+
existing = yaml.safe_load(config_path.read_text()) or {}
129+
130+
# New values take precedence over existing
131+
merged = {**existing, **config}
132+
# Nested dicts: merge content and notebooklm sub-keys
133+
for key in ("content", "notebooklm"):
134+
if key in existing and key in config and isinstance(existing[key], dict):
135+
merged[key] = {**existing[key], **config[key]}
136+
137+
config_path.write_text(yaml.dump(merged, default_flow_style=False, sort_keys=False))
138+
139+
console.print(f"\n[bold green]Configuration saved to {config_path}[/bold green]")
140+
141+
# ------------------------------------------------------------------
142+
# Offer to launch web UI
143+
# ------------------------------------------------------------------
144+
console.print()
145+
launch = click.confirm("Launch the studyctl web UI now?", default=False)
146+
if launch:
147+
console.print("[dim]Starting web UI on http://localhost:8000 ...[/dim]")
148+
try:
149+
subprocess.Popen(
150+
["studyctl", "web"],
151+
stdout=subprocess.DEVNULL,
152+
stderr=subprocess.DEVNULL,
153+
)
154+
console.print(
155+
"[green]Web UI started. Open http://localhost:8000 in your browser.[/green]"
156+
)
157+
except FileNotFoundError:
158+
console.print("[yellow]Could not launch web UI. Run 'studyctl web' manually.[/yellow]")
159+
else:
160+
console.print("\n[bold]You're all set.[/bold] Next steps:")
161+
console.print(" studyctl config show — review your configuration")
162+
console.print(" studyctl review — see what topics are due for review")
163+
console.print(" studyctl web — open the web UI")
164+
console.print(" studyctl --help — explore all commands")

‎packages/studyctl/tests/test_cli.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_version_exits_zero(self, runner: CliRunner) -> None:
5050

5151
def test_version_contains_studyctl(self, runner: CliRunner) -> None:
5252
result = runner.invoke(cli, ["--version"])
53-
assert "studyctl" in result.output.lower() or "1." in result.output
53+
assert "version" in result.output.lower()
5454

5555

5656
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)