Skip to main content

Classify

PyPI Version GitHub Actions Workflow Status Python Versions

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 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.

If you've used CCBV, but wanted it for any Python class, then classify is here to help.

Installation

Classify imports the classes you point it at, so it has to live alongside the code you want to look at. Install it as a development dependency of the project you're inspecting, in the same virtual environment.

Beyond that it's an ordinary Python package, so however you usually install one will do, eg:

pip install classify

or

uv add --dev classify

Examples

Simple class hierarchy

Take this example:

class Greeter:
    def greet(self):
        return f"Hello, {self.name}"


class Person(Greeter):
    def __init__(self, name):
        self.name = name

    def greet(self):
        return f"Croeso, {self.name}"

pass it to classify via its dotted path:

classify dotted.path.to.Person

and it shows you everything Person has defined on it.

Overridden methods are included, earliest in the inheritance tree first, with a comment to say which class they were defined on.

class Person(Greeter):

    def __init__(self, name):
        self.name = name

    # Defined on: Greeter
    def greet(self):
        return f"Hello, {self.name}"

    def greet(self):
        return f"Croeso, {self.name}"

Curious how it works with a larger class? Try it out with the standard library's http.server.SimpleHTTPRequestHandler, which has 3 parent classes in its inheritance tree:

classify http.server.SimpleHTTPRequestHandler

Django

Django classes (models, forms, etc.) work too, as long as you give classify a settings module to bootstrap Django with.

Take a model:

from django.db import models


class Article(models.Model):
    title = models.CharField(max_length=200)
    slug = models.SlugField(unique=True)
    published = models.DateTimeField(null=True)

    class Meta:
        app_label = "docs"

    def __str__(self):
        return self.title

and pass its dotted path along with --django-settings:

classify docs.models.Article --django-settings docs.settings

Fields are rendered as the source that declared them, using the same serialiser Django writes migrations with:

class Article(Model):
    """
    Article(id, title, slug, published)
    """
    id = models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')
    objects = docs.Article.objects
    published = models.DateTimeField(null=True)
    slug = models.SlugField(unique=True)
    title = models.CharField(max_length=200)

    # ... 779 more lines

Django is only imported when you pass --django-settings, so it doesn't need to be installed otherwise.

Usage

Usage: classify [OPTIONS] KLASS

  See everything a Python class inherits, and the code behind it.

Options:
  --console-theme TEXT            Theme to render console output with, any
                                  Pygments style works here  [default:
                                  monokai]
  --debug                         Show debug logs
  --django-settings TEXT          Pass a dotted path to your Django settings
                                  when using with a Django project.
                                  classify.contrib.django.settings exists if
                                  you need it.
  --renderer [console|html|pager]
                                  How would you like your content rendered?
                                  [default: console]
  -o, --output DIRECTORY          Path for output files to be saved
  -p, --port INTEGER              The port to serve content at, requires
                                  --serve  [default: 8000]
  -s, --serve                     Serve HTML content, requires --renderer=html
  --version                       Show the version and exit.
  --help                          Show this message and exit.

--console-theme takes the name of any style Pygments ships with; they're listed at https://pygments.org/styles/.

Metadata

Release files for classify 2026.10.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for classify 2026.10.1
File Size Uploaded
classify-2026.10.1.tar.gz 14.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for classify 2026.10.1
File Interpreter ABI Platform
classify-2026.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 34.9 kB

Release files / classify-2026.10.1.tar.gz

Download URL classify-2026.10.1.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7b83710f1a7da1eca10d6b0c31035f4fd04fcc3ae09aba3f169cf8905f39e750
BLAKE2b-256 checksum
How to use checksums
d7e612f9172771e955c7c3b39f8b1124611067ac1bb30137132df66a4ca2be35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / classify-2026.10.1-py3-none-any.whl

Download URL classify-2026.10.1-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48cc12690cd1c2c8b517a521f8c6a2297f2c416d303c0f7d1dfd800541329590
BLAKE2b-256 checksum
How to use checksums
901b54a64b85a421c181b4061f7889db8b0acff10a58c4e36f0a418ee9eeed52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.10.1 This release

2 release files

0.5.0

2 release files

0.4.1

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page