From 13ea156fb1a9695bfbc7fc66c868f8d8c36d7bce Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Sat, 8 Nov 2025 18:47:02 -0500 Subject: [PATCH] fix: Simplify book deployment workflow and remove legacy convert_readmes dependency --- .github/workflows/deploy-book.yml | 15 ++++--------- tito/commands/book.py | 37 +++++++++++-------------------- 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/.github/workflows/deploy-book.yml b/.github/workflows/deploy-book.yml index b66cd9bc..15ffe16e 100644 --- a/.github/workflows/deploy-book.yml +++ b/.github/workflows/deploy-book.yml @@ -47,20 +47,13 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install jupyter-book jupytext pytest + pip install jupyter-book pip install -r book/requirements.txt - pip install -r requirements.txt # Install main project dependencies - pip install -e . # Install tito CLI - - name: Generate content and build book + - name: Build Jupyter Book run: | - # Create and activate virtual environment for tito - python -m venv .venv - source .venv/bin/activate - pip install -r requirements.txt # Install all dependencies including rich - pip install -e . # Install tito CLI in virtual environment - # Use tito to generate content and build book - python -m tito.main book build + cd book + jupyter-book build . - name: Upload book artifact uses: actions/upload-pages-artifact@v3 diff --git a/tito/commands/book.py b/tito/commands/book.py index a0182f34..e5a79e1c 100644 --- a/tito/commands/book.py +++ b/tito/commands/book.py @@ -150,34 +150,23 @@ class BookCommand(BaseCommand): os.chdir("..") def _generate_all(self) -> int: - """Convert READMEs to Jupyter Book chapters.""" + """Verify that all book chapters exist.""" console = self.console - console.print("🔄 Converting module READMEs to Jupyter Book chapters...") + console.print("📝 Verifying book chapters...") - # Step 1: Convert READMEs to chapters - console.print("📝 Step 1: Converting READMEs to chapters...") - try: - os.chdir("book") - result = subprocess.run([ - "python3", "convert_readmes.py" - ], capture_output=True, text=True) - - if result.returncode == 0: - console.print(" ✅ All READMEs converted to chapters") - # Show summary from the output - for line in result.stdout.split('\n'): - if "✅ Created" in line or "🎉 Converted" in line: - console.print(f" {line.strip()}") - else: - console.print(f" ❌ Failed to convert READMEs: {result.stderr}") - return 1 - except Exception as e: - console.print(f"[red]❌ Error converting READMEs: {e}[/red]") + # Check that the chapters directory exists + chapters_dir = Path("book/chapters") + if not chapters_dir.exists(): + console.print("[red]❌ book/chapters directory not found[/red]") return 1 - finally: - os.chdir("..") - console.print("✅ Chapters generated successfully") + # Count markdown files in chapters directory + chapter_files = list(chapters_dir.glob("*.md")) + if chapter_files: + console.print(f"✅ Found {len(chapter_files)} chapter files") + else: + console.print("[yellow]⚠️ No chapter files found in book/chapters/[/yellow]") + return 0 def _build_book(self, args: Namespace) -> int: