python.rst
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 10 Feb 2018 01:36:16 +0200
changeset 2229 1a0b6597e594
parent 2228 837f1337c59b
child 2230 9e6ad6607a9e
permissions -rw-r--r--
Mark block quot in HTMLe.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1334
9bf0d5a1f0cf Include common header with quick links.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1298
diff changeset
     1
.. -*- coding: utf-8; -*-
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
========
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
 Python
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
========
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
.. contents::
1905
fba288d59662 Include only local subsections into TOC. This prevent duplication of
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1369
diff changeset
     7
   :local:
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
Licence and history of Python.
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
==============================
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    12
* http://docs.python.org/dev/license.htm
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    14
Byte compile .py and check for errors.
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
======================================
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
::
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    17
1190
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    18
  $ python -m compileall $dir
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
1014
4716ec9e29f5 Install python modules/packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
    20
Install python modules/packages.
4716ec9e29f5 Install python modules/packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
    21
================================
4716ec9e29f5 Install python modules/packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
    22
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    23
http://wiki.python.org/moin/CheeseShopTutorial
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    24
  Installing Distributions from the Python Package Index (Start Here)
1014
4716ec9e29f5 Install python modules/packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
    25
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
Uninstall python modules.
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
=========================
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
Install again and save list of installed files::
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
  $ python setup.py install --record files.txt
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
  $ rm `cat files.txt`
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
1930
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    34
..
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    35
1014
4716ec9e29f5 Install python modules/packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
    36
  http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages
1930
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    37
    Uninstalling Packages
1014
4716ec9e29f5 Install python modules/packages.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1013
diff changeset
    38
1190
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    39
Generate documentation from Python sources.
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    40
===========================================
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    41
1930
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    42
Generate documentation from Python sources by pydoc::
1190
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    43
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    44
  $ mkdir html
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    45
  $ cd html
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    46
  $ pydoc -w ../
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    47
1930
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    48
Generate documentation from Python sources by epydoc::
1190
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    49
1930
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    50
  TODO
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    51
830777b3bb5d Reindent code.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1912
diff changeset
    52
Generate documentation from Python sources by Sphinx::
1369
06b695810e88 Generate documentation from Python sources by Sphinx.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    53
06b695810e88 Generate documentation from Python sources by Sphinx.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    54
  $ sudo apt-get install python-sphinx
06b695810e88 Generate documentation from Python sources by Sphinx.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1334
diff changeset
    55
  $ sudo apt-get install rst2pdf
1190
26fd684df3ee Generate documentation from Python sources by pydoc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1014
diff changeset
    56
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
Code analyzers and style checkers.
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
==================================
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
Pylint.
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
-------
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    63
* http://www.logilab.org/857
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    64
* http://pypi.python.org/pypi/pylint
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
PyChecker.
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
----------
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    69
* http://pychecker.sourceforge.net/
1013
49a5602070a9 Uninstall python modules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
1210
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    71
Debugging Python code.
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    72
======================
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    73
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    74
Pretty print under Python.
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    75
--------------------------
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    76
::
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    77
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    78
  import pprint
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    79
  print(pprint.pformat('string'))
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    80
  print(pprint.pformat(['1', '2']))
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    81
1211
02aabbf45b59 Fix formatting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1210
diff changeset
    82
See:
02aabbf45b59 Fix formatting.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1210
diff changeset
    83
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    84
http://docs.python.org/library/pprint.html
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    85
  Doc page.
1210
ed0ee1b5343c Pretty print under Python.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1190
diff changeset
    86
1298
1e7db170c823 Trace Python execution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1211
diff changeset
    87
Trace Python execution.
1e7db170c823 Trace Python execution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1211
diff changeset
    88
=======================
1e7db170c823 Trace Python execution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1211
diff changeset
    89
2228
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    90
http://python-ptrace.hachoir.org/trac
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    91
  python-ptrace by Victor Stinner
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    92
http://subterfugue.org/
837f1337c59b Removed indentation that compiled into <blockquote>.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1930
diff changeset
    93
  subterfugue
1298
1e7db170c823 Trace Python execution.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 1211
diff changeset
    94