Skip to main content

python-imports

Python import style guidelines for absolute and relative imports

설치로 이동

소스 정보

저장소
jr2804/mcp-config-converter
최근 소스 활동
2026년 1월 21일 23:55
감지된 SKILL.md 언어
영어
스타
4
포크
1

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
python-imports
description
Python import style guidelines for absolute and relative imports
license
MIT
compatibility
opencode
metadata
{"related_python_guidelines":"For general Python development standards, use skill `python-guidelines`"}
# Python Import Style ## What I Do Provide guidelines for Python import styles with emphasis on absolute imports. ## Import Rules ### Absolute Imports (Recommended) ```python # ✅ CORRECT - Use absolute imports in regular modules from module.common.types import TestDesign from module.consolidate.parsing import parse_p800_raw_results from package.submodule.utils import helper_function ``` ### Relative Imports (Avoid) ```python # ❌ AVOID - Relative imports in regular modules from .types import TestDesign from ..consolidate.parsing import parse_p800_raw_results ``` ### Exception: __init__.py Files ```python # ✅ EXCEPTION - Relative imports allowed in __init__.py only # Use relative imports when re-exporting from submodules # In package/__init__.py from .parsing import parse_data from .statistics import calculate_stats from .processing import ProcessResult # Public API exports __all__ = ["parse_data", "calculate_stats", "ProcessResult"] ``` ## Import Organization ```python # Standard library imports import os import sys from pathlib import Path from typing import List, Dict # Third-party imports import numpy as np import pandas as pd from rich.console import Console # Local application imports from package.module import function from package.module.class_ import ClassName ``` ## When to Use Me Use this skill when: - Writing import statements - Organizing module structure - Refactoring code - Reviewing imports ## Key Rules 1. **Prefer absolute imports** - More explicit and searchable 2. **Avoid relative imports** - Can be confusing in nested packages 3. **Exception: __init__.py** - Relative imports OK for re-exports 4. **Group by source** - stdlib, third-party, local 5. **No inline imports** - Place all imports at module top ## Rationale - Absolute imports are explicit about module location - Easier to search and refactor across codebase - Prevents ambiguity in nested package structures - Consistent with project structure documentation
GitHub에서 보기