Skip to content

hashkanna/python-systems-interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python Systems Interview Lab

A production-grade Python interview practice platform with 82 problems focused on real-world Python skills, not algorithms.

🎯 What Makes This Different

Not another LeetCode clone. This platform focuses on:

  • βœ… Python-specific features (Type Hints, Decorators, Context Managers)
  • βœ… Standard library mastery (functools, itertools, collections)
  • βœ… Production patterns (Pydantic, pytest, async/await)
  • βœ… Real-world scenarios (log parsing, config validation, API rate limiting)

No algorithm grinding. Use LeetCode for that. This is for Python mastery.

πŸš€ Quick Start

Run the Platform

Easy way (recommended):

./scripts/dev.sh
# Automatically starts both backend and frontend
# Open http://localhost:5173

Manual way (two terminals):

# Terminal 1: Start backend
cd server
uvicorn main:app --reload

# Terminal 2: Start frontend
cd ui
npm run dev

# Open http://localhost:5173

Try a Problem

  1. Click any problem in the sidebar
  2. Write your solution in the Monaco editor
  3. Run tests to get instant feedback
  4. Get hints for failing tests
  5. Move to the next problem

πŸ“Š Current Problems (82)

Categories Include

  • Functools - partial, lru_cache, singledispatch, reduce
  • Itertools - groupby, combinations, chain, accumulate
  • Generators & Coroutines - yield, send, async patterns
  • Type Hints - TypedDict, Protocols, Generics
  • Decorators - retry logic, memoization, validation
  • Testing - pytest fixtures, mocking, parametrize
  • Collections - Counter, defaultdict, ChainMap
  • Context Managers - custom contexts, contextlib
  • Async/Await - asyncio, concurrent patterns
  • File I/O - JSON/CSV parsing, log processing
  • Pattern Matching - structural pattern matching
  • ABC & Enums - abstract base classes, enumerations
  • And more...

✨ Features

πŸ” Advanced Filtering

  • Search by problem name
  • Filter by difficulty (Easy, Medium, Hard)
  • Filter by categories (multiple selection)
  • Real-time filter updates

πŸ“ Rich Editor

  • Monaco Editor (VS Code editor)
  • Python syntax highlighting
  • Auto-completion
  • Minimap navigation

βœ… Comprehensive Testing

  • Public tests (visible before solving)
  • Hidden tests (revealed after passing)
  • Detailed error messages
  • Helpful hints for debugging

🎨 Modern UI

  • Dark theme optimized for coding
  • Syntax highlighting for example code blocks
  • Clickable category badges for quick filtering
  • Semantic markdown headers for better structure
  • Resizable editor/problem panels
  • Progress tracking with URL-based state

πŸ“š Documentation

For Users

For Contributors

See documentation above for:

  • Problem structure and patterns
  • Category guidelines
  • Test case best practices
  • Using Claude/Codex to generate problems

πŸ› οΈ Tech Stack

Backend

  • FastAPI - Modern Python web framework
  • Python 3.11+ - Type hints, pattern matching
  • uvicorn - ASGI server

Frontend

  • React + TypeScript
  • Vite - Fast builds
  • Monaco Editor - VS Code editor component

πŸ“ˆ Roadmap

Current: 82 problems βœ… Goal: 100+ problems

Completed Categories βœ…

  • Functools (partial, lru_cache, singledispatch)
  • Itertools (groupby, combinations, chain)
  • Generators & Coroutines
  • pytest fixtures & mocking
  • Type hints & Protocols
  • Pattern matching
  • ABC & Enums

Future Additions

  • Pydantic advanced validation
  • More async/await patterns
  • subprocess management
  • Regular expressions
  • Dataclasses advanced features

How to Add Problems

Option 1: Ask Claude (me!)

I need 10 problems for [categories].
See docs/ADDING_PROBLEMS.md for structure.
Generate complete Python code for python_advanced_problems.py

Option 2: Use Codex/Copilot

# Open problems/python_advanced_problems.py
# Add comment describing what you want
# Let Copilot generate the code
# Review and adjust

Option 3: Manual

  1. Copy docs/PROBLEM_TEMPLATE.py
  2. Fill in placeholders
  3. Add to problems/python_advanced_problems.py
  4. Update NEW_PROBLEMS list
  5. Test in UI

πŸŽ“ Problem Categories

Core Python (Use These!)

