Set of programs written during learning basics of Python and related resources 🐍
Python HTML Shell
Switch branches/tags
Nothing to show
Clone or download
pwittchen Merge pull request #1 from kieranjol/patch-1
README - fixes dead get-pip.py link
Latest commit 293b7f5 Jul 3, 2018
Permalink
Failed to load latest commit information.
code-snippets Update README.md Aug 26, 2015
exercises
.gitignore
LICENSE
README.md README - fixes dead get-pip.py link Jul 3, 2018

README.md

Learn Python - The Hard Way

Overview

Set of simple programs written during learning basics of Python language based on Learn Python - The Hard Way course. All tasks can be found in exercises directory. In the same directory, we can found another README.md file including list of all tasks. Moreover, this README.md file includes important and essential information concerning programming in Python. You can also read a short article about this project on my blog.

Contents

Requirements

  • Windows, Linux or Mac OS X
  • Python 2.7
  • Pip (Python Package Manager)

Installing Python

Executing Python scripts from terminal

  • on Linux: Most of the Linux distributions should have enabled Python by default, so simply open terminal and type python to see if everything works.
  • on Windows: add /PythonXX (e.g. C:/Python27) into Path environmental variable. Location of the Python directory depends on your configuration. Next, re-run terminal window and type python
  • in order to check installed version of the Python, type: python --version
  • in order to exit python console type exit()

Pip

Pip is a Python Package Manager.

Installing Pip on Windows

  1. Download: https://bootstrap.pypa.io/get-pip.py script
  2. Execute: python get-pip.py
  3. pip.exe and easy_install.exe files now should be located at: /PythonXX/Scripts (e.g. C:/Python27/Scripts)
  4. Add /PythonXX/Scripts (e.g. C:/Python27/Scripts) directory into Path environmental variable.
  5. Re-run terminal window
  6. Type pip, to check if package manager works
  7. You can type pip --version, in order to check version of the pip

Installing Pip on Linux

  1. Open terminal
  2. Type sudo apt-get install python-pip

Installing Pip on macOS

  1. Open terminal
  2. Type brew install python3

This command will install python and pip.

Using Pip

  • In order to install desired package just type pip install desired_package (e.g. pip install Flask)
  • If you are working on Linux, type sudo pip install desired_package (e.g. sudo pip install Flask)
  • Index of available packages can be found at: https://pypi.python.org/pypi/
  • List of installed packages can be displayed with pip freeze command.

Unit Testing

  • UT in Python can be done with nose. Install it via pip with the following command: sudo pip install nose
  • UT can be also created with unittest package provided with Python.

Virtualenv

virtualenv is a tool to create isolated Python environments.

More information:

Pipenv

pipenv is Python Development Workflow for Humans.

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages.

More information:

Scripts on Linux

If we want to create a Python script for Linux, we should set the following header:

#!/usr/bin/python -u

# your Python script code goes here...

After that when our script was saved in script.py file, we can execute our script as follows:

./script.py

Style Guide for Python Code

PEP 0008 is a current Style Guide for Python Code.

link: https://www.python.org/dev/peps/pep-0008/

Static Code Analysis

Development Environments

Python web frameworks

Web servers

Useful Python libraries

Tools written in Python

Collections of tools written in Python

Resources

Books

License

MIT