How jaygaha/python-beginner works
Project Type and Purpose
• This is an educational “cookbook” of Python code samples and demos, organized by topic (basics, DSA, OOP, concurrency, frameworks, GUI, etc.).
• It uses Docker (via .docker/python/Dockerfile + docker-compose.yml) to provide a reproducible Python 3 environment so students can run every example without installing anything on the host.
File Structure
• Top-level orchestration:
• .docker/python/Dockerfile – builds the Python runtime image
• docker-compose.yml – defines the service, volume mounts, port mappings
• pyproject.toml & workspace/requirements.txt – declare dependencies
• Core content:
• workspace/1_basic, workspace/2_dsa, workspace/3_oops, workspace/4_concurrency, workspace/7_framework, 99_PyQtGUI, etc. – each folder is a self-contained module of Python scripts.
• assets/ – static files (mp3, fonts) used by GUI or other demos.
• Entry points:
• workspace/main.py or root main.py to launch sample sets (if present).
• Framework demos expose HTTP endpoints (aiohttp, gevent, Pyramid, Dash) on mapped ports.
README for Additional Insights
• Emphasizes building and spinning up the container with:
docker compose build → docker compose up -d
• No external services beyond Docker and the Internet (for pip installs).
a. Main Components
1. Developer Machine (host)
2. Version Control System (Git)
3. Docker Compose Orchestration
4. Docker Engine
5. Python Container (built from .docker/python/Dockerfile)
6. Mounted Volumes:
– ./workspace → /app/workspace
– ./assets → /app/assets
7. Code Modules inside the container:
– Basic, DSA, OOP, Concurrency, Framework demos, GUI samples
8. Dependency Layer (pyproject.toml, requirements.txt)
9. Framework-specific subservices (HTTP servers in 7_framework/*)
10. Output files (e.g., logs, output*.txt, CSV/JSON in OOP exercises)
b. Relationships & Interactions
• Developer runs docker compose up → Compose reads docker-compose.yml → invokes Docker Engine
• Docker Engine builds the image via .docker/python/Dockerfile (pip installs from pyproject.toml + requirements.txt)
• Container starts, mounts workspace & assets as volumes
• Inside the container, Python scripts run on demand (CLI or HTTP servers for framework demos)
• HTTP ports exported (e.g., 8000, 8080) map back to the host, enabling web-based demos
• Scripts write outputs back to the mounted volume so host can inspect them
c. Architectural Patterns & Principles
• Containerization for environment consistency
• Single-service container pattern (one container runs all examples)
• Modularity: each topic folder is a logical subsystem with its own examples
• Volume-based code/dependency separation (code lives outside the image, making iteration fast)
d. Technologies & Frameworks
• Docker & Docker Compose
• Python 3.x (managed by pyproject.toml)
• Web frameworks: aiohttp, gevent HTTP server, Pyramid, Plotly Dash
• GUI: PyQt5/6 (99_PyQtGUI), using assets for media/fonts
• Concurrency modules: threading, multiprocessing, asyncio demos