Skip to main content

classmap-hanthink

classmap-hanthink is a small Python developer tool that scans Python files and shows class inheritance relationships as a readable tree.

Simple explanation:

It helps you see which class is the parent and which classes are children.

Technical explanation:

It parses Python source code with the standard ast module, extracts class definitions and base classes, builds a parent-to-child inheritance map, and renders the result as a text tree.

Installation

pip install classmap-hanthink

CLI Usage

Scan the current folder:

classmap .

Scan a specific file:

classmap examples/sample_classes.py

Show explanation text:

classmap . --explain

Show Mermaid class diagram output:

classmap . --mermaid

Python Usage

from classmap_hanthink import scan_path, build_inheritance_map, render_text_tree

classes = scan_path("examples/sample_classes.py")
tree = build_inheritance_map(classes)
print(render_text_tree(classes, tree))

Example Output

classmap report

Target: examples/sample_classes.py
Classes found: 6

Inheritance Tree

Animal [examples/sample_classes.py:1]
├── Cat [examples/sample_classes.py:13]
└── Dog [examples/sample_classes.py:5]
    └── Puppy [examples/sample_classes.py:9]

Independent Classes

- Config [examples/sample_classes.py:17]
- ExternalChild [examples/sample_classes.py:21]

Development

uv sync --group dev
uv run pytest tests/ -v
uv build

Release Roadmap

v0.1.0

  • Scan Python files and folders
  • Extract class names, base classes, file paths, and line numbers
  • Build parent-to-child inheritance relationships
  • Render text tree output
  • Render optional explanation output
  • Render optional Mermaid classDiagram output
  • Provide CLI command: classmap

External Base Classes

Use --show-external to show classes that inherit from external or built-in base classes.

classmap examples/sample_classes.py --show-external

Example output:

External Base Classes

dict
└── ExternalChild [examples/sample_classes.py:21]

Metadata

Release files for classmap-hanthink 0.2.0

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

Source distribution (sdist)

Source distribution for classmap-hanthink 0.2.0
File Size Uploaded Provenance Actions
classmap_hanthink-0.2.0.tar.gz 13.3 kB Without provenance Details for classmap_hanthink-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for classmap-hanthink 0.2.0
File Interpreter ABI Platform Actions
classmap_hanthink-0.2.0-py3-none-any.whl Python 3 none any Details for classmap_hanthink-0.2.0-py3-none-any.whl

Total release size: 20.6 kB

Release files / classmap_hanthink-0.2.0.tar.gz

Download URL classmap_hanthink-0.2.0.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e2f1c3e7faa7d8a4ef650526e9ac061474718b0dbfcd39fa591619f147a63ba0
BLAKE2b-256 checksum
How to use checksums
9a9614aa3ff10338250366954b2f0bc545b8e36096907683b1dafced1c3b377f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / classmap_hanthink-0.2.0-py3-none-any.whl

Download URL classmap_hanthink-0.2.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f81b6337a19df2f8f2a892106d4a45b4e8096df69e5523c1e3033cee8420229b
BLAKE2b-256 checksum
How to use checksums
40e896504c77fca68adb88be5984566304e09e277c11e897ade077050c2b1cd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for classmap-hanthink 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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