DEV SETUPPython

DEV SETUP

DEV SETUP

Python Learning Curriculum - Development Environment

Quick Start

0. Install Tooling (one-time)

cd /home/reaz/py/python_learning
make install               # creates venv/, bootstraps pip, installs deps

Note: make install will download get-pip.py via curl the first time it needs to bootstrap pip into the virtual environment.

1. Activate the Virtual Environment

source venv/bin/activate

2. Run Examples

# Run any examples file (manual)
python 01_python_basics/examples.py

# Or via Makefile (overrides with EXAMPLE)
make run-example EXAMPLE=14_concurrency/examples.py

3. Run Exercises (with tests)

# Run specific exercise tests
python -c "from 23_security.exercises import run_all_tests; run_all_tests()"

# Or use pytest / Makefile helpers
pytest 17_testing/exercises.py -v
make topic-test MODULE=23_security

4. Interactive Learning with IPython

make ipython
# Then import and experiment:
# >>> from 05_functions.examples import *

5. Common Developer Commands

CommandDescription
make helpList all helper targets
make installCreate venv and install project + dev deps
make testRun pytest across every topic
make topic-test MODULE=20_data_science_mlTest a single topic's exercises
make run-example EXAMPLE=07_file_handling/examples.pyExecute any examples file
make lintRun Ruff lint checks
make formatFormat code with Black + isort
make typecheckRun mypy type checks
make ipythonLaunch IPython inside the venv
make cleanRemove the venv and caches

Project Structure

python_learning/
ā”œā”€ā”€ venv/                    # Virtual environment
ā”œā”€ā”€ pyproject.toml           # Project configuration
ā”œā”€ā”€ 01_python_basics/        # Topic 1
│   ā”œā”€ā”€ README.md            # Theory & explanations
│   ā”œā”€ā”€ examples.py          # Runnable demonstrations
│   └── exercises.py         # Practice problems with tests
ā”œā”€ā”€ 02_strings/
ā”œā”€ā”€ ...
└── 23_security/

Running Tests

# Run all tests in a module
pytest 23_security/exercises.py -v

# Run with coverage
pytest 17_testing/exercises.py --cov=. --cov-report=term

# Run specific test function
pytest 23_security/exercises.py::test_password_manager -v

Installed Packages

PackagePurpose
pytestTesting framework
ipythonEnhanced interactive Python
numpyNumerical computing
pandasData analysis
matplotlibData visualization
requestsHTTP library
flaskWeb framework
fastapiModern async web framework
sqlalchemyDatabase ORM
beautifulsoup4Web scraping
bcryptPassword hashing
cryptographyEncryption

Tips

  1. Start with basics: Begin at 01_python_basics and progress sequentially
  2. Read README first: Each topic has a detailed README.md explaining concepts
  3. Run examples: Execute examples.py to see concepts in action
  4. Practice exercises: Complete exercises.py and run tests to verify
  5. Use IPython: For interactive experimentation

Deactivate Environment

deactivate

# Remove everything created by make install
make clean
PreviousNext