Difference between revisions of "Python Resources"

From Simson Garfinkel
Jump to navigationJump to search
m
Line 17: Line 17:
* [https://github.com/google/styleguide/blob/gh-pages/pyguide.md Python Google Style Guide].
* [https://github.com/google/styleguide/blob/gh-pages/pyguide.md Python Google Style Guide].


==Data Representation==
==Packages and Tools===
===Numerical Datas===
Recommended packages and tools for different tasks
 
===Developer Tools===
* PyCharm
* Jupyter Notebook
 
===Numerical Data Processing===
* numpy - numeric analysis in python (needed for matplotlib)
* numpy - numeric analysis in python (needed for matplotlib)
* jupyter notebook
* pandas or SparkSQL
* pandas or SparkSQL
* tabulate - create tables easily (but see my tytable replacement)
* tabulate - create tables easily (but see my tytable replacement)
Line 29: Line 34:


===String Formatting===
===String Formatting===
* https://pyformat.info
* https://pyformat.info --- Big how-to on using the % and .format() formatting
 
===Image Manipulation===
* Use Pillow, the Python2/3 fork of Python Image Library (PIL). 
 
Fun examples:
* http://jeremykun.com/2012/01/01/random-psychedelic-art/
* http://pythonvision.org/basic-tutorial
* http://stackoverflow.com/questions/138250/read-the-rgb-value-of-a-given-pixel-in-python-programatically


== Text Processing ==
=== Text Processing ===
See [[Text processing notes]].
See [[Text processing notes]].


==Graphing, Graphics and Games==
===Graphing===
===Graphing===
* [http://matplotlib.org/ matplotlib] - a handy system for plotting in python. ([[Short example of using matplotlib within jupyter]])
* [http://matplotlib.org/ matplotlib] - a handy system for plotting in python. ([[Short example of using matplotlib within jupyter]])
* holoview
* [https://altair-viz.github.io/index.html Altair: Declarative Visualization in Python]
* [https://altair-viz.github.io/index.html Altair: Declarative Visualization in Python]
* [https://github.com/geopy/geopy geopy] - geocoding for Python
* [https://github.com/geopy/geopy geopy] - geocoding for Python
Line 52: Line 65:
* [http://www.crystalspace3d.org/ Crystal Space 3D]
* [http://www.crystalspace3d.org/ Crystal Space 3D]
* [http://www.vpython.org/ VPython 3D Programming in Python]
* [http://www.vpython.org/ VPython 3D Programming in Python]
===Image Manipulation===
* Use Pillow, the Python2/3 fork of Python Image Library (PIL). 
Fun examples:
* http://jeremykun.com/2012/01/01/random-psychedelic-art/
* http://pythonvision.org/basic-tutorial
* http://stackoverflow.com/questions/138250/read-the-rgb-value-of-a-given-pixel-in-python-programatically


===Python GUI Options===
===Python GUI Options===
I need to write some programs that use GUI.  
I need to write some programs that use GUI.  


* tkinter - built in, but not recommended
* pyqt - Use PyQT5 (it's part of Anaconda)
* pyqt - Use PyQT5 (it's part of Anaconda)
* wxwidgets - It's okay, but use PyQT5
* [http://en.wikibooks.org/wiki/Python_Programming/GUI_Programming wikibooks] has a page on Python Program/GUI Programming options
* [http://www.fltk.org/ FLTK], the Fast Light Toolkit
* [http://www.fltk.org/ FLTK], the Fast Light Toolkit


Line 73: Line 75:
You basically have two options:
You basically have two options:
* Write a CGI script (slow, but easy)
* Write a CGI script (slow, but easy)
* Some sort of [https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface Web Server Gateway Interface] (WSGI)
* Some sort of [https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface Web Server Gateway Interface] (WSGI). Options include:
** Flask (can run on Apache with Passenger, but needs its own domain name)
** CherryPy
 
* See also https://wiki.python.org/moin/WebFrameworks
* See also https://wiki.python.org/moin/WebFrameworks


Line 81: Line 86:
* https://www.byteconsole.com/get-flask-up-and-running-on-a-dreamhost-server-with-passenger/
* https://www.byteconsole.com/get-flask-up-and-running-on-a-dreamhost-server-with-passenger/


===WSGI options===
Notes on flask:
* Flask (can run on Apache with Passenger, but needs its own domain name)
* CherryPy
 
===Notes on Flask===
     $ touch tmp/restart.txt        # reload your program
     $ touch tmp/restart.txt        # reload your program


===Using Passengers on Dreamhost===
Using Passengers on Dreamhost:
* https://help.dreamhost.com/hc/en-us/articles/215769578-Passenger-overview
* https://help.dreamhost.com/hc/en-us/articles/215769578-Passenger-overview
* https://help.dreamhost.com/hc/en-us/articles/216137717-Python-overview
* https://help.dreamhost.com/hc/en-us/articles/216137717-Python-overview

Revision as of 12:13, 11 April 2019

For Learning Python

I've reviewed these resources and highly recommend them.

If you have never programmed with Python before, you may want to start with DataCamp's Learn python by example:

If you want to just read, I recommend starting with the Python Tutorial:

If you have not programmed before, you may try:

If you have programmed before, at this point I recommend:

Packages and Tools=

Recommended packages and tools for different tasks

Developer Tools

  • PyCharm
  • Jupyter Notebook

Numerical Data Processing

  • numpy - numeric analysis in python (needed for matplotlib)
  • pandas or SparkSQL
  • tabulate - create tables easily (but see my tytable replacement)

Date Data

String Formatting

Image Manipulation

  • Use Pillow, the Python2/3 fork of Python Image Library (PIL).

Fun examples:

Text Processing

See Text processing notes.

Graphing

Easy Graphics

Games

Python GUI Options

I need to write some programs that use GUI.

  • pyqt - Use PyQT5 (it's part of Anaconda)
  • FLTK, the Fast Light Toolkit

Building Web Applications

You basically have two options:

  • Write a CGI script (slow, but easy)
  • Some sort of Web Server Gateway Interface (WSGI). Options include:
    • Flask (can run on Apache with Passenger, but needs its own domain name)
    • CherryPy

Examples and resources:

Notes on flask:

   $ touch tmp/restart.txt         # reload your program

Using Passengers on Dreamhost:

Python Installation

If you are using a Mac, you almost certainly want to ditch Apple's python implementation and instead install your own.

I now recommend the Anaconda Python distribution, because it has almost everything that you need, and it's easy to add new modules.

If you want to write a Python program with a GUI that can be run on any system, you'll need to use Tkinter (Python's Tcl/Tk bindings). If you want to actually enjoy what you are writing, you want to use PyQT5..