profimp

Profile Python import times and generate an HTML waterfall report.

383|92|Updated Apr 30, 2022
One-click install
npx skills add https://github.com/scverse/spatialdata --skill profimp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: profimp
Source: https://github.com/scverse/spatialdata/tree/main/.claude/skills/profimp
Command: npx skills add https://github.com/scverse/spatialdata --skill profimp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you diagnose slow Python startup by showing exactly which imports and sub-imports take the most time.

Core Features & Use Cases

  • Import-time profiling: Produces a detailed timing breakdown of nested imports for a chosen import statement.
  • Waterfall HTML report: Generates an interactive HTML waterfall visualization to pinpoint bottlenecks quickly.
  • Use Case: When importing spatialdata (or related modules) feels sluggish, you can profile import spatialdata or a specific entry point like from spatialdata import SpatialData to identify the most expensive dependency chain.

Quick Start

Run: profimp --html "import spatialdata" > /tmp/profimp.html

Frequently Asked Questions about profimp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile Python import time to find slow startup bottlenecks?

To profile Python import time, you can execute a command that measures the timing breakdown of nested imports for a specific statement, helping you identify exactly which modules cause slow startup.

What causes slow Python startup performance in import-heavy libraries?

Slow Python startup performance is typically caused by expensive nested sub-imports within import-heavy libraries, where deep dependency chains consume significant initialization time when the modules are first loaded.

Can I visualize Python import costs using a waterfall report?

Yes, you can generate an interactive HTML waterfall report to visualize Python import costs, allowing you to quickly pinpoint the most expensive dependency chains and sub-imports.

How do I debug a sluggish import statement for a specific module?

You can debug a sluggish import statement by running a profiling command that outputs an HTML file, then opening the generated report using standard OS methods to inspect the timing breakdown.

Does this import profiling approach work for comparing before and after performance changes?

Yes, this import profiling approach applies to comparing before and after performance changes by running the import timing breakdown on your target statement to measure the impact of your optimizations.