본문으로 건너뛰기
cccskills
무료GitHub에 공개

flight-profiler-module

Translate a file path to its Python module name in a running Python process. Use this when you know a file path but need the module name for commands like watch, trace, or reload.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

flight-profiler-module

Translate a file path to its corresponding Python module name. Most diagnostic commands (watch, trace, reload, getglobal) require a module name — use this to find it from a file path.

Prerequisites: Read the flight-profiler-attach skill first for platform requirements, installation, permissions, and connection details.

When to Use

  • You know the file path but not the module name needed by watch/trace/reload/getglobal
  • The module name isn't obvious from the file structure (e.g., namespace packages, src layouts)
  • You want to confirm the exact module name as seen by the target process's sys.modules

Usage

flight_profiler <pid> --cmd "module <filepath>" --no-color

Arguments

  • filepath — Absolute or relative path to the Python source file. The path is resolved to an absolute path and checked for existence on the client side before sending to the target process.

Output Format

Success — returns the module name as plain text:

__main__

Failure (file not imported) — the file exists but is not loaded in the target process:

filepath: /path/to/file.py is not imported in target process.

Failure (file not found) — the path does not exist on disk (checked client-side):

✗ Parse module argument failed: filepath /path/to/file.py does not exist.

Examples

1. Main script file

The entry-point script is always __main__:

flight_profiler <pid> --cmd "module /Users/zy/workspace/app/main_script.py" --no-color
__main__

2. Standard library module

flight_profiler <pid> --cmd "module /Users/zy/miniforge3/envs/py39/lib/python3.9/json/__init__.py" --no-color
json

3. Module name may differ from file name

os.path on POSIX is actually backed by posixpath.py. The module command returns the real module name:

flight_profiler <pid> --cmd "module /Users/zy/miniforge3/envs/py39/lib/python3.9/posixpath.py" --no-color
posixpath

This is why querying the target process is important — the module name depends on sys.modules, not the file path structure.

4. File exists but not imported by target process

flight_profiler <pid> --cmd "module /Users/zy/workspace/app/unused_module.py" --no-color
filepath: /Users/zy/workspace/app/unused_module.py is not imported in target process.

This means the file was never imported — the module name cannot be resolved. Check if the code path that uses this file has been triggered.

5. File path does not exist

flight_profiler <pid> --cmd "module /nonexistent/path.py" --no-color
✗ Parse module argument failed: filepath /nonexistent/path.py does not exist.

Typical Workflow

The module command is a prerequisite step for other diagnostic commands. Use it when you only have a file path:

# Step 1: Find the module name
flight_profiler <pid> --cmd "module /home/admin/myapp/services/order.py" --no-color
# → myapp.services.order

# Step 2: Use the module name with watch/trace/getglobal
flight_profiler <pid> --cmd "watch myapp.services.order OrderService process_order -n 1" --no-color
flight_profiler <pid> --cmd "trace myapp.services.order OrderService process_order -n 1" --no-color
flight_profiler <pid> --cmd "getglobal myapp.services.order config" --no-color

Tips

  • The module name depends on the target process's sys.path, which may differ from what you'd expect
  • This command queries the target process for the actual module mapping via sys.modules, so it always gives the correct name
  • If the file is not imported yet (lazy import, conditional import), trigger the code path first, then retry
  • For the main entry-point script, the module name is always __main__

Related Commands

  • watch / trace / reload / getglobal — all require module name as first argument

Source Files

  • CLI plugin: flight_profiler/plugins/module/cli_plugin_module.py
  • Parser: flight_profiler/plugins/module/module_parser.py
  • Server plugin: flight_profiler/plugins/module/server_plugin_module.py

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Prerequisites and connection details for attaching to a live Python process with PyFlightProfiler. Read this skill first before using any other PyFlightProfiler command (watch, trace, stack, perf, etc.).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alibaba/PyFlightProfiler462026년 9월 22일 업데이트

Inspect Python module global field or class static field value in a running Python process. Use this for safe, read-only inspection of global variables, configuration objects, or class-level state.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alibaba/PyFlightProfiler462026년 9월 22일 업데이트

Hot-reload a Python function implementation from the latest file content without restarting the process. Use this to apply code fixes live after identifying a bug with watch/trace.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alibaba/PyFlightProfiler462026년 9월 22일 업데이트

Inspect stack frames of a running Python process including thread stacks, native C-level frames, and async coroutine stacks. Use this to see what each thread is currently doing and diagnose hangs, deadlocks, or stuck async tasks.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alibaba/PyFlightProfiler462026년 9월 22일 업데이트

Trace execution time of Python method invocations in a live process with call stack visualization. Use this to see a hierarchical call tree showing which sub-calls are slow and where time is spent within a function.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alibaba/PyFlightProfiler462026년 9월 22일 업데이트

Inspect live Python class instances in a running process — find all instances of a class, examine their attributes/state, or invoke methods on them. Also supports forcing GC. Use this when you need to probe object-level runtime state beyond what watch/getglobal can provide.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

alibaba/PyFlightProfiler462026년 9월 22일 업데이트

alibaba의 스킬 모두 보기

이 스킬의 문제 신고