fix: replace top-level package proxy imports with direct module imports#4972
fix: replace top-level package proxy imports with direct module imports#4972mayankansys merged 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces indirect config imports (via ansys.fluent.core.__init__ or pyfluent.config) with direct imports from ansys.fluent.core.module_config across the source code. This eliminates circular-import constraints that required fragile # isort: off guards in __init__.py by ensuring modules can access config without triggering full package initialization.
Changes:
- Replaced all
from ansys.fluent.core import configandpyfluent.configreferences in 27 source files withfrom ansys.fluent.core.module_config import config - Where
pyfluentwas only used forconfigaccess, removed theimport ansys.fluent.core as pyfluentimport; where it also provided other symbols (e.g.,FluentVersion,launch_fluent,utils.load_module), those were replaced with direct imports from their defining modules - Added a changelog entry for the fix
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/ansys/fluent/core/utils/networking.py |
Replace function-level config import with direct module import |
src/ansys/fluent/core/utils/fluent_version.py |
Add module-level direct config import; update current_release/current_dev |
src/ansys/fluent/core/utils/data_transfer.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/system_coupling.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/streaming_services/datamodel_streaming.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/streaming_services/datamodel_event_streaming.py |
Replace function-level config import |
src/ansys/fluent/core/solver/flobject.py |
Replace function-level config/utils imports with direct imports |
src/ansys/fluent/core/session_solver.py |
Add direct config import; update pyfluent.config references |
src/ansys/fluent/core/session_shared.py |
Replace pyfluent import with direct config and load_module imports |
src/ansys/fluent/core/session_pure_meshing.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/services/interceptors.py |
Replace function-level config imports |
src/ansys/fluent/core/services/health_check.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/services/datamodel_se.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/services/api_upgrade.py |
Replace function-level config import |
src/ansys/fluent/core/search.py |
Consolidate multiple function-level config imports into one module-level import |
src/ansys/fluent/core/logger.py |
Replace top-level config import path |
src/ansys/fluent/core/launcher/slurm_launcher.py |
Move config import to module level from direct module |
src/ansys/fluent/core/launcher/server_info.py |
Replace function-level config imports |
src/ansys/fluent/core/launcher/launcher_utils.py |
Replace function-level config import |
src/ansys/fluent/core/launcher/launcher.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/launcher/launch_options.py |
Replace function-level config import |
src/ansys/fluent/core/launcher/fluent_container.py |
Replace pyfluent import with direct config import |
src/ansys/fluent/core/fluent_connection.py |
Replace pyfluent import with direct config and FluentVersion imports |
src/ansys/fluent/core/docker/docker_compose.py |
Replace function-level config import |
src/ansys/fluent/core/data_model_cache.py |
Replace function-level config import |
src/ansys/fluent/core/codegen/builtin_settingsgen.py |
Replace config and FluentVersion imports with direct module imports |
src/ansys/fluent/core/codegen/allapigen.py |
Replace top-level config import path |
doc/changelog.d/4972.fixed.md |
Changelog entry for the fix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Prithwish Mukherjee <109645853+prmukherj@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Context
Several modules imported
configviafrom ansys.fluent.core import configorimport ansys.fluent.core as pyfluentinstead of importing directly frommodule_config.py. This forced__init__.pyto fully execute before those modules could load, creating artificial circular-import constraints and requiring a fragile manual# isort: offordering guard.Change Summary
Replaced all indirect config imports with:
from ansys.fluent.core.module_config import configRationale
Direct imports bypass
__init__.pyentirely, eliminating the circular dependencyat its root. No logic was changed — only import paths.
Impact
28 files updated. Import order in
__init__.pyis now freely managed by isort.No functional behaviour is affected.