Skip to content

Commit

Permalink
Create docs, trim README (Fixes #239 on Github)
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Apr 5, 2017
1 parent a300b61 commit 8a7fa54
Show file tree
Hide file tree
Showing 11 changed files with 375 additions and 135 deletions.
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,13 @@ Flake8:
- python3.5
except:
- tags

Documentation:
script:
- EXTRA_INSTALL="numpy mako"
- curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-docs.sh
- ". ./build-docs.sh"
tags:
- python3.5
only:
- master
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PuDB is licensed to you under the MIT/X Consortium license:

Copyright (c) 2009-16 Andreas Kloeckner and contributors
Copyright (c) 2009-17 Andreas Kloeckner and contributors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
137 changes: 3 additions & 134 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,124 +41,15 @@ Features

* Should work with Python 2.6 and newer, including Python 3.

Installing
----------
Links
-----

Install PuDB using the command::

pip install pudb

If you are using Python 2.5, PuDB version 2013.5.1 is the last version to
support that version of Python. urwid 1.1.1 works with Python 2.5, newer
versions do not.

Getting Started
---------------

To start debugging, simply insert::

from pudb import set_trace; set_trace()

A shorter alternative to this is::

import pudb; pu.db

Or, if pudb is already imported, just this will suffice::

pu.db

Insert either of these snippets into the piece of code you want to debug, or
run the entire script with::

pudb my-script.py

or, in Python 3::

pudb3 my-script.py

This is equivalent to::

python -m pudb.run my-script.py

which is useful if you want to run PuDB in a version of Python other than the
one you most recently installed PuDB with.

Remote debugging
^^^^^^^^^^^^^^^^

Rudimentary remote debugging is also supported::

from pudb.remote import set_trace
set_trace(term_size=(80, 24))

At this point, the debugger will look for a free port and wait for a telnet
connection::

pudb:6899: Please telnet into 127.0.0.1 6899.
pudb:6899: Waiting for client...

Usage with pytest
^^^^^^^^^^^^^^^^^

To use PuDB with `pytest <http://docs.pytest.org/en/latest/>`_, consider
using the `pytest-pudb <https://pypi.python.org/pypi/pytest-pudb>`_ plugin.

Alternatively, as of version 2017.1.2, pudb can be used to debug test failures
in `pytest <http://docs.pytest.org/en/latest/>`_, by running the test runner
like so::

$ pytest --pdbcls pudb.debugger:Debugger --pdb --capture=no

Note the need to pass --capture=no (or its synonym -s) as otherwise
pytest tries to manage the standard streams itself. (contributed by Antony Lee)

Documentation and Support
-------------------------

PuDB has a `wiki <http://wiki.tiker.net/PuDB>`_, where documentation and
debugging wisdom are collected.
`PuDB documentation <https://documen.tician.de/pudb>`_

PuDB also has a `mailing list <http://lists.tiker.net/listinfo/pudb>`_ that
you may use to submit patches and requests for help. You can also send a pull
request to the `GitHub repository <https://github.com/inducer/pudb>`_

Starting the debugger without breaking
--------------------------------------

To start the debugger without actually pausing use::

from pudb import set_trace; set_trace(paused=False)

at the top of your code. This will start the debugger without breaking, and
run it until a predefined breakpoint is hit. You can also press ``b`` on a
``set_trace`` call inside the debugger, and it will prevent it from stopping
there.

Interrupt Handlers
------------------

``set_trace`` sets ``SIGINT`` (i.e., ``Ctrl-c``) to run ``set_trace``, so that
typing ``Ctrl-c`` while your code is running will break the code and start
debugging. See the docstring of ``set_interrupt_handler`` for more
information. Note that this only works in the main thread.

Programming PuDB
----------------

At the programming language level, PuDB displays the same interface
as Python's built-in `pdb module <http://docs.python.org/library/pdb.html>`_.
Just replace ``pdb`` with ``pudb``.
(One exception: ``run`` is called ``runstatement``.)

License and Dependencies
------------------------

PuDB is distributed under the MIT license. It relies on the following
excellent pieces of software:

* Ian Ward's `urwid <http://excess.org/urwid>`_ console UI library
* Georg Brandl's `pygments <http://pygments.org>`_ syntax highlighter

Development Version
-------------------

Expand All @@ -170,25 +61,3 @@ version control tool.::
You may also `browse the code <http://git.tiker.net/pudb.git>`_ online.

The repository is also mirrored at `GitHub <https://github.com/inducer/pudb>`_.

FAQ
---

**Q: I navigated to the Variables/Stack/Breakpoints view. How do I get
back to the source view?**

A: Press your left arrow key.

**Q: Where are breakpoints stored?**

A: All PuDB information is stored in a location specified by the `XDG Base
Directory Specification
<http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_.
Usually, it is ``~/.config/pudb``. Breakpoints are stored in a file called
``saved-breakpoints``. Also in this location are the shell history from the
``!`` shell (``shell-history``) and the PuDB settings (``pudb.cfg``).

**Q: I killed PuDB and now my terminal is broken. How do I fix it?**

A: Type the ``reset`` command (even if you cannot see what you are typing, it
should work). If this happens on a regular basis, please report it as a bug.
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_build
20 changes: 20 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = pudb
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
180 changes: 180 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pudb documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 5 16:44:29 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = 'pudb'
copyright = '2017, Andreas Kloeckner and contributors'
author = 'Andreas Kloeckner and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
ver_dic = {}
with open("../pudb/__init__.py") as ver_file:
ver_src = ver_file.read()
exec(compile(ver_src, "../pudb/__init__.py", 'exec'), ver_dic)
version = ".".join(str(x) for x in ver_dic["VERSION"])

# The full version, including alpha/beta/rc tags.
release = version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False


# -- Options for HTML output ----------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}

html_theme = "alabaster"

html_theme_options = {
"extra_nav_links": {
"🚀 Github": "https://github.com/pyopencl/pudb",
"💾 Download Releases": "https://pypi.python.org/pypi/pudb",
}
}

html_sidebars = {
'**': [
'about.html',
'navigation.html',
'relations.html',
'searchbox.html',
]
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']


# -- Options for HTMLHelp output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'pudbdoc'


# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'pudb.tex', 'pudb Documentation',
'Andreas Kloeckner and contributors', 'manual'),
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'pudb', 'pudb Documentation',
[author], 1)
]


# -- Options for Texinfo output -------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'pudb', 'pudb Documentation',
author, 'pudb', 'One line description of project.',
'Miscellaneous'),
]

autoclass_content = "both"

Loading

0 comments on commit 8a7fa54

Please sign in to comment.