You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: add field instructions and fixed cross references (#138)
<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION
& AFFILIATES. All rights reserved. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->
<!-- Thank you for contributing to Safe Synthesizer! -->
# Summary
<!-- Brief description of changes -->
## Pre-Review Checklist
<!-- These checks should be completed before a PR is reviewed, -->
<!-- but you can submit a draft early to indicate that the issue is
being worked on. -->
Ensure that the following pass:
- [ ] `make format && make lint` or via prek validation.
- [ ] `make test` passes locally
- [ ] `make test-e2e` passes locally
- [ ] `make test-ci-container` passes locally (recommended)
## Pre-Merge Checklist
<!-- These checks need to be completed before a PR is merged, -->
<!-- but as PRs often change significantly during review, -->
<!-- it's OK for them to be incomplete when review is first requested.
-->
- [ ] New or updated tests for any fix or new behavior
- [ ] Updated documentation for new features and behaviors, including
docstrings for API docs.
## Other Notes
<!-- Please add the issue number that should be closed when this PR is
merged. -->
- Closes #<issue>
---------
Signed-off-by: Sean Yang <seayang@nvidia.com>
Signed-off-by: memadi <memadi@nvidia.com>
Signed-off-by: aagonzales <aagonzales@nvidia.com>
Signed-off-by: Aaron Gonzales <aagonzales@nvidia.com>
Co-authored-by: Aaron Gonzales <aagonzales@nvidia.com>
Co-authored-by: Marjan Emadi <memadi@nvidia.com>
Copy file name to clipboardExpand all lines: STYLE_GUIDE.md
+69-13Lines changed: 69 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -459,6 +459,49 @@ Put constructor `Args:` in the class docstring, not on `__init__`. IDEs (Cursor,
459
459
460
460
Include both when a class has nontrivial constructor parameters AND public attributes worth documenting. For simple classes where the args and attributes are the same fields, `Args:` alone is sufficient.
461
461
462
+
#### Field-level docstrings for Pydantic models and dataclasses
463
+
464
+
Pydantic models and dataclasses: document each field with an inline docstring immediately after the field definition. Omit the `Attributes:` section to avoid duplication. Regular classes that set attributes in `__init__` should still use `Attributes:` (as in the Tier 3 example above).
465
+
466
+
```python
467
+
classRopeScaling(BaseModel):
468
+
"""Rotary Position Embedding (RoPE) scaling configuration.
469
+
470
+
Encapsulates the parameters needed to extend a model's context
# ... remaining fields follow the same pattern ...
541
585
```
542
586
543
587
Generator with `Yields:` instead of `Returns:`:
@@ -607,7 +651,19 @@ The before/after examples above demonstrate most rules. These additional points
607
651
- Document side effects, thread safety, and idempotency guarantees where applicable
608
652
- Use `Example:` sections with working code for public API methods
609
653
- Complex code deserves proportionally detailed explanation -- err on the side of more context
610
-
- Cross-references in docstrings: use double backticks (` `` `) for inline code, `:meth:`method_name``, `:class:`ClassName``, and `:func:`function_name`` for API cross-links in `MkDocs`/Sphinx
654
+
- Cross-references in docstrings: use double backticks for inline code. For clickable API cross-links, use the `mkdocstrings` autorefs syntax:
0 commit comments