Skip to content

1995parham-teaching/python101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

220 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python 101

banner
GitHub Actions Workflow Status GitHub Actions Workflow Status

Introduction

This repository contains sample codes, presentation slides, and exercises for the Python 101 workshop. It covers Python fundamentals from basic syntax to advanced topics like async programming and testing.

Online Slides: https://1995parham-teaching.github.io/python101/

Repository Structure

python101/
├── src/                    # Python code examples
│   ├── 01-basics/          # Variables, flow control, functions
│   ├── 02-oop/             # Object-oriented programming
│   ├── 03-advanced-oop/    # Metaclasses, MRO, descriptors
│   ├── 04-functional/      # Functions, iterators, decorators
│   ├── 05-io-files/        # File I/O, pickling
│   ├── 06-networking/      # Socket programming
│   ├── 07-memory/          # Garbage collection, references
│   ├── 08-async/           # Async/await, asyncio
│   ├── 09-libraries/       # Popular libraries (requests, pathlib)
│   ├── 10-testing/         # pytest, mocking
│   └── 11-typing/          # Type hints, generics, dataclasses
├── slides/                 # Marp markdown slides
└── .github/workflows/      # CI/CD workflows

Course Curriculum

Week 1-2: Python Fundamentals

  • Basic syntax and data types
  • Flow control (if/else, loops)
  • Functions and lambda expressions
  • Object-oriented programming
  • Classes, inheritance, and MRO

Examples: src/01-basics/, src/02-oop/, src/03-advanced-oop/

Week 3: Libraries & Async Programming

  • File I/O and pathlib
  • Working with JSON
  • HTTP requests with requests library
  • Async programming with asyncio

Examples: src/05-io-files/, src/08-async/, src/09-libraries/

Week 4: Best Practices

  • Testing with pytest
  • Type hints and mypy
  • Code quality tools (ruff, black)
  • Design patterns

Examples: src/10-testing/, src/11-typing/

Getting Started

Prerequisites

  • Python 3.10 or higher
  • uv (Python package manager)

Setup

# Clone the repository
git clone https://github.com/1995parham-teaching/python101.git
cd python101

# Install dependencies (uv handles the virtual environment)
uv sync --all-extras

Running Examples

Each Python file in src/ is self-contained and can be run directly:

uv run python src/01-basics/flow-control.py
uv run python src/04-functional/iterators.py

Running Tests

# Run tests (pytest is included in dev dependencies)
uv run pytest src/10-testing/ -v

Building Slides

Marp Slides (HTML)

# Install Marp CLI
npm install -g @marp-team/marp-cli

# Build all slides
for file in slides/*.md; do
  marp "$file" --html
done

Presented At

  • 7th Amirkabir Linux Festival -- 2015
  • Diginext Software Engineering Bootcamp -- 2023
    • Monday, August 14, 2023 -- 18:00 - 20:30
    • Saturday, August 19, 2023 -- 18:00 - 20:30
    • Monday, August 21, 2023 -- 18:00 - 20:30
    • Saturday, August 26, 2023 -- 18:00 - 20:30
    • Monday, August 28, 2023 -- 18:00 - 20:30
    • Saturday, September 2, 2023 -- 18:00 - 20:30

Contributing

Thank you for your interest in contributing to Python 101! This section provides guidelines for contributing to this educational repository.

Ways to Contribute

1. Improve Existing Examples

  • Fix bugs or typos in code examples
  • Add clearer comments or explanations
  • Improve docstrings and documentation
  • Add expected output comments
  • Create additional exercises

2. Add New Content

  • New code examples demonstrating Python concepts
  • Additional slides for topics not covered
  • Translations of existing content

3. Report Issues

  • Report bugs in code examples
  • Suggest improvements or clarifications
  • Request new topics to be covered

Fork and Clone

# Fork the repository on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/python101.git
cd python101

# Add upstream remote
git remote add upstream https://github.com/1995parham-teaching/python101.git

Set Up Development Environment

# Install development dependencies (uv handles the virtual environment)
uv sync --all-extras

Create a Branch

git checkout -b feature/your-feature-name

Code Guidelines

Python Code Style

  • Follow PEP 8 style guidelines
  • Use meaningful variable and function names
  • Add type hints where appropriate
  • Include docstrings for modules, classes, and functions

Example File Template

Each Python file should follow this structure:

"""
Topic: [Topic Name]
Concepts: [comma-separated list of concepts]
Learning objectives:
    - [Objective 1]
    - [Objective 2]

Author: [Your name] ([your email])
"""
__author__ = "[Your name]"

# ... code ...

# === Expected Output ===
# [Expected output as comments]

# === Exercises ===
# 1. [Exercise 1]
# 2. [Exercise 2]

Commit Messages

  • Use clear, descriptive commit messages
  • Start with a verb (Add, Fix, Update, Remove)
  • Reference issues when applicable
Add async HTTP example with aiohttp

- Demonstrates concurrent URL fetching
- Includes error handling pattern
- Closes #123

Testing

Before submitting, ensure your code works:

# Run the Python file
uv run python src/path/to/your-file.py

# If adding tests, run pytest
uv run pytest src/10-testing/ -v

# Check types (if applicable)
uv run mypy src/path/to/your-file.py

Submitting Changes

  1. Push your branch to your fork
  2. Create a Pull Request against the main branch
  3. Provide a clear description of your changes
  4. Wait for review and address any feedback

Slide Contributions

Marp Slides

Slides are written in Markdown using Marp.

---
marp: true
theme: default
paginate: true
header: "Python 101"
footer: "Topic Name"
---

# Slide Title

Content here...

---

## Next Slide

More content...

Building Slides Locally

npm install -g @marp-team/marp-cli
marp slides/your-slide.md --html

Questions?

If you have questions about contributing, please:

  1. Check existing issues and pull requests
  2. Open a new issue for discussion
  3. Ask in the pull request

Thank you for helping improve Python education!

Special Thanks To

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Releases

No releases published

Packages

 
 
 

Contributors

Languages