Skip to content

4176 docstrings still in the rst format#4213

Merged
timothy-nunn merged 10 commits intomainfrom
4176-docstrings-still-in-the-rst-format
May 5, 2026
Merged

4176 docstrings still in the rst format#4213
timothy-nunn merged 10 commits intomainfrom
4176-docstrings-still-in-the-rst-format

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

Description

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

chris-ashe and others added 8 commits April 29, 2026 11:17
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…e docstring for parameters

Co-authored-by: Copilot <copilot@github.com>
…meters and return values

Co-authored-by: Copilot <copilot@github.com>
…r parameters

Co-authored-by: Copilot <copilot@github.com>
…or parameters

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 29, 2026 10:33
@chris-ashe chris-ashe requested a review from a team as a code owner April 29, 2026 10:33
@chris-ashe chris-ashe added the Data structure Issues related to the data structure label Apr 29, 2026
@chris-ashe chris-ashe linked an issue Apr 29, 2026 that may be closed by this pull request
…tyle for parameters

Co-authored-by: Copilot <copilot@github.com>
@chris-ashe chris-ashe force-pushed the 4176-docstrings-still-in-the-rst-format branch from e944e7e to b4b7515 Compare April 29, 2026 10:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the migration away from reStructuredText-style docstrings toward Numpy-style docstrings across several PROCESS modules, and adds/updates some type annotations to improve readability and tooling support.

Changes:

  • Converted multiple docstrings from :param/:type RST format to Numpy docstring sections.
  • Added/updated type annotations on a few constructors/initializers.
  • Introduced new imports to support the added type annotations.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
process/models/physics/plasma_current.py Updates a function docstring to Numpy style for the Peng current coefficient helper.
process/models/physics/impurity_radiation.py Adds a PlasmaProfile type annotation and converts __init__ docstring to Numpy style.
process/models/ife.py Converts IFE.__init__ docstring to Numpy style.
process/models/blankets/blanket_library.py Converts several blanket segment-length docstrings to Numpy style.
process/core/solver/evaluators.py Adds typing imports/annotations and converts Evaluators.__init__ docstring to Numpy style.
process/core/scan.py Adds typing imports/annotations and converts Scan.__init__ docstring to Numpy style.
process/core/log.py Adds a type annotation to ProcessLogHandler.__init__ and converts docstring to Numpy style.
process/core/io/in_dat/base.py Adds a str type annotation for StructuredInputData.__init__ and converts docstring to Numpy style.
process/core/caller.py Converts Caller.__init__ docstring to Numpy style.
Comments suppressed due to low confidence (2)

process/core/scan.py:33

  • from process.main import Models introduces an import cycle: process/main.py imports process.core.scan.Scan, and scan.py now imports Models back from process.main, which will break module import/CLI startup. Use postponed annotations + TYPE_CHECKING (or quote the annotation) so Models is only imported for type checking, not at runtime.
    process/core/solver/evaluators.py:13
  • from process.main import Models here is a runtime dependency that can create an import cycle (solver/scan/main import chain) and is only needed for type hints. Prefer from __future__ import annotations and a TYPE_CHECKING-guarded import (or quoting Models) to avoid importing process.main at module import time.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

:rtype: float
Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section is using : as the return type/name placeholder. In Numpydoc this should be a concrete type (e.g. float) so that Sphinx/numpydoc can render it correctly.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Comment on lines +1496 to +1513
n_blkt_outboard_modules_poloidal :
Number of outboard blanket modules in poloidal direction
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
rminor :
Minor radius of the plasma (m)
dr_fw_plasma_gap_outboard :
Radial gap between outboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Fractional poloidal length of the divertor in single null configuration

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Parameters entries omit the types after the colon (contrast with other functions in this module that use name : float/int). Adding the types will keep docstrings consistent and more reliably parsed by Numpydoc/Sphinx.

Suggested change
n_blkt_outboard_modules_poloidal :
Number of outboard blanket modules in poloidal direction
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
rminor :
Minor radius of the plasma (m)
dr_fw_plasma_gap_outboard :
Radial gap between outboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Fractional poloidal length of the divertor in single null configuration
Returns
-------
:
n_blkt_outboard_modules_poloidal : int
Number of outboard blanket modules in poloidal direction
dr_fw_plasma_gap_inboard : float
Radial gap between inboard first wall and plasma (m)
rminor : float
Minor radius of the plasma (m)
dr_fw_plasma_gap_outboard : float
Radial gap between outboard first wall and plasma (m)
dz_blkt_half : float
Half-height of the blanket module (m)
n_divertors : int
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single : float
Fractional poloidal length of the divertor in single null configuration
Returns
-------
float

Copilot uses AI. Check for mistakes.

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder rather than an explicit return type. Please change this to the appropriate type (likely float) for correct Numpydoc rendering.

Suggested change
:
float

Copilot uses AI. Check for mistakes.

Parameters
----------
plasma_profile :
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring was converted to Numpy style but the parameter line omits the type after the colon. Consider using plasma_profile : PlasmaProfile (or a broader protocol/interface type) to match Numpydoc expectations and improve rendered docs.

Suggested change
plasma_profile :
plasma_profile : PlasmaProfile

Copilot uses AI. Check for mistakes.
Comment on lines +1561 to +1575
rmajor :
Major radius of the plasma (m)
rminor :
Minor radius of the plasma (m)
triang :
Triangularity of the plasma
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Parameters entries omit types after the colon, which is inconsistent with other Numpy-style docstrings in this module (e.g. ... : float). Please add the parameter types to match the established format.

Suggested change
rmajor :
Major radius of the plasma (m)
rminor :
Minor radius of the plasma (m)
triang :
Triangularity of the plasma
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
rmajor : float
Major radius of the plasma (m)
rminor : float
Minor radius of the plasma (m)
triang : float
Triangularity of the plasma
dr_fw_plasma_gap_inboard : float
Radial gap between inboard first wall and plasma (m)
dz_blkt_half : float
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal : int
Number of inboard blanket modules in poloidal direction
n_divertors : int
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single : float

Copilot uses AI. Check for mistakes.
Comment on lines +1468 to +1475
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file, other Numpy-style docstrings use param : type (e.g. z_plasma_xpoint_lower : float). These new parameter entries omit the type, which is inconsistent and can reduce doc rendering quality. Consider adding the types after the colon.

Suggested change
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction
Returns
-------
:
dz_blkt_half : float
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal : int
Number of inboard blanket modules in poloidal direction
Returns
-------
float

Copilot uses AI. Check for mistakes.

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder rather than a return type. Numpydoc expects a type here (e.g. float) so the generated documentation is correct.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Comment thread process/core/caller.py
Comment on lines +38 to +42
Parameters
----------
models :
physics and engineering model objects
data :
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conversion to Numpy-style docstring removed the parameter types (even though other docstrings in this file include them, e.g. previous : float | np.ndarray). Consider using models : Models and data : DataStructure for consistency and better doc rendering.

Copilot uses AI. Check for mistakes.

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder instead of a return type. Please use an explicit type (likely float) so Numpydoc renders the return value correctly.

Suggested change
:
float

Copilot uses AI. Check for mistakes.

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder instead of a type. For Numpydoc-style docstrings, provide the return type (likely float) so documentation builds cleanly.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.15%. Comparing base (25b9f07) to head (32eb361).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
process/models/blankets/blanket_library.py 78.57% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4213      +/-   ##
==========================================
+ Coverage   52.10%   52.15%   +0.04%     
==========================================
  Files         148      148              
  Lines       30389    30435      +46     
==========================================
+ Hits        15835    15874      +39     
- Misses      14554    14561       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread process/core/scan.py Outdated

Returns
-------
:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwscook Is saying to not put types in the docstring


Returns
-------
:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


Returns
-------
:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float


Returns
-------
:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

:rtype: float
Returns
-------
:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

@timothy-nunn timothy-nunn self-assigned this May 5, 2026
@timothy-nunn timothy-nunn removed the Data structure Issues related to the data structure label May 5, 2026
Co-authored-by: Copilot <copilot@github.com>
@timothy-nunn timothy-nunn merged commit a52c41e into main May 5, 2026
10 of 11 checks passed
@timothy-nunn timothy-nunn deleted the 4176-docstrings-still-in-the-rst-format branch May 5, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docstrings still in the RST format

4 participants