Skip to content

sojinsamuel/python-persona

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Python Persona

Stop guessing what to learn. Start studying real code.

DEMO (Click the image to play video)

Python Persona

Why this app exists

Python Persona is a desktop app that analyzes any GitHub user's Python code and shows you who they are as a developer. You type a username, it fetches their repos, downloads their Python files, and shows you their frameworks, packages, features, and code patterns. Every data point links to the exact file and line on GitHub so you can study the real code.

I also built an AI learning roadmap feature. When you spot a topic you want to learn, you click it and the app builds a reverse dependency graph. It works backwards from your topic to the foundations, then teaches you step by step. This came from my own frustration with ChatGPT and Grok. They answer at whatever level they think is right, but often I cannot understand the answer because my foundation is not strong enough. This app fixes that by teaching prerequisites first.

The app also stores every analysis in Snowflake and compares your code against everyone you have studied. You see which packages you are missing, which features you have never used, and which repos from top developers you should study next.

Three tools in one app

01. Python Repository Insights — Enter a GitHub username. The app analyzes their public repos and shows their Python score, framework breakdown, top imports, feature usage (context managers, decorators, generators, dataclasses, type hints, async, and more), commit activity, achievements, and dev.to articles. Every data point links to the exact file and line on GitHub where the pattern appears.

02. AI Learning Roadmap — Click any topic in the report. The app builds a reverse dependency graph: it works backwards from your topic to the foundations, then presents a step-by-step learning path. Ask for generator expressions and you get Functions, Iterables, Iterators, Generator functions and yield, then Generator expressions. Each step has an excerpt, difficulty level, study time, common misconceptions, and curated resources with clickable links. Export the roadmap as PNG or PDF.

03. Insights Dashboard — Every analysis gets stored in your own Snowflake database. The dashboard aggregates all of them and compares your GitHub profile against every expert you have studied. See which packages everyone uses that you do not, which features you have zero usage of, and which repos from the top-scoring Pythonista you should study next.

🚀 Quick start

Prerequisites

  • Node.js 18+ and npm

  • Python 3.10+ (3.11+ recommended for full match-statement support)

  • The requests and snowflake-connector-python Python packages:

    pip install requests snowflake-connector-python
    # or use a venv:
    python3 -m venv .venv 
    source .venv/bin/activate 
    pip install requests snowflake-connector-python

Install & run

cd python-persona
npm install
npm start

The app window opens. On first launch you'll see a demo video modal — close it and start searching.

Add your API keys (recommended)

Without keys, the app works but with strict rate limits (60 GitHub req/hour shared across all users on your IP). Click the ⚙ Tokens button in the top-left:

Key Where to get it Why
GitHub Personal Access Token github.com/settings/tokens Bumps rate limit from 60 → 5000 req/hour. Only public_repo read scope needed.
dev.to API Key dev.to/settings/extensions Optional. Public articles work without it.
Google AI Studio API Key aistudio.google.com/app/apikey Powers the AI summary & roast. Free tier available. Without it, the app uses a local fallback roaster that's still pretty funny.

Keys are stored in ~/.config/python-persona/settings.json (Linux) and never leave your machine.

🎯 How to use

  1. Type a GitHub username in the search bar (e.g. getpelican, tiangolo, anthropics, psf).
  2. Watch the interactive loading screen — it streams progress as we fetch from GitHub, scan source files, parse ASTs, check dev.to, and generate the AI roast.
  3. Read the report — hero card with avatar + score, then a grid of cards:
    • 📁 Repositories (with language doughnut chart)
    • 🔥 Favorite Frameworks (with animated % bars)
    • 📦 Top Imports (medal podium)
    • 🧠 Python Features (15+ features detected via AST)
    • 📅 Activity (with bar chart)
    • 🏆 Achievements
    • 🤖 AI Summary
    • 😂 Roast Mode
    • 📰 dev.to Articles
    • 📚 Learning Opportunities
  4. Click any article link to open it in your default browser.
  5. Click "Refresh" to re-run the analysis (useful if they pushed new code).
  6. Click "New Search" to analyze a different user.

🏗️ Architecture

python-persona/
├── electron/
│   ├── main.js              # Electron main process (window, IPC, sidecar)
│   ├── preload.js           # IPC bridge to renderer
│   ├── screenshot.js        # Helper
│   └── demo-screenshot.js   # Helper
├── src/
│   ├── index.html           # App shell (4 views + 2 modals)
│   ├── styles/
│   │   ├── main.css         
│   │   ├── mac.css          
│   │   └── report.css       
│   └── js/
│       └── app.js           # All frontend logic (search, render, charts)
├── python/
│   ├── analyzer.py          # AST analyzer (imports, frameworks, features)
│   ├── github_fetch.py      # GitHub API client (repos, files, commits)
│   ├── devto_fetch.py       # dev.to API client (articles)
│   └── main.py              # Orchestrator (called by Electron, outputs JSON)
├── build/
│   └── icon.png             # App icon
└── package.json

Data flow:

  1. User types a username in the Electron UI
  2. Electron spawns python3 python/main.py as a child process
  3. Python script receives {username, github_token, devto_api_key, google_api_key} on stdin
  4. Python fetches the user's repos, filters for Python, downloads source files
  5. Python's ast module parses each file and the PythonAnalyzer walks the tree
  6. Python computes score, status, achievements, AI summary, AI roast
  7. Python streams progress events to stderr (Electron forwards them to the UI)
  8. Python prints the final JSON report to stdout
  9. Electron forwards the JSON to the renderer, which renders the visual report

🧪 Tests (Extras)

# Verify the Python analyzer
python3 python/analyzer.py

# Run the full pipeline against a real GitHub user (no token needed for first 60/hr)
echo '{"username":"getpelican","max_repos":5,"max_files_per_repo":3}' | python3 python/main.py

# Take screenshots of the UI (uses Xvfb)
node_modules/.bin/electron electron/demo-screenshot.js

📦 Package for distribution

npm run build          # builds both AppImage + .deb
npm run build:appimage # just AppImage (recommended - one file, no install)
npm run build:deb      # just .deb (for Debian/Ubuntu)

Output lands in release/. The AppImage is a single portable file — just chmod +x and double-click.

Note: End users need python3 and the requests package installed. The app spawns python3 from $PATH. To bundle Python too, consider python-shell + pythonia or shipping a PyInstaller-frozen binary of python/main.py.

🤝 For the DEV Weekend Challenge

This project was built for the Weekend Challenge: Passion Edition. The theme is "passion" — Python is my passion, and I've always learned the most by reading other people's Python code. This tool turns that learning process into a fun, roast-flavored experience.

Prize category submitted for: Best use of Google AI — the AI summary and roast are powered by Google AI Studio (Gemini 1.5 Flash) via the generativelanguage REST API.

🙏 Credits

  • Built with Electron, Chart.js, and Python's stdlib ast module.
  • GitHub data via the GitHub REST API.
  • Article data via the dev.to API.
  • AI summary & roast via Google AI Studio (Gemini 1.5 Flash).
  • Inspired by every Pythonista whose code I've ever read. Thank you. 🐍

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages