Skip to content

Latest commit

 

History

History
118 lines (90 loc) · 4.66 KB

File metadata and controls

118 lines (90 loc) · 4.66 KB

Python

Setup

  1. Install Python 3
    • On a Unix-based OS, the system's default Python installation is normally Python 2. Check this by running python --version on a terminal. If this is so, install Python 3 but DO NOT REMOVE / OVERWRITE / UNINSTALL the old Python 2. The system uses Python 2 for its internal scripts and removing it may break the OS installation.
    • For Linux, either install it from apt or from source
    • For Mac, use Homebrew
    • Verify the Python installation by running
      $ which python3
      $ python3 --version
      
  2. Setup and use a virtual environment
  3. For each Python project
    • For virtualenv and venv
      • Create/Activate a virtual environment
        $ mkvenv NAME /path/to/python
        
      • Create a requirements.txt file
        $ pip freeze > requirements.txt
        
      • Commit the requirements.txt file
      • When switching environments:
        $ pip install -r requirements.txt
        
    • For pipenv
      • Create/Activate a virtual environment
        $ pipenv --python=/path/to/python
        
      • Create a Pipfile
        $ pipenv install PACKAGE
        $ pipenv install --dev PACKAGE
        
      • Commit the generated Pipfile and Pipfile.lock
      • When switching environments:
        $ pipenv sync
        

FAQ

Coding Conventions

Package Management

Notable Modules

Linters

Formatters

Terminal

  • ipython - Enhanced interactive Python shell

CLI

  • colorama - Cross-platform colorizer for console logs
  • click - For creating CLI-based applications
  • tqdm - For better progress bars and loop tracking

Web Application

  • flask - Lightweight web application framework

Data Visualization

  • bokeh - Interactive and embeddable images for modern web browsers