Type System: Type Hints, TypedDict, Protocols, Generics, Literal, Union Types Decorators: Decorators, functools, Closures Context: Context Managers, contextlib Collections: Counter, defaultdict, deque, ChainMap, namedtuple Iteration: Generators, Iterators, itertools, Comprehensions Validation: Pydantic, Data Classes Async: Async/Await, asyncio, Threading, concurrent.futures I/O: File I/O, pathlib, JSON, CSV, Logging Testing: pytest, Mocking, Fixtures Other: Error Handling, Datetime, Regular Expressions, subprocess

❌ Avoid (Use LeetCode)

Algorithms, Graph Algorithms, Binary Search, Dynamic Programming, etc.

🀝 Contributing Problems

  1. Read the docs - See ADDING_PROBLEMS.md
  2. Use the template - Copy PROBLEM_TEMPLATE.py
  3. Follow categories - Reference CATEGORIES.md
  4. Test thoroughly - Run in UI before committing
  5. Focus on Python - Real-world, production-realistic scenarios

Quality Checklist

  • Realistic production scenario
  • Comprehensive docstring
  • 3-4 test cases (at least 1 hidden)
  • Helpful hints in failing tests
  • Python-specific categories
  • Proper difficulty level
  • Works in UI

πŸ“ Example Problem

def _build_retry_decorator_problem() -> Problem:
    """Retry decorator with exponential backoff."""

    starter_code = (
        "from functools import wraps\n\n"
        "def retry(max_attempts=3, backoff_factor=2.0):\n"
        "    \"\"\"Decorator that retries on failure.\"\"\"\n"
        "    raise NotImplementedError\n"
    )

    def run_tests(solution_module):
        # Test 1: Succeeds first try
        # Test 2: Retries and succeeds
        # Test 3: Exhausts retries
        # Test 4: Exponential backoff timing
        ...

    return Problem(
        slug="retry_decorator",
        title="Retry Decorator with Exponential Backoff",
        difficulty="medium",
        description="Network calls fail. Build retry logic...",
        categories=["Decorators", "Error Handling", "functools"]
    )

πŸ—οΈ Project Structure

interview-prep/
β”œβ”€β”€ server/              # FastAPI backend
β”‚   └── main.py         # API endpoints
β”œβ”€β”€ ui/                 # React frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ App.tsx     # Main component with filters
β”‚       └── api.ts      # API client
β”œβ”€β”€ problems/           # Problem definitions
β”‚   β”œβ”€β”€ problem_bank.py          # Core problems
β”‚   └── python_advanced_problems.py  # New Python problems
β”œβ”€β”€ docs/               # Documentation
β”‚   β”œβ”€β”€ ADDING_PROBLEMS.md      # How to add problems
β”‚   β”œβ”€β”€ PROBLEM_TEMPLATE.py     # Template
β”‚   └── CATEGORIES.md           # Category reference
└── README.md           # This file

πŸ§ͺ Testing

Backend Tests

cd server
pytest

Frontend Tests

cd ui
npm test

Manual Testing

  1. Start both servers
  2. Open http://localhost:5173
  3. Try solving a problem
  4. Verify tests run correctly
  5. Check filtering works

πŸ› Troubleshooting

Backend won't start

# Check Python version
python3 --version  # Need 3.11+

# Install dependencies
pip install -r requirements.txt

Frontend won't start

# Check Node version
node --version  # Need 16+

# Install dependencies
npm install

Categories not showing

# Restart backend - categories are auto-discovered
cd server
uvicorn main:app --reload

Problem not appearing

  1. Check it's in NEW_PROBLEMS list
  2. Restart backend
  3. Clear browser cache
  4. Check browser console for errors

πŸ’‘ Tips

For Problem Solvers

  • Read the full problem description
  • Check the function signature carefully
  • Use the hints when tests fail
  • Test edge cases yourself
  • Ask for help if stuck

For Problem Creators

  • Focus on production scenarios
  • Include realistic data
  • Write comprehensive tests
  • Provide helpful hints
  • Use Python-specific categories

πŸ“– Learning Resources

🎯 Goals

  • Build filtering UI (search, categories, difficulty)
  • Create 12 high-quality problems
  • Write comprehensive documentation
  • Reach 25-30 problems
  • Add Pydantic problems
  • Add async/await problems
  • Add pytest/mocking problems
  • Reach 100+ problems

πŸ™ Credits

Built with:


Ready to add problems? Start with docs/ADDING_PROBLEMS.md

Need help? Ask Claude or use the problem template!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •