Skip to content

Overview

Python is a versatile and powerful programming language that is widely used in various domains, including web development, data science, machine learning, automation, and more. It is known for its simplicity and readability, making it an excellent choice for both beginners and experienced developers.

  1. Install Scoop

    Open PowerShell and run:

    Terminal window
    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    irm get.scoop.sh | iex

    Official site: https://scoop.sh

  2. Install uv

    Terminal window
    scoop install uv
  3. Verify installation

    Terminal window
    uv --version
  4. Install Python

    Terminal window
    uv python install 3.12

Terminal window
uv init my-project # create project
uv venv # create virtual environment
uv pip install <package> # install package
uv pip uninstall <pkg> # remove package
uv pip freeze # list installed packages
uv run python main.py # run script
uv pip compile # lock dependencies
uv pip sync # install exact dependencies
uv pip show <package> # show package info
uv run --python <version> <command> # run command with specific Python version

Start your journey by understanding how Python works and how to run your code.

  • Python overview: simple, readable, beginner-friendly
  • Installation & setup using uv
  • Running code:
    • REPL (interactive shell)
    • Script execution (.py files)
print("Hello, World!")

Organize your code effectively for better maintainability.

my_project/
├── pyproject.toml # Project config (uv + dependencies)
├── uv.lock # Auto-generated lock file
├── README.md
├── .gitignore
├── .env # Environment variables
├── src/ # Main source code (recommended layout)
│ └── my_project/
│ ├── **init**.py
│ ├── main.py # Entry point
│ │
│ ├── core/ # Core logic (business logic)
│ │ ├── **init**.py
│ │ └── config.py # Settings, env handling
│ │
│ ├── services/ # External interactions / logic layer
│ │ ├── **init**.py
│ │ └── api.py
│ │
│ ├── models/ # Data models
│ │ ├── **init**.py
│ │ └── user.py
│ │
│ ├── utils/ # Helper functions
│ │ ├── **init**.py
│ │ └── helpers.py
│ │
│ └── db/ # Database layer
│ ├── **init**.py
│ └── sqlite.py
├── tests/ # Testing (pytest)
│ ├── **init**.py
│ ├── test_main.py
│ ├── test_services.py
│ └── conftest.py # Fixtures
├── scripts/ # CLI / automation scripts
│ └── run.py
└── logs/ # Log files (optional)

Everything in Python is an object. Understanding data types is fundamental.

  • Numeric types: int, float, bool
  • Strings: str
  • Collections:
    • list (ordered, mutable)
    • tuple (ordered, immutable)
    • set (unique elements)
    • dict (key-value pairs)
  • Type conversion: int(), str(), etc.

Control the flow of your program using conditions.

  • if, elif, else — decision making
  • Nested conditions — complex logic
  • Logical operators: and, or, not — boolean expressions
  • Ternary operators — inline conditionals
  • Best practices — writing readable conditions

Automate repetitive tasks efficiently.

  • for loop (iterate over sequences)
  • while loop (condition-based loop)
  • Control statements:
    • break → exit loop
    • continue → skip iteration
    • pass → placeholder

Functions help organize and reuse code.

  • Defining functions using def — code organization
  • Parameters and return values — function interface
  • Default arguments — flexible API design
  • Variable arguments: *args, **kwargs — flexible parameters
  • Recursion — functional problem-solving
  • Lambda functions — anonymous functions for simple tasks
  • Command-line arguments — script input
  • Higher-order functions: map(), filter(), reduce() — functional programming
  • Scope & variable resolution — LEGB rule
  • Docstrings — professional documentation

Write concise and readable transformations.

  • List comprehension
  • Dictionary comprehension
  • Set comprehension
  • Generator expressions (lazy evaluation)

Advanced concepts for efficient and clean code.

  • Generators:
    • Use yield to produce values lazily
    • Memory efficient iteration
  • Generator expressions
  • Decorators:
    • Modify function behavior
    • Function wrapping
    • Real-world use cases (logging, auth)

Structure programs using objects and classes for maintainability and scalability.

  • Classes & objects — foundational concepts
  • __init__ constructor — initialization
  • Instance vs class variables — object state
  • Methods — object behavior
  • Encapsulation — data hiding & protection
  • Inheritance — code reuse through hierarchy
  • Polymorphism — method overriding & flexibility
  • Abstraction — hiding complexity
  • Magic methods: __str__, __repr__, __len__ — special behavior
  • Property decorators — getters & setters
  • dataclasses — cleaner model definitions
  • Metaclasses — class creation patterns

Handle real-world data and errors safely and professionally.

  • File handling operations:
    • Read/write files with context managers
    • Working with text, binary, and CSV files
    • File I/O best practices
  • Exception handling:
    • try, except, finally blocks
    • Exception types & hierarchy
    • Custom exceptions for domain logic
    • Proper error recovery
    • Logging strategies

Essential built-in and widely used libraries for production code:

System & File Operations:

  • os → file system operations, environment variables
  • sys → system interaction, command-line arguments
  • pathlib → modern, object-oriented file handling
  • shutil → high-level file operations

Data Serialization:

  • json → JSON encoding/decoding
  • csv → CSV file handling
  • pickle → object serialization
  • yaml → YAML format support

Database & Storage:

  • sqlite3 → lightweight database operations
  • sqlalchemy → ORM & database abstraction

Networking & APIs:

  • requests → HTTP client library
  • urllib → built-in HTTP utilities
  • http.server → basic HTTP server

Time & Scheduling:

  • datetime → date, time, and timezone handling
  • time → time utilities
  • schedule → job scheduling

Utilities:

  • itertools → efficient iteration tools
  • functools → functional programming utilities
  • collections → specialized container types

Understand how programs communicate over networks professionally.

Fundamentals:

  • IP addresses & ports — network addressing
  • Sockets — low-level communication endpoints
  • TCP vs UDP protocols — connection models
  • Packet structure & routing

Socket Programming:

  • Creating server sockets
  • Client connection handling
  • Bidirectional communication
  • Non-blocking I/O patterns

HTTP & REST APIs:

  • Request/response cycle
  • HTTP methods: GET, POST, PUT, DELETE
  • Headers & status codes
  • Authentication & tokens

Using requests Library:

  • GET & POST requests
  • Query parameters & headers
  • JSON payload handling
  • Error handling & retries
  • Session management

Learn how Python handles concurrent execution and its limitations.

Multithreading:

  • Threading basics — lightweight concurrency
  • Creating threads — thread lifecycle
  • Race conditions — data corruption risks
  • Locks & synchronization — thread safety
  • Thread pools — scalable thread management
  • Daemon threads — background tasks

Multiprocessing:

  • Process vs thread — fundamental differences
  • Process creation — true parallelism
  • Sharing data between processes
  • Inter-process communication (IPC)
  • When to use multiprocessing over threading

Global Interpreter Lock (GIL):

  • Why GIL exists — CPython implementation detail
  • How it affects concurrency — only one thread executes at a time
  • Impact on CPU-bound vs I/O-bound tasks
graph TD Start["Python Process"] -->|Main Thread| GIL["Global<br/>Interpreter<br/>Lock<br/>GIL"] T1["Thread 1"] T2["Thread 2"] T3["Thread 3"] T1 -->|Request| GIL T2 -->|Request| GIL T3 -->|Request| GIL GIL -->|Executes| One["Only ONE Thread<br/>At a Time"] One -->|Result| End["⚠ CPU-bound<br/>Tasks Slow"]

Efficient concurrency using asynchronous programming for I/O-bound tasks.

  • Coroutines:
    • async & await keywords
    • Async function definition & execution
    • Coroutine protocol
  • Event loop:
    • Event-driven execution
    • Task scheduling
    • Non-blocking I/O
  • Async tasks:
    • Creating & managing tasks
    • Task groups & concurrent execution
    • Cancellation & timeouts
  • Practical patterns:
    • I/O-bound operations (file, network)
    • CPU-bound → use multiprocessing instead
    • Async context managers
    • Error handling in async code

Ensure your code works correctly, reliably, and handles edge cases.

Assertion Testing:

  • assert statements — simple inline tests
  • Assertion patterns — testing conditions

unittest Framework:

  • Test cases & test suites
  • Setup & teardown methods
  • Test discovery & organization
  • Assertions & comparisons
  • Mocking & patching

pytest Framework (Recommended):

  • Simple test writing — function-based tests
  • Fixtures — test setup & dependencies
  • Test discovery — automatic test finding
  • Parametrized testing — multiple scenarios
  • Markers & test categorization
  • Command-line options for targeted testing
  • Integration with tools & CI/CD

Best Practices:

  • Test coverage — code coverage analysis
  • TDD (Test-Driven Development) workflow
  • Mocking external dependencies
  • Integration vs unit tests

These are the foundational concepts and tools you need to get started with Python programming. As you explore these topics, you’ll gain the skills to build a wide range of applications, from simple scripts to complex systems. Happy coding!