Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Python __init__.py __all__ FormatterNew to Visual Studio Code? Get it now.
Python __init__.py __all__ Formatter

Python __init__.py __all__ Formatter

taka-labs

| (0) | Free
Formats __all__ in __init__.py based on imports.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Python init.py all Formatter

English | 日本語


Demo

English {#english}

VS Code extension that automatically formats and generates __all__ in Python __init__.py files based on import statements.

Features

  • Automated __all__ Generation: Reads import and from ... import ... statements in __init__.py and generates/updates __all__.
  • Duplicate Removal & Sorting: Automatically deduplicates imported names and sorts them alphabetically.
  • ContextMenu Support: Easily execute from the right-click context menu in the Explorer or Editor on __init__.py files.
  • Internationalization (i18n): Fully supports English and Japanese UI/messages.

Usage

  1. Open a Python __init__.py file in the editor or select it in the Explorer.
  2. Right-click on the file or inside the editor.
  3. Select "Format all in init.py" from the context menu. (Alternatively, run the Format __all__ in __init__.py command from the Command Palette Ctrl+Shift+P / Cmd+Shift+P)

Example

Before

from .rm import safe_remove
from .bin import write_bytes
from .comp import cmp_is_equal_fast
from .hash import get_file_hash, comp_file_hash

After Formatting

from .rm import safe_remove
from .bin import write_bytes
from .comp import cmp_is_equal_fast
from .hash import get_file_hash, comp_file_hash

__all__ = [
    'cmp_is_equal_fast',
    'comp_file_hash',
    'get_file_hash',
    'safe_remove',
    'write_bytes',
]

Requirements

  • Visual Studio Code v1.85.0 or higher.

日本語 {#japanese}

Pythonの __init__.py 内のインポート記述を解析し、__all__ リストを自動生成・整形するVS Code拡張機能です。

主な機能

  • __all__ の自動生成: __init__.py 内の import および from ... import ... 文を読み込み、アルファベット順にソートされた __all__ を自動生成・更新します。
  • 重複除去: インポートされた名前の重複を自動的に排除します。
  • コンテキストメニュー対応: エクスプローラーやエディター上で __init__.py を右クリックして簡単に実行できます。
  • 多言語対応: 日本語および英語の表示に対応しています。

使い方

  1. エディターで __init__.py を開くか、エクスプローラー上で対象の __init__.py を選択します。
  2. エディター内またはエクスプローラー上で右クリックします。
  3. メニューから 「init.py の all を整形」 を選択します。 (コマンドパレット Ctrl+Shift+P / Cmd+Shift+P から __init__.py の __all__ を整形 を実行することも可能です)

実行例

実行前

from .rm import safe_remove
from .bin import write_bytes
from .comp import cmp_is_equal_fast
from .hash import get_file_hash, comp_file_hash

整形実行後

from .rm import safe_remove
from .bin import write_bytes
from .comp import cmp_is_equal_fast
from .hash import get_file_hash, comp_file_hash

__all__ = [
    'cmp_is_equal_fast',
    'comp_file_hash',
    'get_file_hash',
    'safe_remove',
    'write_bytes',
]

License

Apache License 2.0

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft