python.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 09 Oct 2017 10:49:36 +0300
changeset 2188 e95731eef030
parent 1930 830777b3bb5d
child 2228 837f1337c59b
permissions -rw-r--r--
Fixed: NameError: name 'locale_encoding' is not defined File /bin/rst2html.py, line 17, in <module> from docutils.core import publish_cmdline, default_description File /usr/lib/python2.7/site-packages/docutils/core.py, line 20, in <module> from docutils import frontend, io, utils, readers, writers File /usr/lib/python2.7/site-packages/docutils/frontend.py, line 41, in <module> import docutils.utils File /usr/lib/python2.7/site-packages/docutils/utils/__init__.py, line 20, in <module> import docutils.io File /usr/lib/python2.7/site-packages/docutils/io.py, line 18, in <module> from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput File /usr/lib/python2.7/site-packages/docutils/utils/error_reporting.py, line 60, in <module> codecs.lookup(locale_encoding or '') # None -> '' NameError: name 'locale_encoding' is not defined

.. -*- coding: utf-8; -*-

========
 Python
========
.. contents::
   :local:

Licence and history of Python.
==============================

  http://docs.python.org/dev/license.htm

Byte compile .py and check for errors.
======================================
::

  $ python -m compileall $dir

Install python modules/packages.
================================

  http://wiki.python.org/moin/CheeseShopTutorial
                Installing Distributions from the Python Package Index (Start Here)

Uninstall python modules.
=========================

Install again and save list of installed files::

  $ python setup.py install --record files.txt
  $ rm `cat files.txt`

..

  http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages
    Uninstalling Packages

Generate documentation from Python sources.
===========================================

Generate documentation from Python sources by pydoc::

  $ mkdir html
  $ cd html
  $ pydoc -w ../

Generate documentation from Python sources by epydoc::

  TODO

Generate documentation from Python sources by Sphinx::

  $ sudo apt-get install python-sphinx
  $ sudo apt-get install rst2pdf

Code analyzers and style checkers.
==================================

Pylint.
-------

  http://www.logilab.org/857
  http://pypi.python.org/pypi/pylint

PyChecker.
----------

  http://pychecker.sourceforge.net/

Debugging Python code.
======================

Pretty print under Python.
--------------------------
::

  import pprint
  print(pprint.pformat('string'))
  print(pprint.pformat(['1', '2']))

See:

  http://docs.python.org/library/pprint.html
    Doc page.

Trace Python execution.
=======================

  http://python-ptrace.hachoir.org/trac
    python-ptrace by Victor Stinner
  http://subterfugue.org/
    subterfugue