pymapdl icon indicating copy to clipboard operation
pymapdl copied to clipboard

Simplify doc build

Open germa89 opened this issue 11 months ago • 1 comments

There is a chunk of code which seems unnecesary:

https://github.com/ansys/pymapdl/blob/3f16bf63dc9b4e6e899ed2ea0a7a1b2ca51c223a/src/ansys/mapdl/core/launcher.py#L1576-L1604

This does not need to be in the library.

We can just use Sphinx events to spawn an MAPDL instance.

The pseudo code is as follow:

def spawn_mapdl_instance(app, docname, source):
     app._mapdl = launch_mapdl()  # it should account for local and remote.

def kill_mapdl_instance(app, exception):
    app._mapdl.exit()

def setup(app):
    app.connect('builder-inited', spawn_mapdl_instance)
    app.connect('build-finished', kill_mapdl_instance)

This way, we can remove the mentioned code from the library itself. It has been long irritating my eyes.

Reference: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events

germa89 avatar Mar 21 '24 09:03 germa89

Related to this #2922

germa89 avatar Mar 21 '24 10:03 germa89