com um clique
docstring-deep-dive
// Quality bar for docstrings in albumentations. Use when writing or updating docstrings in albumentations/, especially for transforms and public APIs.
// Quality bar for docstrings in albumentations. Use when writing or updating docstrings in albumentations/, especially for transforms and public APIs.
Full checklist for adding a new transform to AlbumentationsX. Use when the user asks to add, implement, or create a new transform/augmentation.
Run performance benchmarks for transform changes. Use when the user asks to benchmark, measure performance, compare speed, or when changes affect apply methods, functional layer, get_params, or core pipeline code.
Use the repo `_internal/` directory for anything that must not be committed — scratch files, temporary outputs, local demos, Codex artifacts, or one-off scripts. Use when creating temp files, debug dumps, or local-only tooling during a task.
Policy for AlbumentationsX transforms that combine multiple images or objects. Use when implementing, reviewing, or using Mosaic, CopyAndPaste, OverlayElements, HistogramMatching, PixelDistributionAdaptation, or other mixing transforms.
Generate release notes for AlbumentationsX. Use when the user asks to prepare, draft, or write release notes for a new version (e.g. "prepare release notes for 2.x.y", "draft release X").
Run the full shared Codex review checklist against a transform. Use when the user asks to review, audit, or check a transform for correctness, performance, or API consistency.
| name | docstring-deep-dive |
| description | Quality bar for docstrings in albumentations. Use when writing or updating docstrings in albumentations/, especially for transforms and public APIs. |
Apply these criteria to every docstring you write or update in albumentations (transforms, public functions, and any API that appears on the docs site).
Transform apply methods: Do not add docstrings to apply, apply_to_image, apply_to_mask, apply_to_images, or other apply_to_* methods in transform classes. The transform class docstring and the base interface in transforms_interface are sufficient; apply methods are implementation detail.
The first paragraph is the useful short description: an elevator pitch that explains intuitively what the function or transform does. It appears as the web/search preview under the link.
# noqa: E501.Good example (first paragraph, elevator pitch, two lines):
"""Sharpen the image via unsharp masking: blur, subtract from original, add back with
strength. Use when you need crisp edges without changing overall brightness.
More detail...
Do not include: "Used by X" or "Used in Y"; "Parameters: ..." or "Params: ..."; "Preserves channel count" / "preserves dtype" / "preserves shape" (boilerplate); return type or "Supports uint8/float32". Describe what it does and when to use it. Keep return type only in Returns; "Targets"/"Same shape" in a later paragraph if needed.
Bad example (do not use): Filling the 120–160 chars with meta boilerplate instead of an elevator pitch:
"""Apply Gaussian blur using a randomly sized kernel. Params: blur_range, sigma_range.
Supports image, volume. See Args and Examples.
param (float): Description).dict[str, Any]: ... or None).docs/contributing/codex_guidelines.md and the add-transform skill: sample
image, mask, bboxes, keypoints, Compose with params, and a call showing the result. Use >>> for doctest-style
blocks.- per item) with 2–4 alternatives and brief when-to-use hints (e.g. - RandomFog: Patch-based fog; use when…). One transform per bullet — do not combine multiple transforms in a single bullet.- per point). Note is pure info only — no call-to-action (no "Explore other transforms…" or "Consider using…"). Put discoverability in See also, not in Note.Together, the docstring should give a new user: