See everything a Python class inherits, and the code behind it.
Classify walks a class's MRO, gathers every member it inherits (methods, attributes, properties, etc), and displays the class as though it had all been written in one place, source code included.
It outputs to the terminal or HTML, or you can use it as a library and do what you want with the results.
pip install classifyor
uv add --dev classifyTake a simple class hierarchy:
class Parent:
def method(self):
print("parent")
class Child(Parent):
def method(self):
print("child")pass it to classify via its dotted path:
classify dotted.path.to.Childand it shows you everything Child has defined on it:
class Child(Parent):
# Defined on: Parent
def method(self):
print("parent")
def method(self):
print("child")classify <path.to.Class>This outputs the full class definition, including any members defined on parent classes or mixins.
You can change the theme to any Pygments theme with --console-theme.
Output to your shell's pager with --renderer pager, or to ccbv style pages with --renderer html.
By default HTML documents are saved to a temporary directory.
To change this specify a relative location with the --output option.
You can serve the output, regardless of where its written to with --serve, and change the port with --port.
classify <path.to.Class> --renderer html --output output --serve --port 8080CCBV has long been a part of my everyday toolkit for working with Django's generic class-based views. It's a fantastic resource for quick reference, but it only covers Django's GCBVs.
Classify aims to provide this same level of utility for all your Python classes.