Skip to content

feat: session submodule #3895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: feat/main_commands
Choose a base branch
from
Open

Conversation

clatapie
Copy link
Contributor

@clatapie clatapie commented May 6, 2025

Description

This PR follows the PyConverter-XML2Py integration plan to automate the PyMAPDL_commands documentation.
The changes have been generated using pyconverter-xml2py and more specifically mapdl-cmd-conv.

This PR focus on the session submodule.

You can check the mapdl-cmd-conv documentation to have a look at the output of each submodules.

Pinging @ansys/pymapdl-developers for visibility. Feel free to provide any feedback on the way the docstrings and the source code generation are handled.

Issue linked

This PR is meant to be merged within the feat/main_commands branch. The latter will gather all the submodule changes, one by one, prior to be merged to the main branch.

Checklist

Summary by Sourcery

Implement the post26 submodule for PyMAPDL, following the PyConverter-XML2Py integration plan to automate documentation generation

New Features:

  • Add post26 submodule with comprehensive command implementations
  • Implement classes for different aspects of POST26 postprocessing such as SetUp, Controls, Display, Listing, Operations, Special Purpose, and Status

Chores:

  • Reorganize project structure to accommodate the new submodule
  • Remove old post26_ directory

Summary by Sourcery

Implement the session submodule for PyMAPDL, following the PyConverter-XML2Py integration plan to automate documentation generation

New Features:

  • Add comprehensive documentation and implementation for session-related MAPDL commands

Enhancements:

  • Refactor and update session-related command implementations
  • Improve type hinting and docstring documentation

Documentation:

  • Add documentation for session submodule commands
  • Create index and documentation files for session commands

@clatapie clatapie self-assigned this May 6, 2025
@clatapie clatapie requested a review from a team as a code owner May 6, 2025 11:04
@clatapie clatapie requested review from germa89 and pyansys-ci-bot and removed request for a team May 6, 2025 11:04
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

Copy link

sourcery-ai bot commented May 6, 2025

Reviewer's Guide

This pull request implements the session submodule commands by leveraging the pyconverter-xml2py tool for automated code generation. The core of the changes involves replacing manually written Python methods in run_controls.py, files.py, processor_entry.py, and list_controls.py with their auto-generated counterparts. This process standardizes method signatures to match APDL commands, incorporates comprehensive docstrings directly sourced from APDL documentation (complete with hyperlinks), and ensures consistent APDL command string construction. Accompanying these code changes, the documentation structure for the session submodule has been updated, including the removal of old RST files and the addition of a new index file and a changelog entry.

Updated Class Diagram for RunControls

classDiagram
    class RunControls {
        +keyw(**kwargs)
        +slashexit(slab: str, fname: str, ext: str, **kwargs)
        +pause(**kwargs)
        +uis(label: str, value: int | str, **kwargs)
        +ui(func: str, type_: str, format_: str, screen: str, color: str, krev: str, orient: str, compress: str, quality: str, **kwargs)
        +unpause(**kwargs)
        +mstart(label: str, key: str, **kwargs)
        +memm(lab: str, kywrd: str, **kwargs)
        +menu(key: str, **kwargs)
        +nerr(nmerr: str, nmabt: str, ifkey: str, num: int | str, **kwargs)
        +output(fname: str, ext: str, loc: str, **kwargs)
        +input(fname: str, ext: str, dir_: str, line: str, log: int | str, **kwargs)
        +cwd(dirpath: str, **kwargs)
        +config(lab: str, val: str, **kwargs)
        +sys(string: str, **kwargs)
        +syp(string: str, arg1: str, arg2: str, arg3: str, arg4: str, arg5: str, arg6: str, arg7: str, arg8: str, **kwargs)
        +slashstatus(lab: str, **kwargs)
        +filname(fname: str, key: str, **kwargs)
    }
    note for RunControls "Methods updated with auto-generated code from pyconverter-xml2py. Docstrings and signatures standardized."
Loading

Updated Class Diagram for ProcessorEntry

classDiagram
    class ProcessorEntry {
        +post26(**kwargs)
        +post1(**kwargs)
        +prep7(**kwargs)
        +quit(**kwargs)
        +slashsolu(**kwargs)
        +finish(**kwargs)
    }
    note for ProcessorEntry "Methods updated with auto-generated code. Methods aux2, aux3, aux12, aux15 are no longer part of this class."
Loading

Updated Class Diagram for ListControls

classDiagram
    class ListControls {
        +golist(**kwargs)
        +gopr(**kwargs)
        +slashgo(**kwargs)
        +nopr(**kwargs)
        +nolist(**kwargs)
        +com(comment: str, **kwargs)
    }
    note for ListControls "Methods updated with auto-generated code from pyconverter-xml2py. Method slashgo added. Docstrings and signatures standardized."
Loading

File-Level Changes

Change Details Files
Replaced manual implementations of APDL commands in the session submodule with auto-generated code from pyconverter-xml2py.
  • Updated Python method signatures and parameters to match APDL command syntax.
  • Embedded extensive docstrings generated from official APDL documentation, including direct links.
  • Standardized internal APDL command string assembly and removed previous module-level docstrings.
