DHV is a Python code exploration tool for the terminal, designed to let you
type in, load up, and edit Python code, and see what the resulting abstract
syntax tree and bytecode looks like.
If you've ever felt curious about what your Python source code gets turned
into, this is one tool that might help satisfy that curiosity.
Once you've installed DHV using one of the above methods,
you can run the application using the dhv command.
Command line options
DHV has a number of command line options; they include:
-b, --bindings
Prints the application commands whose keyboard bindings can be modified,
giving the defaults too.
dhv--bindings
ChangeCodeTheme - Change the theme of the Python code editor.
Default: ctrl+f9
ChangeTheme - Change the application's theme
Default: f9
Help - Show help for and information about the application
Default: f1, ?
LoadFile - Load the content of a Python source file.
Default: ctrl+l
NewCode - Empty the editor ready to enter some new code.
Default: ctrl+n
Quit - Quit the application
Default: f10, ctrl+q
ShowASTOnly - Only show the AST of the source code.
Default: ctrl+t
ShowDisassemblyAndAST - Show both the disassembly and the AST of the source code.
Default: ctrl+o
ShowDisassemblyOnly - Only show the disassembly of the source code.
Default: ctrl+b
SwitchLayout - Switch the screen layout between horizontal and vertical.
Default: f2
ToggleOffsets - Toggle the display of the offsets
Default: f3
ToggleOpcodes - Toggle the display of the numeric opcodes
Default: f4
-h, --help
Prints the help for the dhv command.
dhv--help
usage: dhv [-h] [-v] [--license] [-b] [-t THEME] [source]
DHV - A tool to dive into Python code.
positional arguments:
source A Python source file to disassemble
options:
-h, --help show this help message and exit
-v, --version Show version information
--license, --licence Show license information
-b, --bindings List commands that can have their bindings changed
-t, --theme THEME Set the theme for the application (set to ? to list
available themes)
v0.4.1
--license, --licence
Prints a summary of DHV's license.
dhv--license
DHV - A Python code explorer for the terminal.
Copyright (C) 2025 Dave Pearson
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
-t, --theme
Sets DHV's theme; this overrides and changes any previous theme choice made
via the user interface.
To see a list of available themes use ? as the theme name:
When doing so, please do search past discussions and also issues current
and previous to make sure I've not
already dealt with this, or don't have your proposed change already flagged
as something to do.