friendly-dis
A drop-in replacement for Python's dis module that adds human-friendly descriptions to every bytecode instruction.
Installation
pip install friendly-dis
Usage
As a library
import friendly_dis
# Disassemble a string of source code
friendly_dis.dis("x = 1; print(x)")
# Disassemble a function
def example(a, b):
return a + b
friendly_dis.dis(example)
# Disassemble a code object
code = compile("x = 1", "<test>", "exec")
friendly_dis.disassemble(code)
As a CLI
# Disassemble a file
python -m friendly_dis script.py
# Or via the entry point
friendly-dis script.py
# Disassemble from stdin
echo "x = 1" | python -m friendly_dis
Example output
0 RESUME 0 # Internal: resume execution of a code object
1 LOAD_SMALL_INT 1 # Load small integer 1 onto the stack
STORE_NAME 0 (x) # Store top of stack into name 'x'
LOAD_NAME 1 (print) # Load name 'print' onto the stack
PUSH_NULL # Push a NULL onto the stack
LOAD_NAME 0 (x) # Load name 'x' onto the stack
CALL 1 # Call function with 1 argument
POP_TOP # Remove the top of stack
LOAD_CONST 1 (None) # Load constant None onto the stack
RETURN_VALUE # Return the top of stack to the caller
API
The module provides the same interface as dis:
dis(x, *, file=None, depth=None, show_caches=False, adaptive=False)— Disassemble classes, methods, functions, code objects, or source strings.disassemble(co, lasti=-1, *, file=None, show_caches=False, adaptive=False)— Disassemble a code object.distb(tb=None, *, file=None, show_caches=False, adaptive=False)— Disassemble a traceback.describe(opname, arg, argval, argrepr)— Get a human-friendly description for any bytecode instruction.
Compatibility
Supports CPython 3.12+, including 3.14's new opcodes and specialized instructions.
License
MIT
History
This project was created almost entirely by a coding agent, with little human checking. Use at own risk.
Metadata
Release files for friendly-dis 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| friendly_dis-0.1.0.tar.gz | 10.9 kB | Without provenance | Details for friendly_dis-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| friendly_dis-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for friendly_dis-0.1.0-py3-none-any.whl |
Total release size: 23.3 kB
Release files / friendly_dis-0.1.0.tar.gz
| Download URL | friendly_dis-0.1.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68eb792a9aab7f4f33400333122292ba5490035b841ac0bff162a42ad30c9e3f
|
|
BLAKE2b-256 checksum How to use checksums |
4b58cac26e2199aec96a064ae387dae7a98036e843f3c5732cacd5b250205efa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.6
|
Release files / friendly_dis-0.1.0-py3-none-any.whl
| Download URL | friendly_dis-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e2087ac21f915e33549636e6a4919416db9bb2f762672c2cb0c602dff119f54
|
|
BLAKE2b-256 checksum How to use checksums |
5dfa835f465bbe1b613470a3d97faba122f7943de5ed45f49a8213f9b5f7caa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.6
|
Security for friendly-dis 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.