pdbpp


Namepdbpp JSON
Version 0.10.3 PyPI version JSON
download
home_pagehttp://github.com/antocuni/pdb
Summarypdb++, a drop-in replacement for pdb
upload_time2021-07-09 22:22:22
maintainer
docs_urlNone
authorAntonio Cuni
requires_python
licenseBSD
keywords pdb debugger tab color completion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            .. -*- restructuredtext -*-

pdb++, a drop-in replacement for pdb
====================================

What is it?
------------

This module is an extension of the pdb_ module of the standard library.  It is
meant to be fully compatible with its predecessor, yet it introduces a number
of new features to make your debugging experience as nice as possible.

.. image:: https://github.com/antocuni/pdb/blob/master/screenshot.png?raw=true

``pdb++`` features include:

  - colorful TAB completion of Python expressions (through fancycompleter_)

  - optional syntax highlighting of code listings (through pygments_)

  - `sticky mode`_

  - several new commands to be used from the interactive ``(Pdb++)`` prompt

  - `smart command parsing`_ (hint: have you ever typed ``r`` or ``c`` at the
    prompt to print the value of some variable?)

  - additional convenience functions in the ``pdb`` module, to be used from
    your program

``pdb++`` is meant to be a drop-in replacement for ``pdb``. If you find some
unexpected behavior, please report it as a bug.

.. _pdb: http://docs.python.org/library/pdb.html
.. _fancycompleter: http://bitbucket.org/antocuni/fancycompleter
.. _pygments: http://pygments.org/

Installation
-------------

Since ``pdb++`` is not a valid identifier for ``pip`` and ``easy_install``,
the package is named ``pdbpp``::

    $ pip install pdbpp

    -- OR --

    $ easy_install pdbpp

``pdb++`` is also available via `conda`_::

    $ conda install -c conda-forge pdbpp

Alternatively, you can just put ``pdb.py`` somewhere inside your
``PYTHONPATH``.

.. _conda: https://anaconda.org/conda-forge/pdbpp

Usage
-----

Note that the module is called ``pdb.py`` so that ``pdb++`` will automatically
be used in all places that do ``import pdb`` (e.g. ``pytest --pdb`` will
give you a ``pdb++`` prompt).

The old ``pdb`` module is still available by doing e.g. ``import pdb;
pdb.pdb.set_trace()``.

New interactive commands
------------------------

The following are new commands that you can use from the interative
``(Pdb++)`` prompt.

.. _`sticky mode`:

``sticky [start end]``
  Toggle **sticky mode**.  When in this mode, every time the current position
  changes, the screen is repainted and the whole function shown.  Thus, when
  doing step-by-step execution you can easily follow the flow of the
  execution.  If ``start`` and ``end`` are given, sticky mode is enabled and
  only lines within that range (extremes included) will be displayed.


``longlist`` (``ll``)
  List source code for the current function.  Different from the normal pdb
  ``list`` command, ``longlist`` displays the whole function.  The current
  line is marked with ``->``.  In case of post-mortem debugging, the line
  which actually raised the exception is marked with ``>>``.  If the
  ``highlight`` `config option`_ is set and pygments_ is installed, the source
  code is highlighted.


``interact``
  Start an interative interpreter whose global namespace contains all the
  names found in the current scope.


``track EXPRESSION``
  Display a graph showing which objects are the value of the expression refers
  to and are referred by.  This command requires the ``pypy`` source code to
  be importable.

``display EXPRESSION``
  Add an expression to the **display list**; expressions in this list are
  evaluated at each step, and printed every time its value changes.
  **WARNING**: since these expressions are evaluated multiple times, make sure
  not to put expressions with side-effects in the display list.

``undisplay EXPRESSION``:
  Remove ``EXPRESSION`` from the display list.

``source EXPRESSION``
  Show the source code for the given function/method/class.

``edit EXPRESSION``
  Open the editor in the right position to edit the given
  function/method/class.  The editor used is specified in a `config
  option`_.

``hf_unhide``, ``hf_hide``, ``hf_list``
  Some frames might be marked as "hidden" by e.g. using the `@pdb.hideframe`_
  function decorator.  By default, hidden frames are not shown in the stack
  trace, and cannot be reached using ``up`` and ``down``.  You can use
  ``hf_unhide`` to tell pdb to ignore the hidden status (i.e., to treat hidden
  frames as normal ones), and ``hf_hide`` to hide them again.  ``hf_list``
  prints a list of hidden frames.
  The config option ``enable_hidden_frames`` can be used to disable handling
  of hidden frames in general.


Smart command parsing
----------------------

By default, pdb tries hard to interpret what you enter at the command prompt
as one of its builtin commands.  However, this is inconvenient if you want to
just print the value of a local variable which happens to have the same name
as one of the commands. E.g.::

    (Pdb) list
      1
      2     def fn():
      3         c = 42
      4         import pdb;pdb.set_trace()
      5  ->     return c
    (Pdb) c

In the example above, instead of printing 42 pdb interprets the input as the
command ``continue``, and then you loose your prompt.  It's even worse than
that, because it happens even if you type e.g. ``c.__class__``.

pdb++ fixes this unfriendly (from the author's point of view, of course :-))
behavior by always prefering variable in scope, if it exists.  If you really
want to execute the corresponding command, you can prefix it with ``!!``.
Thus, the example above becomes::

    (Pdb++) list
      1
      2     def fn():
      3         c = 42
      4         import pdb;pdb.set_trace()
      5  ->     return c
    (Pdb++) c
    42
    (Pdb++) !!c

Note that the "smart" behavior takes place only when there is ambiguity, i.e.
if there exists a variable with the same name as a command: in all other
cases, everything works as usual.

Regarding the ``list`` command itself, using ``list(…`` is a special case
that gets handled as the Python builtin::

    (Pdb++) list([1, 2])
    [1, 2]

Additional functions in the ``pdb`` module
------------------------------------------

The ``pdb`` module that comes with pdb++ includes all the functions and
classes that are in the module from the standard library.  If you find any
difference, please report it as a bug.

In addition, there are some new convenience functions that are unique to
pdb++.

``pdb.xpm()``
  eXtended Post Mortem: it is equivalent to
  ``pdb.post_mortem(sys.exc_info()[2])``.  If used inside an ``except``
  clause, it will start a post-mortem pdb prompt from the line that raised the
  exception being caught.

``pdb.disable()``
  Disable ``pdb.set_trace()``: any subsequent call to it will be ignored.

``pdb.enable()``
  Re-enable ``pdb.set_trace()``, in case it was disabled by ``pdb.disable()``.

.. _`@pdb.hideframe`:

``@pdb.hideframe``
  A function decorator that tells pdb++ to hide the frame corresponding to the
  function.  Hidden frames do not show up when using interactive commands such
  as ``up``, ``down`` or ``where``, unless ``hf_unhide`` is invoked.

``@pdb.break_on_setattr(attrname, condition=always)``
  class decorator: break the execution of the program every time the
  attribute ``attrname`` is set on any instance of the class. ``condition`` is
  a callable that takes the target object of the ``setattr`` and the actual value;
  by default, it breaks every time the attribute is set. E.g.::

      @break_on_setattr('bar')
      class Foo(object):
          pass
      f = Foo()
      f.bar = 42    # the program breaks here

  If can be used even after the class has already been created, e.g. if we
  want to break when some attribute of a particular object is set::

      class Foo(object):
          pass
      a = Foo()
      b = Foo()

      def break_if_a(obj, value):
          return obj is a

      break_on_setattr('bar', condition=break_if_a)(Foo)
      b.bar = 10   # no break
      a.bar = 42   # the program breaks here

  This can be used after ``pdb.set_trace()`` also::

      (Pdb++) import pdb
      (Pdb++) pdb.break_on_setattr('tree_id')(obj.__class__)
      (Pdb++) continue


Configuration and customization
-------------------------------

.. _`config option`:

To customize pdb++, you can put a file named ``.pdbrc.py`` in your home
directory.  The file must contain a class named ``Config`` inheriting from
``pdb.DefaultConfig`` and override the desired values.

The following is a list of the options you can customize, together with their
default value:

``prompt = '(Pdb++) '``
  The prompt to show when in interactive mode.

``highlight = True``
  Highlight line numbers and the current line when showing the ``longlist`` of
  a function or when in **sticky mode**.

``encoding = 'utf-8'``
  File encoding. Useful when there are international characters in your string
  literals or comments.

``sticky_by_default = False``
  Determine whether pdb++ starts in sticky mode or not.

``line_number_color = Color.turquoise``
  The color to use for line numbers.

``filename_color = Color.yellow``
  The color to use for file names when printing the stack entries.

``current_line_color = "39;49;7"``
  The SGR parameters for the ANSI escape sequence to highlight the current
  line.
  This is set inside the SGR escape sequence ``\e[%sm`` where ``\e`` is the
  ESC character and ``%s`` the given value.  See `SGR parameters`_.
  The following means "reset all colors" (``0``), set foreground color to 18
  (``48;5;18``), and background to ``21``.
  The default uses the default foreground (``39``) and background (``49``)
  colors, inversed (``7``).

``use_pygments = True``
  If pygments_ is installed and ``highlight == True``, apply syntax highlight
  to the source code when showing the ``longlist`` of a function or when in
  **sticky mode**.

``bg = 'dark'``
  Passed directly to the ``pygments.formatters.TerminalFormatter`` constructor.
  Selects the color scheme to use, depending on the background color of your
  terminal. If you have a light background color, try to set it to
  ``'light'``.

``colorscheme = None``
  Passed directly to the ``pygments.formatters.TerminalFormatter`` constructor.
  It expects a dictionary that maps token types to (lightbg, darkbg) color names or
  ``None`` (default: ``None`` = use builtin colorscheme).

``editor = '${EDITOR:-vi}'``
  The command to invoke when using the ``edit`` command. By default, it uses
  ``$EDITOR`` if set, else ``vi``.  The command must support the standard
  notation ``COMMAND +n filename`` to open filename at line ``n``. ``emacs``
  and ``vi`` are known to support this.

``truncate_long_lines = True``
  Truncate lines which exceed the terminal width.

``exec_if_unfocused = None``
  Shell command to execute when starting the pdb prompt and the terminal
  window is not focused.  Useful to e.g. play a sound to alert the user that
  the execution of the program stopped. It requires the wmctrl_ module.

``disable_pytest_capturing = False``
  Old versions of `pytest`_ crash when you execute ``pdb.set_trace()`` in a
  test, but the standard output is captured (i.e., without the ``-s`` option,
  which is the default behavior).  When this option is on, the stdout
  capturing is automatically disabled before showing the interactive prompt.

``enable_hidden_frames = True``
  Certain frames can be hidden by default.
  If enabled, the commands ``hf_unhide``, ``hf_hide``, and ``hf_list`` can be
  used to control display of them.

``show_hidden_frames_count = True``
  If ``enable_hidden_frames`` is ``True`` this controls if the number of
  hidden frames gets displayed.

``def setup(self, pdb): pass``
  This method is called during the initialization of the ``Pdb`` class. Useful
  to do complex setup.

``show_traceback_on_error = True``
  Display tracebacks for errors via ``Pdb.error``, that come from
  ``Pdb.default`` (i.e. the execution of an unrecognized pdb command),
  and are not a direct cause of the expression itself (e.g. ``NameError``
  with a command like ``doesnotexist``).

  With this option disabled only ``*** exception string`` gets printed, which
  often misses useful context.

``show_traceback_on_error_limit = None``
  This option sets the limit to be used with ``traceback.format_exception``,
  when ``show_traceback_on_error`` is enabled.

.. _wmctrl: http://bitbucket.org/antocuni/wmctrl
.. _`pytest`: https://pytest.org/
.. _SGR parameters: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters


Coding guidelines
-----------------

``pdb++`` is developed using Test Driven Development, and we try to keep test
coverage high.

As a general rule, every commit should come with its own test. If it's a new
feature, it should come with one or many tests which excercise it. If it's a
bug fix, the test should **fail before the fix**, and pass after.

The goal is to make refactoring easier in the future: if you wonder why a
certain line of code does something, in principle it should be possible to
comment it out and see which tests fail.

In exceptional cases, the test might be too hard or impossible to write: in
that cases it is fine to do a commmit without a test, but you should explain
very precisely in the commit message why it is hard to write a test and how to
reproduce the buggy behaviour by hand.

It is fine NOT to write a test in the following cases:

  - typos, documentation, and in general any non-coding commit

  - code refactorings which do not add any feature

  - commits which fix an already failing test

  - commits to silence warnings

  - purely cosmetic changes, such as change the color of the output


CHANGELOG
=========

Changes between 0.10.2 and 0.10.3
=================================

Minor bugfix release, moving Continuous Integration from Travis/AppVeyor to
GitHub Actions, based on changes on master, but without the (more invasive)
(test) fixes for Windows.

- Fixes

  - Fix hideframe decorator for Python 3.8+ (#263)
  - Fix hidden_frames discrepancy with IPython (#426)

- Misc

  - ci: move to GitHub Actions (#444, #445)
  - ci: use .coveragerc (#304)
  - qa/flake8 fixes
  - test fix for newer PyPy3

Changes between 0.10.0 and 0.10.2
=================================

Minor bugfix release to make pdb++ work better with a system-wide installation
from within a virtualenv.

- Fixes

  - Fix pth hack: skip if added already (#297)

Version 0.10.2 fixes only the deployment configuration.

Changes between 0.9.15 and 0.10.0
=================================

- Changes
  - config: improve current_line_color: default fg/bg/inversed (#188)
  - Show tracebacks for errors with interactively run code (#185)

    This adds new config settings "show_traceback_on_error" (default: True),
    and "show_traceback_on_error_limit" (default: None).

- Fixes

  - Fix get_stack for non-last index (#192)

    This fixes a pretty nasty bug, which was triggered e.g. with the "next"
    command running into a deeper exception, and the internal stack getting
    confused (if hidden frames are involved).

- Misc:

  - doc: document enable_hidden_frames, show_hidden_frames_count (#191)
  - Make break_on_setattr not rely on @hideframe (#190)
  - tests: cover sticky mode, small improvements (#177)
  - doc: correct default value for disable_pytest_capturing

Changes between 0.9.14 and 0.9.15
=================================

- Fixes

  - Fix completion after debug command (#183)

- Misc

  - tests: fix test_syntaxerror_in_command for Python 3.7.3 (#182)
  - setup.py: cleanup, testing extra (#181)
  - test_help: fix restoring of sys.stdout (#180)
  - tests: move pytest config to setup.cfg, use --pdbcls=pdb:pdb.Pdb (#179)
  - tests: fix put tests on py27 with user pdbrc (#178)
  - Improve tests (#176)
  - Provide message/error methods for py27 (#175)

Changes between 0.9.13 and 0.9.14
=================================

- Fixes

  - Fix using the debug command multiple times (#174)
  - Fix backport for bpo-31078 (keeping use_rawinput) (#169)

- Features

  - new config attribute: default_pdb_kwargs, which can be used to pass
    default keyword arguments for the Pdb class (#167, #173)
    This can be used to e.g. pass ``skip=["importlib._bootstrap_external"]``.

- Misc

  - test_python_m_pdb_uses_pdbpp: set HOME to tmpdir (#172)
  - interaction: expand expression to call _cmdloop/cmdloop (#171)
  - tests: restore sys.gettrace after test, for more coverage (#170)

Changes between 0.9.12 and 0.9.13
=================================

- Fixes

  - Fix crash in is_skipped_module with no module name (#163)

- Features

  - Optimize get_stack for show_hidden_frames (#162)
  - Do not consider the frame with set_trace() as hidden (#161)

- Misc

  - DefaultConfig: make it a new-style class (#166)
  - Setup coverage reporting (#164)

Changes between 0.9.11 and 0.9.12
=================================

- Fixes

  - Fix forget(): check self.lineno, not GLOBAL_PDB.lineno (#160)
  - do_debug: use func.__globals__ with rebind_globals (#159)
  - Use super() (#145)

- Misc

  - tests: set_trace: allow to pass in Pdb class (#158)

Changes between 0.9.8 and 0.9.11
================================

- Fixes

  - Make wrapper compatible with python2's sys.stdout (#155)
    This was broken since 0.9.4/0.9.5.

NOTE: 0.9.9 and 0.9.10 were not released to PyPI due to Travis CI
      misconfiguration.

Changes between 0.9.7 and 0.9.8
===============================

- Fixes

  - interaction: fix ValueError ("signal only works in main thread") (#143)
  - rebind_globals: update globals() (#151)
  - Fix do_debug for py38 (#150)

- Misc

  - do_debug: use PdbppWithConfig class (#147)
  - tests: harden test_debug_with_overridden_continue (#146)
  - tests: add test_signal_in_nonmain_thread_with_continue
  - tests: fail if there is anything on stderr
  - ci: Travis: add Python 3.8-dev

Changes between 0.9.6 and 0.9.7
===============================

- Fixes

  - do_debug: fix setting of use_rawinput (#141)

Changes between 0.9.5 and 0.9.6
===============================

- Fixes

  - do_debug: handle SyntaxError (#139)
  - parseline: handle f-strings with py36 (#138)

Changes between 0.9.3 and 0.9.5
===============================

- Fixes

  - Fix ``python -m pdb …`` (#135)
  - Fix "TypeError: write() argument must be str, not bytes" with non-utf8
    terminal encodings (#63)
  - Handle pdb.Pdb._previous_sigint_handler with Python 3.5.3+ (#87)

- Misc

  - Use ``shutil.get_terminal_size`` if available (#125)
  - Slightly improve loading of pdb from stdlib (#133)

NOTE: 0.9.4 was not released to PyPI due to Travis CI misconfiguration.

Changes between 0.9.2 and 0.9.3
===============================

- Features

  - Improve sticky_by_default: don't clear screen the first time (#83)
  - Handle header kwarg added with Python 3.7 in pdb.set_trace (#115)
  - config: allow to force use_terminal256formatter (#112)
  - Add heuristic for which 'list' is meant (#82)

- Fixes

  - Skip/step over ``pdb.set_trace()`` (#119)
  - Handle completions from original pdb (#116)
  - Handle set_trace being invoked during completion (#89)
  - _pdbpp_path_hack/pdb.py: fix ResourceWarning (#97)
  - Fix "python -m pdb" (#108)
  - setup/interaction: use/handle return value from pdb.Pdb.setup (#107)
  - interaction: use _cmdloop if available (#106)
  - Fixed virtualenv sys.path shuffling issue (#85)
  - set_trace: do not delete pdb.curframe (#103)
  - forget: only call pdb.Pdb.forget with GLOBAL_PDB once

- Tests

  - Travis: test pypy3
  - Travis/tox: add py37, remove nightly
  - tests: PdbTest: use nosigint=True (#117)
  - Add test_debug_with_overridden_continue (#113)
  - tests: re-enable/fix test_utf8 (#110)
  - tests: fix conditional skipping with test_pdbrc_continue
  - tests: runpdb: print output on Exceptions
  - pytest.ini: addopts: -ra
  - tests: handle pytest's ``--assert=plain`` mode
  - tests: harden check: match all lines
  - tests: fix flake8 errors and invalid-escape DeprecationWarnings

- Misc

  - setup.py: add trove classifier for "… :: Debuggers"
  - doc: separate usage section (#105)
  - Format code: flake8 clean, using autopep8 mainly (#118)
  - Add wheels support
  - README: grammar and example for break_on_setattr (#99)
  - README: fix formatting
  - Simplify the code, since we no longer support python 2.6

Changes between 0.9.1 and 0.9.2
===============================

- Add ``LICENSE.txt``.
- Improved import time for `__version__`.

Changes between 0.8.2 and 0.9.1
===============================

- Install ``ordereddict`` package only on Python versions older than 2.7.

- Python 3 support

- Improved Windows support


Changes between 0.8.1 and 0.8.2
===============================

- fix wheel packaging; see
	https://bitbucket.org/antocuni/pdb/pull-request/38/support-pip-install-and-wheels-natively/diff

Changes between 0.8 and 0.8.1
=============================

- fix issue 37: Doesn’t install on OS X
	- Removed dependency on ``backports.inspect``
	- Made dependency on ``funcsigs`` optional.
	- (https://bitbucket.org/antocuni/pdb/issue/37/doesn-t-install-on-os-x)
	- (https://bitbucket.org/antocuni/pdb/pull-request/35/use-funcsigs-package-instead-of/diff)

Changes between 0.7.2 and 0.8
=============================

- Python 3 compatibility
- Optional support for 256 color formatting by setting
  ``use_terminal256formatter = True`` in ``~/.pdbrc.py``
  (https://bitbucket.org/antocuni/pdb/pull-request/30)
- Make ``set_trace()`` in same program remember previous state
  (https://bitbucket.org/antocuni/pdb/pull-request/33)
- Append ``?`` and ``??`` to callable to get info a la IPython
  (https://bitbucket.org/antocuni/pdb/pull-request/25)
- Don't treat lines like ``r = 5`` or ``c = 6`` as commands
  (https://bitbucket.org/antocuni/pdb/pull-request/11)

- fix issue 20: support argument-free post mortem

Changes between 0.7.1 and 0.7.2
===============================

- don't crash with newer versions of ``py.test``

Changes between 0.7 and 0.7.1
=============================

- The ``pp`` (pretty print) command now uses the actual width of the terminal,
  instead of hardcoding 80 columns

- py.test and unittest internal frames are hidden by default (type ``help
  hidden_frames`` for more info)

- don't crash if ``py`` is installed but ``py.test`` is not



            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/antocuni/pdb",
    "name": "pdbpp",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pdb debugger tab color completion",
    "author": "Antonio Cuni",
    "author_email": "anto.cuni@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/1f/a3/c4bd048256fd4b7d28767ca669c505e156f24d16355505c62e6fce3314df/pdbpp-0.10.3.tar.gz",
    "platform": "unix",
    "description": ".. -*- restructuredtext -*-\n\npdb++, a drop-in replacement for pdb\n====================================\n\nWhat is it?\n------------\n\nThis module is an extension of the pdb_ module of the standard library.  It is\nmeant to be fully compatible with its predecessor, yet it introduces a number\nof new features to make your debugging experience as nice as possible.\n\n.. image:: https://github.com/antocuni/pdb/blob/master/screenshot.png?raw=true\n\n``pdb++`` features include:\n\n  - colorful TAB completion of Python expressions (through fancycompleter_)\n\n  - optional syntax highlighting of code listings (through pygments_)\n\n  - `sticky mode`_\n\n  - several new commands to be used from the interactive ``(Pdb++)`` prompt\n\n  - `smart command parsing`_ (hint: have you ever typed ``r`` or ``c`` at the\n    prompt to print the value of some variable?)\n\n  - additional convenience functions in the ``pdb`` module, to be used from\n    your program\n\n``pdb++`` is meant to be a drop-in replacement for ``pdb``. If you find some\nunexpected behavior, please report it as a bug.\n\n.. _pdb: http://docs.python.org/library/pdb.html\n.. _fancycompleter: http://bitbucket.org/antocuni/fancycompleter\n.. _pygments: http://pygments.org/\n\nInstallation\n-------------\n\nSince ``pdb++`` is not a valid identifier for ``pip`` and ``easy_install``,\nthe package is named ``pdbpp``::\n\n    $ pip install pdbpp\n\n    -- OR --\n\n    $ easy_install pdbpp\n\n``pdb++`` is also available via `conda`_::\n\n    $ conda install -c conda-forge pdbpp\n\nAlternatively, you can just put ``pdb.py`` somewhere inside your\n``PYTHONPATH``.\n\n.. _conda: https://anaconda.org/conda-forge/pdbpp\n\nUsage\n-----\n\nNote that the module is called ``pdb.py`` so that ``pdb++`` will automatically\nbe used in all places that do ``import pdb`` (e.g. ``pytest --pdb`` will\ngive you a ``pdb++`` prompt).\n\nThe old ``pdb`` module is still available by doing e.g. ``import pdb;\npdb.pdb.set_trace()``.\n\nNew interactive commands\n------------------------\n\nThe following are new commands that you can use from the interative\n``(Pdb++)`` prompt.\n\n.. _`sticky mode`:\n\n``sticky [start end]``\n  Toggle **sticky mode**.  When in this mode, every time the current position\n  changes, the screen is repainted and the whole function shown.  Thus, when\n  doing step-by-step execution you can easily follow the flow of the\n  execution.  If ``start`` and ``end`` are given, sticky mode is enabled and\n  only lines within that range (extremes included) will be displayed.\n\n\n``longlist`` (``ll``)\n  List source code for the current function.  Different from the normal pdb\n  ``list`` command, ``longlist`` displays the whole function.  The current\n  line is marked with ``->``.  In case of post-mortem debugging, the line\n  which actually raised the exception is marked with ``>>``.  If the\n  ``highlight`` `config option`_ is set and pygments_ is installed, the source\n  code is highlighted.\n\n\n``interact``\n  Start an interative interpreter whose global namespace contains all the\n  names found in the current scope.\n\n\n``track EXPRESSION``\n  Display a graph showing which objects are the value of the expression refers\n  to and are referred by.  This command requires the ``pypy`` source code to\n  be importable.\n\n``display EXPRESSION``\n  Add an expression to the **display list**; expressions in this list are\n  evaluated at each step, and printed every time its value changes.\n  **WARNING**: since these expressions are evaluated multiple times, make sure\n  not to put expressions with side-effects in the display list.\n\n``undisplay EXPRESSION``:\n  Remove ``EXPRESSION`` from the display list.\n\n``source EXPRESSION``\n  Show the source code for the given function/method/class.\n\n``edit EXPRESSION``\n  Open the editor in the right position to edit the given\n  function/method/class.  The editor used is specified in a `config\n  option`_.\n\n``hf_unhide``, ``hf_hide``, ``hf_list``\n  Some frames might be marked as \"hidden\" by e.g. using the `@pdb.hideframe`_\n  function decorator.  By default, hidden frames are not shown in the stack\n  trace, and cannot be reached using ``up`` and ``down``.  You can use\n  ``hf_unhide`` to tell pdb to ignore the hidden status (i.e., to treat hidden\n  frames as normal ones), and ``hf_hide`` to hide them again.  ``hf_list``\n  prints a list of hidden frames.\n  The config option ``enable_hidden_frames`` can be used to disable handling\n  of hidden frames in general.\n\n\nSmart command parsing\n----------------------\n\nBy default, pdb tries hard to interpret what you enter at the command prompt\nas one of its builtin commands.  However, this is inconvenient if you want to\njust print the value of a local variable which happens to have the same name\nas one of the commands. E.g.::\n\n    (Pdb) list\n      1\n      2     def fn():\n      3         c = 42\n      4         import pdb;pdb.set_trace()\n      5  ->     return c\n    (Pdb) c\n\nIn the example above, instead of printing 42 pdb interprets the input as the\ncommand ``continue``, and then you loose your prompt.  It's even worse than\nthat, because it happens even if you type e.g. ``c.__class__``.\n\npdb++ fixes this unfriendly (from the author's point of view, of course :-))\nbehavior by always prefering variable in scope, if it exists.  If you really\nwant to execute the corresponding command, you can prefix it with ``!!``.\nThus, the example above becomes::\n\n    (Pdb++) list\n      1\n      2     def fn():\n      3         c = 42\n      4         import pdb;pdb.set_trace()\n      5  ->     return c\n    (Pdb++) c\n    42\n    (Pdb++) !!c\n\nNote that the \"smart\" behavior takes place only when there is ambiguity, i.e.\nif there exists a variable with the same name as a command: in all other\ncases, everything works as usual.\n\nRegarding the ``list`` command itself, using ``list(\u2026`` is a special case\nthat gets handled as the Python builtin::\n\n    (Pdb++) list([1, 2])\n    [1, 2]\n\nAdditional functions in the ``pdb`` module\n------------------------------------------\n\nThe ``pdb`` module that comes with pdb++ includes all the functions and\nclasses that are in the module from the standard library.  If you find any\ndifference, please report it as a bug.\n\nIn addition, there are some new convenience functions that are unique to\npdb++.\n\n``pdb.xpm()``\n  eXtended Post Mortem: it is equivalent to\n  ``pdb.post_mortem(sys.exc_info()[2])``.  If used inside an ``except``\n  clause, it will start a post-mortem pdb prompt from the line that raised the\n  exception being caught.\n\n``pdb.disable()``\n  Disable ``pdb.set_trace()``: any subsequent call to it will be ignored.\n\n``pdb.enable()``\n  Re-enable ``pdb.set_trace()``, in case it was disabled by ``pdb.disable()``.\n\n.. _`@pdb.hideframe`:\n\n``@pdb.hideframe``\n  A function decorator that tells pdb++ to hide the frame corresponding to the\n  function.  Hidden frames do not show up when using interactive commands such\n  as ``up``, ``down`` or ``where``, unless ``hf_unhide`` is invoked.\n\n``@pdb.break_on_setattr(attrname, condition=always)``\n  class decorator: break the execution of the program every time the\n  attribute ``attrname`` is set on any instance of the class. ``condition`` is\n  a callable that takes the target object of the ``setattr`` and the actual value;\n  by default, it breaks every time the attribute is set. E.g.::\n\n      @break_on_setattr('bar')\n      class Foo(object):\n          pass\n      f = Foo()\n      f.bar = 42    # the program breaks here\n\n  If can be used even after the class has already been created, e.g. if we\n  want to break when some attribute of a particular object is set::\n\n      class Foo(object):\n          pass\n      a = Foo()\n      b = Foo()\n\n      def break_if_a(obj, value):\n          return obj is a\n\n      break_on_setattr('bar', condition=break_if_a)(Foo)\n      b.bar = 10   # no break\n      a.bar = 42   # the program breaks here\n\n  This can be used after ``pdb.set_trace()`` also::\n\n      (Pdb++) import pdb\n      (Pdb++) pdb.break_on_setattr('tree_id')(obj.__class__)\n      (Pdb++) continue\n\n\nConfiguration and customization\n-------------------------------\n\n.. _`config option`:\n\nTo customize pdb++, you can put a file named ``.pdbrc.py`` in your home\ndirectory.  The file must contain a class named ``Config`` inheriting from\n``pdb.DefaultConfig`` and override the desired values.\n\nThe following is a list of the options you can customize, together with their\ndefault value:\n\n``prompt = '(Pdb++) '``\n  The prompt to show when in interactive mode.\n\n``highlight = True``\n  Highlight line numbers and the current line when showing the ``longlist`` of\n  a function or when in **sticky mode**.\n\n``encoding = 'utf-8'``\n  File encoding. Useful when there are international characters in your string\n  literals or comments.\n\n``sticky_by_default = False``\n  Determine whether pdb++ starts in sticky mode or not.\n\n``line_number_color = Color.turquoise``\n  The color to use for line numbers.\n\n``filename_color = Color.yellow``\n  The color to use for file names when printing the stack entries.\n\n``current_line_color = \"39;49;7\"``\n  The SGR parameters for the ANSI escape sequence to highlight the current\n  line.\n  This is set inside the SGR escape sequence ``\\e[%sm`` where ``\\e`` is the\n  ESC character and ``%s`` the given value.  See `SGR parameters`_.\n  The following means \"reset all colors\" (``0``), set foreground color to 18\n  (``48;5;18``), and background to ``21``.\n  The default uses the default foreground (``39``) and background (``49``)\n  colors, inversed (``7``).\n\n``use_pygments = True``\n  If pygments_ is installed and ``highlight == True``, apply syntax highlight\n  to the source code when showing the ``longlist`` of a function or when in\n  **sticky mode**.\n\n``bg = 'dark'``\n  Passed directly to the ``pygments.formatters.TerminalFormatter`` constructor.\n  Selects the color scheme to use, depending on the background color of your\n  terminal. If you have a light background color, try to set it to\n  ``'light'``.\n\n``colorscheme = None``\n  Passed directly to the ``pygments.formatters.TerminalFormatter`` constructor.\n  It expects a dictionary that maps token types to (lightbg, darkbg) color names or\n  ``None`` (default: ``None`` = use builtin colorscheme).\n\n``editor = '${EDITOR:-vi}'``\n  The command to invoke when using the ``edit`` command. By default, it uses\n  ``$EDITOR`` if set, else ``vi``.  The command must support the standard\n  notation ``COMMAND +n filename`` to open filename at line ``n``. ``emacs``\n  and ``vi`` are known to support this.\n\n``truncate_long_lines = True``\n  Truncate lines which exceed the terminal width.\n\n``exec_if_unfocused = None``\n  Shell command to execute when starting the pdb prompt and the terminal\n  window is not focused.  Useful to e.g. play a sound to alert the user that\n  the execution of the program stopped. It requires the wmctrl_ module.\n\n``disable_pytest_capturing = False``\n  Old versions of `pytest`_ crash when you execute ``pdb.set_trace()`` in a\n  test, but the standard output is captured (i.e., without the ``-s`` option,\n  which is the default behavior).  When this option is on, the stdout\n  capturing is automatically disabled before showing the interactive prompt.\n\n``enable_hidden_frames = True``\n  Certain frames can be hidden by default.\n  If enabled, the commands ``hf_unhide``, ``hf_hide``, and ``hf_list`` can be\n  used to control display of them.\n\n``show_hidden_frames_count = True``\n  If ``enable_hidden_frames`` is ``True`` this controls if the number of\n  hidden frames gets displayed.\n\n``def setup(self, pdb): pass``\n  This method is called during the initialization of the ``Pdb`` class. Useful\n  to do complex setup.\n\n``show_traceback_on_error = True``\n  Display tracebacks for errors via ``Pdb.error``, that come from\n  ``Pdb.default`` (i.e. the execution of an unrecognized pdb command),\n  and are not a direct cause of the expression itself (e.g. ``NameError``\n  with a command like ``doesnotexist``).\n\n  With this option disabled only ``*** exception string`` gets printed, which\n  often misses useful context.\n\n``show_traceback_on_error_limit = None``\n  This option sets the limit to be used with ``traceback.format_exception``,\n  when ``show_traceback_on_error`` is enabled.\n\n.. _wmctrl: http://bitbucket.org/antocuni/wmctrl\n.. _`pytest`: https://pytest.org/\n.. _SGR parameters: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters\n\n\nCoding guidelines\n-----------------\n\n``pdb++`` is developed using Test Driven Development, and we try to keep test\ncoverage high.\n\nAs a general rule, every commit should come with its own test. If it's a new\nfeature, it should come with one or many tests which excercise it. If it's a\nbug fix, the test should **fail before the fix**, and pass after.\n\nThe goal is to make refactoring easier in the future: if you wonder why a\ncertain line of code does something, in principle it should be possible to\ncomment it out and see which tests fail.\n\nIn exceptional cases, the test might be too hard or impossible to write: in\nthat cases it is fine to do a commmit without a test, but you should explain\nvery precisely in the commit message why it is hard to write a test and how to\nreproduce the buggy behaviour by hand.\n\nIt is fine NOT to write a test in the following cases:\n\n  - typos, documentation, and in general any non-coding commit\n\n  - code refactorings which do not add any feature\n\n  - commits which fix an already failing test\n\n  - commits to silence warnings\n\n  - purely cosmetic changes, such as change the color of the output\n\n\nCHANGELOG\n=========\n\nChanges between 0.10.2 and 0.10.3\n=================================\n\nMinor bugfix release, moving Continuous Integration from Travis/AppVeyor to\nGitHub Actions, based on changes on master, but without the (more invasive)\n(test) fixes for Windows.\n\n- Fixes\n\n  - Fix hideframe decorator for Python 3.8+ (#263)\n  - Fix hidden_frames discrepancy with IPython (#426)\n\n- Misc\n\n  - ci: move to GitHub Actions (#444, #445)\n  - ci: use .coveragerc (#304)\n  - qa/flake8 fixes\n  - test fix for newer PyPy3\n\nChanges between 0.10.0 and 0.10.2\n=================================\n\nMinor bugfix release to make pdb++ work better with a system-wide installation\nfrom within a virtualenv.\n\n- Fixes\n\n  - Fix pth hack: skip if added already (#297)\n\nVersion 0.10.2 fixes only the deployment configuration.\n\nChanges between 0.9.15 and 0.10.0\n=================================\n\n- Changes\n  - config: improve current_line_color: default fg/bg/inversed (#188)\n  - Show tracebacks for errors with interactively run code (#185)\n\n    This adds new config settings \"show_traceback_on_error\" (default: True),\n    and \"show_traceback_on_error_limit\" (default: None).\n\n- Fixes\n\n  - Fix get_stack for non-last index (#192)\n\n    This fixes a pretty nasty bug, which was triggered e.g. with the \"next\"\n    command running into a deeper exception, and the internal stack getting\n    confused (if hidden frames are involved).\n\n- Misc:\n\n  - doc: document enable_hidden_frames, show_hidden_frames_count (#191)\n  - Make break_on_setattr not rely on @hideframe (#190)\n  - tests: cover sticky mode, small improvements (#177)\n  - doc: correct default value for disable_pytest_capturing\n\nChanges between 0.9.14 and 0.9.15\n=================================\n\n- Fixes\n\n  - Fix completion after debug command (#183)\n\n- Misc\n\n  - tests: fix test_syntaxerror_in_command for Python 3.7.3 (#182)\n  - setup.py: cleanup, testing extra (#181)\n  - test_help: fix restoring of sys.stdout (#180)\n  - tests: move pytest config to setup.cfg, use --pdbcls=pdb:pdb.Pdb (#179)\n  - tests: fix put tests on py27 with user pdbrc (#178)\n  - Improve tests (#176)\n  - Provide message/error methods for py27 (#175)\n\nChanges between 0.9.13 and 0.9.14\n=================================\n\n- Fixes\n\n  - Fix using the debug command multiple times (#174)\n  - Fix backport for bpo-31078 (keeping use_rawinput) (#169)\n\n- Features\n\n  - new config attribute: default_pdb_kwargs, which can be used to pass\n    default keyword arguments for the Pdb class (#167, #173)\n    This can be used to e.g. pass ``skip=[\"importlib._bootstrap_external\"]``.\n\n- Misc\n\n  - test_python_m_pdb_uses_pdbpp: set HOME to tmpdir (#172)\n  - interaction: expand expression to call _cmdloop/cmdloop (#171)\n  - tests: restore sys.gettrace after test, for more coverage (#170)\n\nChanges between 0.9.12 and 0.9.13\n=================================\n\n- Fixes\n\n  - Fix crash in is_skipped_module with no module name (#163)\n\n- Features\n\n  - Optimize get_stack for show_hidden_frames (#162)\n  - Do not consider the frame with set_trace() as hidden (#161)\n\n- Misc\n\n  - DefaultConfig: make it a new-style class (#166)\n  - Setup coverage reporting (#164)\n\nChanges between 0.9.11 and 0.9.12\n=================================\n\n- Fixes\n\n  - Fix forget(): check self.lineno, not GLOBAL_PDB.lineno (#160)\n  - do_debug: use func.__globals__ with rebind_globals (#159)\n  - Use super() (#145)\n\n- Misc\n\n  - tests: set_trace: allow to pass in Pdb class (#158)\n\nChanges between 0.9.8 and 0.9.11\n================================\n\n- Fixes\n\n  - Make wrapper compatible with python2's sys.stdout (#155)\n    This was broken since 0.9.4/0.9.5.\n\nNOTE: 0.9.9 and 0.9.10 were not released to PyPI due to Travis CI\n      misconfiguration.\n\nChanges between 0.9.7 and 0.9.8\n===============================\n\n- Fixes\n\n  - interaction: fix ValueError (\"signal only works in main thread\") (#143)\n  - rebind_globals: update globals() (#151)\n  - Fix do_debug for py38 (#150)\n\n- Misc\n\n  - do_debug: use PdbppWithConfig class (#147)\n  - tests: harden test_debug_with_overridden_continue (#146)\n  - tests: add test_signal_in_nonmain_thread_with_continue\n  - tests: fail if there is anything on stderr\n  - ci: Travis: add Python 3.8-dev\n\nChanges between 0.9.6 and 0.9.7\n===============================\n\n- Fixes\n\n  - do_debug: fix setting of use_rawinput (#141)\n\nChanges between 0.9.5 and 0.9.6\n===============================\n\n- Fixes\n\n  - do_debug: handle SyntaxError (#139)\n  - parseline: handle f-strings with py36 (#138)\n\nChanges between 0.9.3 and 0.9.5\n===============================\n\n- Fixes\n\n  - Fix ``python -m pdb \u2026`` (#135)\n  - Fix \"TypeError: write() argument must be str, not bytes\" with non-utf8\n    terminal encodings (#63)\n  - Handle pdb.Pdb._previous_sigint_handler with Python 3.5.3+ (#87)\n\n- Misc\n\n  - Use ``shutil.get_terminal_size`` if available (#125)\n  - Slightly improve loading of pdb from stdlib (#133)\n\nNOTE: 0.9.4 was not released to PyPI due to Travis CI misconfiguration.\n\nChanges between 0.9.2 and 0.9.3\n===============================\n\n- Features\n\n  - Improve sticky_by_default: don't clear screen the first time (#83)\n  - Handle header kwarg added with Python 3.7 in pdb.set_trace (#115)\n  - config: allow to force use_terminal256formatter (#112)\n  - Add heuristic for which 'list' is meant (#82)\n\n- Fixes\n\n  - Skip/step over ``pdb.set_trace()`` (#119)\n  - Handle completions from original pdb (#116)\n  - Handle set_trace being invoked during completion (#89)\n  - _pdbpp_path_hack/pdb.py: fix ResourceWarning (#97)\n  - Fix \"python -m pdb\" (#108)\n  - setup/interaction: use/handle return value from pdb.Pdb.setup (#107)\n  - interaction: use _cmdloop if available (#106)\n  - Fixed virtualenv sys.path shuffling issue (#85)\n  - set_trace: do not delete pdb.curframe (#103)\n  - forget: only call pdb.Pdb.forget with GLOBAL_PDB once\n\n- Tests\n\n  - Travis: test pypy3\n  - Travis/tox: add py37, remove nightly\n  - tests: PdbTest: use nosigint=True (#117)\n  - Add test_debug_with_overridden_continue (#113)\n  - tests: re-enable/fix test_utf8 (#110)\n  - tests: fix conditional skipping with test_pdbrc_continue\n  - tests: runpdb: print output on Exceptions\n  - pytest.ini: addopts: -ra\n  - tests: handle pytest's ``--assert=plain`` mode\n  - tests: harden check: match all lines\n  - tests: fix flake8 errors and invalid-escape DeprecationWarnings\n\n- Misc\n\n  - setup.py: add trove classifier for \"\u2026 :: Debuggers\"\n  - doc: separate usage section (#105)\n  - Format code: flake8 clean, using autopep8 mainly (#118)\n  - Add wheels support\n  - README: grammar and example for break_on_setattr (#99)\n  - README: fix formatting\n  - Simplify the code, since we no longer support python 2.6\n\nChanges between 0.9.1 and 0.9.2\n===============================\n\n- Add ``LICENSE.txt``.\n- Improved import time for `__version__`.\n\nChanges between 0.8.2 and 0.9.1\n===============================\n\n- Install ``ordereddict`` package only on Python versions older than 2.7.\n\n- Python 3 support\n\n- Improved Windows support\n\n\nChanges between 0.8.1 and 0.8.2\n===============================\n\n- fix wheel packaging; see\n\thttps://bitbucket.org/antocuni/pdb/pull-request/38/support-pip-install-and-wheels-natively/diff\n\nChanges between 0.8 and 0.8.1\n=============================\n\n- fix issue 37: Doesn\u2019t install on OS X\n\t- Removed dependency on ``backports.inspect``\n\t- Made dependency on ``funcsigs`` optional.\n\t- (https://bitbucket.org/antocuni/pdb/issue/37/doesn-t-install-on-os-x)\n\t- (https://bitbucket.org/antocuni/pdb/pull-request/35/use-funcsigs-package-instead-of/diff)\n\nChanges between 0.7.2 and 0.8\n=============================\n\n- Python 3 compatibility\n- Optional support for 256 color formatting by setting\n  ``use_terminal256formatter = True`` in ``~/.pdbrc.py``\n  (https://bitbucket.org/antocuni/pdb/pull-request/30)\n- Make ``set_trace()`` in same program remember previous state\n  (https://bitbucket.org/antocuni/pdb/pull-request/33)\n- Append ``?`` and ``??`` to callable to get info a la IPython\n  (https://bitbucket.org/antocuni/pdb/pull-request/25)\n- Don't treat lines like ``r = 5`` or ``c = 6`` as commands\n  (https://bitbucket.org/antocuni/pdb/pull-request/11)\n\n- fix issue 20: support argument-free post mortem\n\nChanges between 0.7.1 and 0.7.2\n===============================\n\n- don't crash with newer versions of ``py.test``\n\nChanges between 0.7 and 0.7.1\n=============================\n\n- The ``pp`` (pretty print) command now uses the actual width of the terminal,\n  instead of hardcoding 80 columns\n\n- py.test and unittest internal frames are hidden by default (type ``help\n  hidden_frames`` for more info)\n\n- don't crash if ``py`` is installed but ``py.test`` is not\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "pdb++, a drop-in replacement for pdb",
    "version": "0.10.3",
    "split_keywords": [
        "pdb",
        "debugger",
        "tab",
        "color",
        "completion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "07ac96b8f07f3af2826d4518fc6ca2d5",
                "sha256": "79580568e33eb3d6f6b462b1187f53e10cd8e4538f7d31495c9181e2cf9665d1"
            },
            "downloads": -1,
            "filename": "pdbpp-0.10.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07ac96b8f07f3af2826d4518fc6ca2d5",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 23961,
            "upload_time": "2021-07-09T22:22:20",
            "upload_time_iso_8601": "2021-07-09T22:22:20.271179Z",
            "url": "https://files.pythonhosted.org/packages/93/ee/491e63a57fffa78b9de1c337b06c97d0cd0753e88c00571c7b011680332a/pdbpp-0.10.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "aeb9fbc42b7eff6dc7799a61c73e0ce4",
                "sha256": "d9e43f4fda388eeb365f2887f4e7b66ac09dce9b6236b76f63616530e2f669f5"
            },
            "downloads": -1,
            "filename": "pdbpp-0.10.3.tar.gz",
            "has_sig": false,
            "md5_digest": "aeb9fbc42b7eff6dc7799a61c73e0ce4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 68116,
            "upload_time": "2021-07-09T22:22:22",
            "upload_time_iso_8601": "2021-07-09T22:22:22.134231Z",
            "url": "https://files.pythonhosted.org/packages/1f/a3/c4bd048256fd4b7d28767ca669c505e156f24d16355505c62e6fce3314df/pdbpp-0.10.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-07-09 22:22:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "antocuni",
    "github_project": "pdb",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pdbpp"
}
        
Elapsed time: 0.02349s