Skip to content

Refactor: modular project with uv, Typer CLI, Streamlit, and Pydantic#3

Open
scottfrasso wants to merge 3 commits intocoffeethencode:mainfrom
scottfrasso:refactor/modular-project-with-streamlit
Open

Refactor: modular project with uv, Typer CLI, Streamlit, and Pydantic#3
scottfrasso wants to merge 3 commits intocoffeethencode:mainfrom
scottfrasso:refactor/modular-project-with-streamlit

Conversation

@scottfrasso
Copy link
Copy Markdown
Collaborator

@scottfrasso scottfrasso commented Apr 2, 2026

Summary

Breaks the monolithic 767-line pipeline.py into a proper Python package with modern tooling and an interactive Streamlit dashboard for data exploration.

  • uv + pyproject.toml replaces zero-dep stdlib approach with managed dependencies
  • Typer CLI with run, explore, serve, and cache-clear commands
  • Pydantic models for data validation (CleanedRecord, DashboardStats)
  • Streamlit app with folium heatmap + plotly charts for interactive local exploration
  • python-dateutil for robust datetime parsing (replaces manual format loops)
  • Caching layer in tmp/ to avoid slow CKAN API re-fetches during development
  • ruff + mypy (strict) for linting and type checking
  • lefthook for pre-commit hooks (ruff + mypy)
  • CI split: all check jobs run in parallel with an all-checks-pass gate
  • pydantic-ai added as dependency for future AI agent work
  • Static HTML generation preserved for GitHub Pages deployment

Streamlit Dashboard

Streamlit Dashboard

New CLI

$ uv run boston-needle-map --help

 Usage: boston-needle-map [OPTIONS] COMMAND [ARGS]...

 Boston 311 Needle Hotspot Pipeline

╭─ Commands ──────────────────────────────────────╮
│ run          Fetch + compute + generate HTML    │
│ explore      Launch Streamlit dashboard         │
│ cache-clear  Clear tmp/ cache                   │
│ serve        Preview docs/ locally              │
╰─────────────────────────────────────────────────╯

Test plan

  • uv sync installs all dependencies
  • uv run boston-needle-map run generates docs/index.html and docs/needle_data.json
  • uv run boston-needle-map explore launches Streamlit with heatmap and charts
  • uv run boston-needle-map cache-clear clears tmp/ cache
  • uv run ruff check src/ passes clean
  • uv run mypy src/ passes strict mode
  • lefthook install && git commit runs pre-commit hooks
  • CI workflow runs all checks in parallel with gate job

🤖 Generated with Claude Code

scottfrasso and others added 3 commits April 2, 2026 17:10
…ydantic

Break the monolithic 767-line pipeline.py into a proper Python package with
modular architecture, modern tooling, and an interactive Streamlit dashboard
for data exploration.

- Set up uv with pyproject.toml (replaces zero-dep stdlib approach)
- Add Typer CLI with run, explore, serve, and cache-clear commands
- Add Pydantic models for data validation (CleanedRecord, DashboardStats)
- Add pydantic-ai as dependency for future AI agent work
- Add Streamlit app with folium heatmap and plotly charts
- Add python-dateutil for robust datetime parsing
- Add caching layer in tmp/ to avoid slow CKAN API re-fetches
- Configure ruff + mypy (strict) for linting and type checking
- Set up lefthook for pre-commit hooks
- Split CI: parallel jobs with all-checks-pass gate
- Update README with new setup and usage instructions
- Add CLAUDE.md project guide
- Extract HTML template to templates/dashboard.html

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pytest exits with code 5 (no tests collected) when the test directory
is empty, which fails the CI check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant