ansys / ansys/pyfluent

Session classes should raise runtime errors instead of hiding attributes when Fluent server exits

Open
#4,626 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
497
Forks
77
Avg merge
22h 37m
Merged PRs (30d)
45

Description

**Current behavior**
In the PyFluent session classes, several methods and properties (e.g., those requiring an active Fluent connection) are **hidden or become inaccessible** once the Fluent server exits or the session becomes disconnected. This results in an unstable public API, makes introspection difficult, and can cause unexpected `AttributeError` issues.

**Problem**
Dynamically removing or hiding attributes based on connection state causes:

* Confusing errors (`AttributeError` instead of a clear connection-related exception)
* Unpredictable API surface, making documentation, typing, and IDE support harder
* Subtle bugs when tooling (e.g., Sphinx Gallery, auto-reset hooks) tries to inspect session objects

**Proposed improvement**
Keep the full API available at all times, but **raise a clear and consistent runtime exception** (e.g., `NotConnectedError`, `RuntimeError`, etc.) when a property or method is accessed and the session is not connected.

This provides:

* A stable, inspectable session interface
* More informative and debuggable exception messages
* Better compatibility with automated tools and Sphinx extension hooks

---

Contributor guide

Open the contributing guide

Research direction

Start by tracing the PyFluent session classes and the methods and properties whose availability changes after the Fluent server exits. Examine how disconnected sessions interact with Sphinx Gallery and auto-reset hooks, then define the consistent runtime exception behavior and verify that the full session API remains inspectable while disconnected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.