원클릭으로
pep8-style-guide
Write idiomatic, readable Python code following PEP 8 – the official Python style guide.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Write idiomatic, readable Python code following PEP 8 – the official Python style guide.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Creates, configures, and updates Databricks Lakeflow Spark Declarative Pipelines (SDP/LDP) using serverless compute. Handles data ingestion with streaming tables, materialized views, CDC, SCD Type 2, and Auto Loader ingestion patterns. Use when building data pipelines, working with Delta Live Tables, ingesting streaming data, implementing change data capture, or when the user mentions SDP, LDP, DLT, Lakeflow pipelines, streaming tables, or bronze/silver/gold medallion architectures.
Write, structure, and maintain high-quality pytest test suites following official pytest documentation best practices.
Write clean, testable, and maintainable Python code using functional programming principles — pure functions, immutability, higher-order functions, and composable pipelines.
Write idiomatic, performant PySpark code following the Palantir PySpark Style Guide.
| name | pep8-style-guide |
| description | Write idiomatic, readable Python code following PEP 8 – the official Python style guide. |
When writing or reviewing Python code, follow these rules derived from PEP 8 – Style Guide for Python Code.
Use 4 spaces per indentation level. Never use tabs.
Continuation lines should align with the opening delimiter, or use a hanging indent with a distinguishing blank line before the first argument:
# aligned with opening delimiter
foo = long_function_name(var_one, var_two,
var_three, var_four)
# hanging indent – 4 extra spaces to distinguish from the body
def long_function_name(
var_one, var_two,
var_three, var_four):
print(var_one)
Closing brackets may line up under the last element or under the first character of the line that starts the construct:
# good
result = some_function_that_takes_arguments(
'a', 'b', 'c',
'd', 'e', 'f',
)
Limit all lines to 79 characters. Docstrings and comments: 72 characters.
Wrap long lines using Python's implicit line continuation inside parentheses, brackets, or braces. Never use \ for line continuation.
from module import *).# bad
import sys, os
# good
import os
import sys
from typing import List
from pyspark.sql import SparkSession
Avoid extraneous whitespace:
# bad
spam( ham[ 1 ], { eggs : 2 } )
# good
spam(ham[1], {eggs: 2})
# bad
x = x *2- 1
# good
x = x * 2 - 1
Always surround these binary operators with a single space on each side: =, +=, -=, comparisons, Booleans.
When mixing operators with different priorities, add spaces around the lowest-priority operators only:
# good
hypot2 = x*x + y*y
c = (a+b) * (a-b)
Use a trailing comma on the last element of a tuple, list, function argument list, or import when each element is on its own line:
# good
FILES = (
'setup.cfg',
'tox.ini',
)
# and a single space."""Docstrings""" for all public modules, functions, classes, and methods.def fetch_data(url: str) -> dict:
"""Fetch JSON data from the given URL.
Args:
url: The endpoint to query.
Returns:
Parsed JSON response as a dictionary.
"""
| Construct | Convention | Example |
|---|---|---|
| Packages & modules | lowercase or lower_with_underscores | my_module |
| Classes | CapWords (PascalCase) | MyClass |
| Exceptions | CapWords ending with Error | ValueError |
| Functions & variables | snake_case | my_function |
| Constants | ALL_CAPS_WITH_UNDERSCORES | MAX_RETRIES |
| Private names | leading underscore _name | _helper |
| "Magic" names | double underscores __name__ | __init__ |
Avoid single-character names except for counters (i, j, k) or well-known mathematical variables.
Never use l (lowercase L), O (uppercase O), or I (uppercase I) as single-character variable names.
Use type annotations for all public function signatures (PEP 484):
# good
def greet(name: str) -> str:
return f"Hello, {name}"
Be consistent — pick single or double quotes and stick with it throughout a file. Use the other style to avoid backslashes inside a string:
# good – avoids escape
message = "Don't do this"
is / is not to compare with None, never == or !=.if seq: / if not seq: to test empty sequences, not if len(seq) == 0.isinstance() instead of type() for type comparisons.Exception, not BaseException.with statements to ensure resources are properly released.None implicitly.# bad
def foo(x):
if x >= 0:
return math.sqrt(x)
# good
def foo(x):
if x >= 0:
return math.sqrt(x)
return None
This project uses ruff (configured in pyproject.toml) to enforce PEP 8 automatically.
Running pre-commit run --all-files will apply ruff formatting and flag any remaining style issues.
Always run pre-commit before opening a PR.