Back to list
jr2804

python-imports

by jr2804

This project converts MCP server configurations from any format into the one for your coding agent of choice - just by using any available LLM!

2🍴 0📅 Jan 21, 2026

SKILL.md


Python Import Style

What I Do

Provide guidelines for Python import styles with emphasis on absolute imports.

Import Rules

# ✅ 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)

# ❌ AVOID - Relative imports in regular modules
from .types import TestDesign
from ..consolidate.parsing import parse_p800_raw_results

Exception: init.py Files

# ✅ 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

# 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

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon