From 318a5a8dd39a4ab68f3a9fcbdf3711bc4630b357 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Mon, 16 Sep 2019 10:56:41 +0200 Subject: [PATCH 1/2] Add a requirements.txt file This file makes it easier to install all dependencies for users without poetry installed --- requirements.txt | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..41753e1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,56 @@ +appdirs==1.4.3 +attrs==19.1.0 +backcall==0.1.0 +black==18.9b0 +blackcellmagic==0.0.2 +bleach==3.1.0 +Click==7.0 +decorator==4.4.0 +defusedxml==0.6.0 +entrypoints==0.3 +ipykernel==5.1.2 +ipython==7.8.0 +ipython-genutils==0.2.0 +ipywidgets==7.5.1 +jedi==0.15.1 +Jinja2==2.10.1 +jsonschema==3.0.2 +jupyter==1.0.0 +jupyter-client==5.3.2 +jupyter-console==6.0.0 +jupyter-contrib-core==0.3.3 +jupyter-contrib-nbextensions==0.5.1 +jupyter-core==4.5.0 +jupyter-highlight-selected-word==0.2.0 +jupyter-latex-envs==1.4.6 +jupyter-nbextensions-configurator==0.4.1 +lxml==4.4.1 +MarkupSafe==1.1.1 +mistune==0.8.4 +nbconvert==5.6.0 +nbformat==4.4.0 +notebook==6.0.1 +pandocfilters==1.4.2 +parso==0.5.1 +pexpect==4.7.0 +pickleshare==0.7.5 +prometheus-client==0.7.1 +prompt-toolkit==2.0.9 +ptyprocess==0.6.0 +Pygments==2.4.2 +pyrsistent==0.15.4 +python-dateutil==2.8.0 +PyYAML==5.1.2 +pyzmq==18.1.0 +qtconsole==4.5.5 +rise==5.5.1 +Send2Trash==1.5.0 +six==1.12.0 +terminado==0.8.2 +testpath==0.4.2 +toml==0.10.0 +tornado==6.0.3 +traitlets==4.3.2 +wcwidth==0.1.7 +webencodings==0.5.1 +widgetsnbextension==3.5.1 From 33d6d91c9acffcea45dc4a1f2caca8036adb9e67 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Mon, 16 Sep 2019 10:58:33 +0200 Subject: [PATCH 2/2] Add course info to README.md - course description (objective & prerequisites) - installation notes for Python & third-party packages --- README.md | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/README.md b/README.md index 6eece6b..4fd2b52 100644 --- a/README.md +++ b/README.md @@ -1 +1,141 @@ # An Introduction to Python and Programming + +The purpose of this repository is to serve as an interactive "book" for a +thorough introductory course on programming in the +**[Python](https://www.python.org/)** language. + +The course's **main goal** is to **prepare** the student for **further +studies** in the "field" of **data science**. + +The "chapters" are written in [Jupyter notebooks](https://jupyter-notebook.readthedocs.io/en/stable/) +which are a de-facto standard for exchanging code and results among data +science professionals and researchers. +As such they can be viewed in a plain web browser: + +- [00 - Start up](https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/00_start_up.ipynb) + +However, it is recommended that students **install Python and Jupyter +locally** and run the code in the notebooks on their own. +This way, the student can play with the code and learn more efficiently. +Precise **installation instructions** are either in the [00th notebook]( +https://nbviewer.jupyter.org/github/webartifex/intro-to-python/blob/master/00_start_up.ipynb) +or further below. + +Feedback is encouraged and will be incorporated. +Open an issue in the [issues tracker](https://github.com/webartifex/intro-to-python/issues) +or initiate a [pull request](https://help.github.com/en/articles/about-pull-requests) +if you are familiar with the concept. + + +## Prerequisites + +To be suitable for *total beginners*, there are *no* formal prerequisites. +It is only expected that the student has: + +- a *solid* understanding of the **English language**, +- knowledge of **basic mathematics** from high school, +- the ability to **think conceptually** and **reason logically**, and +- the willingness to **invest 2-4 hours a day for a month**. + + +## Installation + +To follow this course, a working installation of **Python 3.6** or higher is +expected. + +A popular and beginner friendly way is to install the [Anaconda Distribution]( +https://www.anaconda.com/distribution/) that not only ships Python but comes +pre-packaged with a lot of third-party libraries from the so-called +"scientific stack". +Just go to the [download](https://www.anaconda.com/distribution/#download-section) +section and install the latest version (i.e., *2019-07* with Python 3.7 at the +time of this writing) for your operating system. + +Then, among others, you will find an entry "Jupyter Notebook" in your start +menu like below. +Click on it and a new tab in your web browser will open where you can switch +between folders as you could in your computer's default file browser. + + + +To download the course's materials as a ZIP file, click on the green "Clone or +download" button on the top right on this website. +Then, unpack the ZIP file into a folder of your choosing (ideally somewhere +within your personal user folder so that the files show up right away). + + +### Alternative Installation + +Python can also be installed in a "pure" way as obtained from its core +development team (i.e., without any third-party packages installed). +However, this is somewhat too "advanced" for a beginner as it involves working +with a terminal emulator, which looks similar to the picture below and is +used without a mouse by typing commands into it. + + + +Assuming that you already have a working version of Python 3.6 or higher +installed (cf., the official [download page](https://www.python.org/downloads/)), +the following summarizes the commands to be typed into a terminal emulator to +get the course materials up and running on a local machine without Anaconda. +You are then responsible for understanding the concepts behind them. + +First, the [git](https://git-scm.com/) command line tool is a more professional +way of "cloning" the course materials as compared to downloading them in a ZIP +file. + +- `git clone https://github.com/webartifex/intro-to-python.git` + +This creates a new folder *intro-to-python* with all the materials of this +repository in it. + +Inside this folder, it is recommended to create a so-called **virtual +environment** with Python's [venv](https://docs.python.org/3/library/venv.html) +module. +This must only be done the first time. +A virtual environment is a way of *isolating* the third-party packages +installed by different projects, which is considered a best practice. + +- `python -m venv venv` + +The second *venv* is the environment's name and by convention often chosen to +be *venv*. +However, it could be another name as well. + +From then on, each time you want to resume work, go back into the +*intro-to-python* folder inside your terminal and "activate" the virtual +environment (*venv* is the name chosen before). + +- `source venv/bin/activate` + +This may change how the terminal's [command prompt](https://en.wikipedia.org/wiki/Command-line_interface#Command_prompt) +looks. + +[poetry](https://poetry.eustace.io/docs/) and [virtualenvwrapper](https://virtualenvwrapper.readthedocs.io/en/latest/) +are popular tools to automate the described management of virtual environments. + +After activation for the first time, you must install the project's +**dependencies** (= the third-party packages needed to run the code), most +notably [Jupyter](https://pypi.org/project/jupyter/) in this project (the +"python -m" is often left out; if you have poetry installed, you may just +type `poetry install` instead). + +- `python -m pip install -r requirements.txt` + + +With everything installed, you can now do the equivalent of clicking the +"Jupyter Notebook" entry in your start menu. + +- `jupyter notebook` + +This opens a new tab in your web browser just as above. + + +## About the Author + +Alexander Hess is a PhD student at the Chair of Logistics Management at the +[WHU - Otto Beisheim School of Management](https://www.whu.edu) where he +conducts research on urban delivery platforms and teaches an introductory +course on Python (cf., [course listing](https://vlv.whu.edu/campus/all/event.asp?objgguid=0xE57C2715B01B441AAFD3E79AA05CACCF&from=vvz&gguid=0x6A2B0ED5B2B949E69957A2099E7DE2F1&mode=own&tguid=0x3980A9BBC3BF4A638E977F2DC163F44B&lang=en)). + +Connect him on [LinkedIn](https://www.linkedin.com/in/webartifex).