- Jupyter Notebooks for learning Object-Oriented Programming and Design Patterns using Python
- notebooks are provided in the
notebooks
folder
- Fourth Edition by Steven F. Lott and Dusty Phillips
To learn to code, it's very important to type code on your own from scratch and NOT copy-paste! You can run provided cells to see the output, follow along, and learn from it. However, it's very important that you either start a new notebook or add cells and write your code from scratch to practice the concepts covered with many similar examples and solve the exercises provided for self-assessment.
You can launch an interactive session of this project using the online Binder service: or Google Colab. Each chapter, where applicable, provides to simply click and run the notebook in Google's Colab environment.
To run these notebooks interactively and save your work locally, you need Python 3 and Jupyter Notebook -- an interactive web-based editor that allows you to create and share documents that contain live code and data. Anaconda or Miniconda is the recommended way to install Python and other packages on all modern platforms.
-
Install Docker on your system: https://docs.docker.com/get-docker/
-
Dockerfile is provided to build a container image with all the necessary packages and dependencies to run the notebooks. You can build the image and run the container using the provided bash scripts.
-
Clone this repo and run the following command from the root of the repo
-
Use git-bash Terminal on Windows to run bash scripts
git clone https://github.com/rambasnet/Python-Object-Oriented-Programming.git
bash run-jupyter.sh # run jupyter notebook server in the container
- Jupiter Notebooks are inside the
notebooks
folder - start from the
notebbooks/OO-Table-of-Contents.ipynb
Anaconda or Miniconda has Python 3 and many other packages that you can easily install on any platform (Windows, Linux, and Mac). First, install Anaconda: http://docs.continuum.io/anaconda/install/ or Miniconda https://conda.io/docs/user-guide/install/index.html for Python 3.
After installing anaconda or miniconda, open a terminal or cmd prompt and run the following commands:
conda update conda
conda env list # list current environments
conda env remove -n <environment_name> # remove existing environment
conda create -n oop python=3.10 # create a new virtual environment named py
conda activate oop
conda install notebook # or
conda install -c conda-forge retrolab # uses notebook
conda install mypy # type checker
python -m pip install hypothesis # test data generator
- Python notebooks can be run natively in VS Code. Simply open the notebook file with extension .ipynb in VS Code and run each cell; add new cell, etc. right from VS Code.
Once Python 3 and Jupyter Notebook are installed, open a terminal change the working directory using cd
command to go into the folder where this repo is cloned and run the notebook from there. Use notebook or retro.
cd <directory where this repo is cloned>
jupyter notebook # or
jupyter retro
This will start a Jupyter session in your browser. Start from the notebbooks/OO-Table-of-Contents.ipynb
- Open a terminal and run the following command. The corresponding pdf files of all the notebooks (*.ipynb) will be generated and stored in .pdfs folder.
bash generatepdfs.sh