src/ansys/mapdl/core/_commands/session/run_controls.py
src/ansys/mapdl/core/_commands/session/files.py
src/ansys/mapdl/core/_commands/session/processor_entry.py
src/ansys/mapdl/core/_commands/session/list_controls.py
Updated the documentation build process and file structure for the session submodule to reflect auto-generated content.
  • Deleted obsolete RST files previously used for session command documentation.
  • Added a new index.rst for the session submodule documentation.
  • Included a changelog entry for the new feature.
doc/source/mapdl_commands/session/files.rst
doc/source/mapdl_commands/session/list_controls.rst
doc/source/mapdl_commands/session/processor_entry.rst
doc/source/mapdl_commands/session/run_controls.rst
doc/changelog.d/3894.documentation.md
doc/source/mapdl_commands/session/index.rst

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added documentation Documentation related (improving, adding, etc) new feature Request or proposal for a new feature labels May 6, 2025
Copy link
Collaborator

@germa89 germa89 left a comment

Choose a reason for hiding this comment

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

LGTM. Minor changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we having two changelog fragments? It happened the same with #3892 ...


def fclean(self, **kwargs):
"""Deletes all local files in all processors in a distributed parallel processing run.
**Solution Control Options**
Copy link
Collaborator

Choose a reason for hiding this comment

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

extra spaces in the sections

Suggested change
**Solution Control Options**
**Solution Control Options**
image

Comment on lines +541 to +542
Pressure loads from ``SURF154``elements are converted to equivalent nodal loads for ASAS. For AQWA-
WAVE, the ``SURF154``pressures are used to identify the wetted surface of the underlying elements.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing space

Suggested change
Pressure loads from ``SURF154``elements are converted to equivalent nodal loads for ASAS. For AQWA-
WAVE, the ``SURF154``pressures are used to identify the wetted surface of the underlying elements.
Pressure loads from ``SURF154`` elements are converted to equivalent nodal loads for ASAS. For AQWA-
WAVE, the ``SURF154`` pressures are used to identify the wetted surface of the underlying elements.

Comment on lines 85 to 100
Notes
-----

.. _s-NOPR_notes:

Suppresses printout of interpreted input data, including information labeled as "Notes." When this
printout is not suppressed, the data input to the analysis is echoed to the output file in an
expanded format. Printout is suppressed until a :ref:`gopr` or :ref:`slashgo` command is read.

Use of :ref:`nopr` is not recommended when the graphical user interface (GUI) is active. The GUI
sometimes issues "hidden" :ref:`nopr` and :ref:`gopr` command sequences, which will countermand
user-issued :ref:`nopr` commands, thus making the use of :ref:`nopr` in the GUI environment
unpredictable.

This command is valid in any processor.
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add here also a warning mentioning that PyMAPDL requirest these printouts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can add a warning (or a note depending of what you prefer) at the top of this function description. Could you specify what you expect in it please?


.. _ui_coll_label:

Label specifying the behavior of the Mechanical APDL main menu after a :ref:`finish` command is issued. User interaction with the main menu is unaffected. Valid only for ``Func`` = COLL:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Label specifying the behavior of the Mechanical APDL main menu after a :ref:`finish` command is issued. User interaction with the main menu is unaffected. Valid only for ``Func`` = COLL:
Label specifying the behavior of the Mechanical APDL main menu after a :ref:`finish` command is issued. User interaction with the main menu is unaffected. Valid only for ``Func`` = COLL:


CONFIG - List only configuration parameters.
* ``:, label`` - Begins reading from the first line beginning with the matching user-defined label :
Copy link
Collaborator

Choose a reason for hiding this comment

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

Extra ,.

Suggested change
* ``:, label`` - Begins reading from the first line beginning with the matching user-defined label :
* ``:label`` - Begins reading from the first line beginning with the matching user-defined label :

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Investigating why this extra comma appears here.

or another file switching directive is read. An end-of-file occurs after the last record of the file
or when a ``/EOF`` command is read. An automatic switch back one level (to the previous file) occurs
when an end-of-file is encountered. Twenty levels of nested file switching are allowed. Note that
files including ``\*DO``, :ref:`use`, :ref:`ulib`, and the "Unknown Command" Macro have less nesting
Copy link
Collaborator

Choose a reason for hiding this comment

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

??

Suggested change
files including ``\*DO``, :ref:`use`, :ref:`ulib`, and the "Unknown Command" Macro have less nesting
files including :ref:`do`, :ref:`use`, :ref:`ulib`, and the "Unknown Command" Macro have less nesting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Investigating why this command is not correctly handled.

@clatapie
Copy link
Contributor Author

Latest attempts are intended to fix the pytest errors.

@germa89
Copy link
Collaborator

germa89 commented May 27, 2025

Latest attempts are intended to fix the pytest errors.

@clatapie I just fixed the CICD pipeline.

The mypy precommit hook can by bypassed using SKIP env var

SKIP=mypy git commit -m "feat: my commit message"

@clatapie
Copy link
Contributor Author

Thank you very much @germa89!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation related (improving, adding, etc) new feature Request or proposal for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants