Software Engineering Technical Guidance

Practical notes and examples focused on AWS + Python: Lambda, S3, API Gateway, security, debugging, and deployment patterns.

Save to S3 S3 via presigned URL

Guidance on technology engineering issues.

Python 8–3 Formatting Specs

Default conventions for examples and internal scripts.

8 core formatting rules

  • Indentation: 4 spaces; never tabs.
  • Line length: target 88–100 characters; wrap long expressions cleanly.
  • Imports: standard library, third-party, local; one per line.
  • Whitespace: spaces around operators; no extra spaces inside parentheses/brackets.
  • Blank lines: two around top-level defs/classes; one between methods.
  • Naming: snake_case functions/vars, PascalCase classes, UPPER_SNAKE constants.
  • Docstrings: triple-quote; first line is an imperative summary; document args/returns when non-obvious.
  • Typing: type hints at function boundaries; prefer simple, accurate types.

3 “don’t get cute” rules

  • Prefer clarity over cleverness: explicit beats magic.
  • Small functions: single purpose, obvious inputs/outputs.
  • Fail loudly: validate assumptions with assertions/logging where it matters.

Quick example

from __future__ import annotations

from dataclasses import dataclass
from typing import Optional


@dataclass(frozen=True)
class SaveResult:
    object_key: str
    ok: bool
    error: Optional[str] = None

Python 8–3 Formatting Specs

Same content as on the main page, shown here as a dedicated view via the menu.

8 core formatting rules

  • Indentation: 4 spaces; never tabs.
  • Line length: target 88–100 characters; wrap long expressions cleanly.
  • Imports: standard library, third-party, local; one per line.
  • Whitespace: spaces around operators; no extra spaces inside parentheses/brackets.
  • Blank lines: two around top-level defs/classes; one between methods.
  • Naming: snake_case functions/vars, PascalCase classes, UPPER_SNAKE constants.
  • Docstrings: triple-quote; first line is an imperative summary; document args/returns when non-obvious.
  • Typing: type hints at function boundaries; prefer simple, accurate types.

3 “don’t get cute” rules

  • Prefer clarity over cleverness: explicit beats magic.
  • Small functions: single purpose, obvious inputs/outputs.
  • Fail loudly: validate assumptions with assertions/logging where it matters.
  • Be deterministic: avoid hidden state; log decisions in trading/system automation contexts.

Quick example

from __future__ import annotations

from dataclasses import dataclass
from typing import Optional


@dataclass(frozen=True)
class SaveResult:
    object_key: str
    ok: bool
    error: Optional[str] = None