Python

From Things and Stuff Wiki
Jump to: navigation, search

Things and Stuff Wiki - an organically evolving knowledge base wiki containing topic outlines, descriptions and breadcrumbs, with links to sites, systems, software, manuals, organisations, people, articles, guides, slides, papers, books, comments, screencasts, webcasts, scratchpads, and more. table of contents for navigation on long pages. see About for further information. / et / em

General

Learning

Guides



Tutorials

News

Installing

Certain packages like libsqlite3-dev and libreadline-dev need to be installed before hand.

pythonbrew

  • pythonbrew is a program to automate the building and installation of Python in the users $HOME. inspired by perlbrew and rvm.

to check

  • pythonz is a program to automate the building and installation of Python in the users $HOME. This is a fork of the original project, pythonbrew.

Compiling

./configure --prefix=/opt/python2.7 --with-threads --enable-shared
make; make install

Setup aliases and path.

If error while loading shared libraries: libpython2.7.so.1.0

echo "/opt/python2.7/lib" > /etc/ld.so.conf.d/libpython2.7.conf
ldconfig
 curl http://python-distribute.org/distribute_setup.py | python

Articles

Packages

PyPI

The Python Package Index is a repository of software for the Python programming language.

pip

  • pip is a tool for installing and managing Python packages, such as those found in the Python Package Index. It’s a replacement for easy_install.

Tools

virtualenv

  • virtualenv is a tool to create isolated Python environments. The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.

"Now, you’re ready to create your virtualenv. BUT FIRST…you have a decision to make. Do you want this virtualenv to use packages from your system site-packages on install them in the virtualenv’s site-packages? By default, virtualenv will symlink to your system’s site-packages if you install a package in the virtualenv that is already installed on your system. If you want a totally (well, as much as is possible) isolated virtualenv, you’ll want to do the latter. To do this, you pass in the -–no-site-packages switch when creating your virtualenv."

pip -E [envname] [package]
  install package in specific virtual environment

Or install pip seperatly in an env and use from there.


Implementations

Interfaces

Web

python -m SimpleHTTPServer
  start http server on port 8000 [3]
python -m SimpleHTTPServer 3131
  start http server on poty 3131

Libraries and modules

  • Aaargh, an astonishingly awesome application argument helper
  • sh is a full-fledged subprocess interface for Python that allows you to call any program as if it were a function
  • Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.
  • Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed.
  • TurboGear will help you to create a database-driven, ready-to-extend application in minutes. All with code that is as natural as writing a function, designer friendly templates, easy AJAX on the browser side and on the server side and with an incredibly powerful and flexible Object Relational Mapper (ORM).
  • Pattern is a web mining module for the Python programming language. It bundles tools for: Data Mining: Google + Twitter + Wikipedia API, web spider, HTML DOM parser, Natural Language Processing: tagger/chunker, n-gram search, sentiment analysis, WordNet, Machine Learning: vector space model, k-means clustering, Naive Bayes + k-NN + SVM classifiers

Network Analysis: graph centrality and visualization.

  • Syte is a really simple but powerful packaged personal site that has social integrations like Twitter, GitHub, Dribbble, Instagram, Foursquare, Tumblr, Last.fm, SoundCloud and Bitbucket. You can see it in action on my personal site.
  • dataset - Because managing databases in Python should be as simple as reading and writing JSON files.

Frameworks

Django

python manage.py runserver 0.0.0.0:8181
  for public ip

Docs

Guides

to sort

Twisted

Pyramid

Learnt from Zope 3, Grok, Cromlech, etc.

http://trac.dolmen-project.org/

Zope

Plone

other

  • PythonOnWheels (or short PoW) is a small and quick rapid web application generator framework for Python.
  • web2py - full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications. Written and programmable in Python. LGPLv3 License.

Cross language

  • Pyjs is a Rich Internet Application (RIA) Development Platform for both Web and Desktop. It contains a Python-to-JavaScript compiler, an AJAX framework and a Widget Set API. Pyjs started life as a Python port of Google Web Toolkit, the Java-to-JavaScript compiler.

to sort

  • mypy is an experimental Python variant that aims to combine the benefits of dynamic (or "duck") typing and static typing. Our goal is to have the expressive power and convenience of Python, and also compile-time type checking and efficient compilation to native code, without the need of a heavy-weight VM.
  • NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning.
  • MediaGoblin is a free software media publishing platform that anyone can run. You can think of it as a decentralized alternative to Flickr, YouTube, SoundCloud, etc
  • Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python language. Pygame is highly portable and runs on nearly every platform and operating system. Pygame itself has been downloaded millions of times, and has had millions of visits to its website.

Web API