Skip to content
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

Deprecating CORBA and Python 3.8 #2517

Merged
merged 17 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ body:
description: Run `python --version` to verify your Python version
multiple: false
options:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ body:
description: Run `python --version` to verify your Python version
multiple: false
options:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']
# Only perform wheelhouse builds for macOS when releasing
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: marcoroth/dependabot-bump-together-action@main
with:
dependencies: ansys-api-mapdl, ansys-corba, ansys-dpf-core, ansys-mapdl-reader, ansys-math-core, ansys-platform-instancemanagement, ansys-sphinx-theme, ansys-tools-path, autopep8, click, grpcio, imageio, imageio-ffmpeg, importlib-metadata, jupyter_sphinx, jupyterlab, matplotlib, numpy, numpydoc, pandas, pexpect, platformdirs, plotly, protobuf, psutil, pyansys-tools-report, pyansys-tools-versioning, pyiges, pyiges[full], pypandoc, pytest, pytest-cov, pytest-pyvista, pytest-rerunfailures, pytest-sphinx, pythreejs, pyvista, scipy, sphinx, sphinx-autobuild, sphinx-autodoc-typehints, sphinx-copybutton, sphinx-gallery, sphinx-reredirects, sphinxcontrib-websupport, sphinxemoji, tqdm, vtk
dependencies: ansys-api-mapdl, ansys-dpf-core, ansys-mapdl-reader, ansys-math-core, ansys-platform-instancemanagement, ansys-sphinx-theme, ansys-tools-path, autopep8, click, grpcio, imageio, imageio-ffmpeg, importlib-metadata, jupyter_sphinx, jupyterlab, matplotlib, numpy, numpydoc, pandas, pexpect, platformdirs, plotly, protobuf, psutil, pyansys-tools-report, pyansys-tools-versioning, pyiges, pyiges[full], pypandoc, pytest, pytest-cov, pytest-pyvista, pytest-rerunfailures, pytest-sphinx, pythreejs, pyvista, scipy, sphinx, sphinx-autobuild, sphinx-autodoc-typehints, sphinx-copybutton, sphinx-gallery, sphinx-reredirects, sphinxcontrib-websupport, sphinxemoji, tqdm, vtk
package_managers: pip
directory: /
branch: main
Expand Down
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ ignore:
- "src/ansys/mapdl/core/_commands"
- "src/ansys/mapdl/core/jupyter.py"
- "src/ansys/mapdl/core/mapdl_console.py"
- "src/ansys/mapdl/core/mapdl_corba.py"

comment:
layout: "diff"
Expand Down
10 changes: 2 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "ansys-mapdl-core"
version = "0.68.dev0"
description = "A Python wrapper for Ansys MAPDL."
readme = "README.rst"
requires-python = ">=3.8,<3.13"
requires-python = ">=3.9,<3.13"
license = {file = "LICENSE"}
authors = [
{name = "Ansys, Inc.", email = "[email protected]"},
Expand All @@ -18,7 +18,6 @@ maintainers = [
]
dependencies = [
"ansys-api-mapdl==0.5.1", # supports at least 2020R2 - 2022R1
"ansys-corba; python_version < '3.9'",
"ansys-mapdl-reader>=0.51.7",
"ansys-math-core>=0.1.2",
"ansys-platform-instancemanagement~=1.0",
Expand Down Expand Up @@ -48,7 +47,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -66,8 +64,7 @@ tests = [
"ansys-dpf-core==0.10.0",
"autopep8==2.0.4",
"matplotlib==3.8.1",
"scipy==1.10.1; python_version < '3.9'", # to support python 3.8
"scipy==1.11.3; python_version > '3.8'",
"scipy==1.11.3",
"pandas==2.1.2",
"pyiges[full]==0.3.1",
"pytest==7.4.3",
Expand Down Expand Up @@ -131,7 +128,6 @@ filterwarnings = [
]
markers = [
"skip_grpc: skip tests using grpc",
"corba: skip tests using the CORBA interface",
"gui: skip tests that launch the GUI interface",
]
testpaths = "tests"
Expand All @@ -150,10 +146,8 @@ source = ["ansys/pymapdl"]
omit = [
# omit commands
"ansys/mapdl/core/_commands/*",

# ignore legacy interfaces
"ansys/mapdl/core/mapdl_console.py",
"ansys/mapdl/core/mapdl_corba.py",
"ansys/mapdl/core/jupyter.py",
]

Expand Down
7 changes: 7 additions & 0 deletions src/ansys/mapdl/core/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@
RuntimeError.__init__(self, msg)


class DeprecationError(RuntimeError):
"""Provides the error for deprecated commands, classes, interfaces, etc"""

def __init__(self, msg=""):
RuntimeError.__init__(self, msg)

Check warning on line 126 in src/ansys/mapdl/core/errors.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/errors.py#L126

Added line #L126 was not covered by tests


# handler for protect_grpc
def handler(sig, frame): # pragma: no cover
"""Pass signal to custom interrupt handler."""
Expand Down
69 changes: 19 additions & 50 deletions src/ansys/mapdl/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from ansys.mapdl.core import LOG
from ansys.mapdl.core._version import SUPPORTED_ANSYS_VERSIONS
from ansys.mapdl.core.errors import (
DeprecationError,
LockFileException,
MapdlDidNotStart,
MapdlRuntimeError,
Expand Down Expand Up @@ -64,7 +65,7 @@
)

CONFIG_FILE = os.path.join(SETTINGS_DIR, "config.txt")
ALLOWABLE_MODES = ["corba", "console", "grpc"]
ALLOWABLE_MODES = ["console", "grpc"]

ON_WSL = os.name == "posix" and (
bool(os.environ.get("WSL_DISTRO_NAME", None))
Expand Down Expand Up @@ -1015,17 +1016,12 @@
Mode to launch MAPDL. Must be one of the following:

- ``'grpc'``
- ``'corba'``
- ``'console'``

The ``'grpc'`` mode is available on ANSYS 2021R1 or newer and
provides the best performance and stability. The ``'corba'``
mode is available from v17.0 and newer and is given legacy
support. However only Python up to 3.8 is supported.
This mode requires the additional ``ansys_corba`` module.
Finally, the ``'console'`` mode
is for legacy use only Linux only prior to v17.0. This console
mode is pending depreciation.
provides the best performance and stability.
The ``'console'`` mode is for legacy use only Linux only prior to 2020R2.
This console mode is pending depreciation.
Visit :ref:`versions_and_interfaces` for more information.

override : bool, optional
Expand Down Expand Up @@ -1186,14 +1182,9 @@
by default. See :ref:`vpn_issues_troubleshooting` for more information.
Defaults to ``False``.

log_broadcast : :class:`bool`
*(Only for CORBA mode)*
Enables a logger to record broadcasted commands.
Defaults to ``False``.

Returns
-------
Union[MapdlGrpc, MapdlConsole, MapdlCorba]
Union[MapdlGrpc, MapdlConsole]
An instance of Mapdl. Type depends on the selected ``mode``.

Notes
Expand Down Expand Up @@ -1328,10 +1319,6 @@
>>> mapdl = launch_mapdl(start_instance=False, ip='192.168.1.30',
... port=50001)

Force the usage of the CORBA protocol (not recommended).

>>> mapdl = launch_mapdl(mode='corba')

Run MAPDL using the console mode (not recommended, and available only on Linux).

>>> mapdl = launch_mapdl('/ansys_inc/v194/ansys/bin/ansys194',
Expand Down Expand Up @@ -1374,6 +1361,11 @@
# Extract arguments:
force_intel = kwargs.pop("force_intel", False)
broadcast = kwargs.pop("log_broadcast", False)
if broadcast:
raise ValueError(

Check warning on line 1365 in src/ansys/mapdl/core/launcher.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/launcher.py#L1365

Added line #L1365 was not covered by tests
"The CORBA interface has been deprecated from 0.67."
"Hence this argument is not valid."
)
use_vtk = kwargs.pop("use_vtk", None)

# Transferring MAPDL arguments to start_parameters:
Expand Down Expand Up @@ -1610,8 +1602,9 @@
}
)

if mode in ["console", "corba"]:
if mode == "console":
start_parm["start_timeout"] = start_timeout

else:
start_parm["ram"] = ram
start_parm["override"] = override
Expand All @@ -1633,24 +1626,7 @@
mapdl = MapdlConsole(
loglevel=loglevel, log_apdl=log_apdl, use_vtk=use_vtk, **start_parm
)
elif mode == "corba":
try:
# pending deprecation to ansys-mapdl-corba
from ansys.mapdl.core.mapdl_corba import MapdlCorba
except ModuleNotFoundError: # pragma: no cover
raise ModuleNotFoundError(
"To use this feature, install the MAPDL CORBA package"
" with:\n\npip install ansys_corba"
) from None

mapdl = MapdlCorba(
loglevel=loglevel,
log_apdl=log_apdl,
log_broadcast=broadcast,
verbose=verbose_mapdl,
use_vtk=use_vtk,
**start_parm,
)

elif mode == "grpc":
port, actual_run_location, process = launch_grpc(
port=port,
Expand Down Expand Up @@ -1713,19 +1689,13 @@
elif os.name == "posix":
raise VersionError("gRPC mode requires MAPDL 2021R1 or newer.")
elif mode == "corba":
warnings.warn(
"The CORBA interface is going to be deprecated with the version"
raise DeprecationError(

Check warning on line 1692 in src/ansys/mapdl/core/launcher.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/launcher.py#L1692

Added line #L1692 was not covered by tests
"The CORBA interface has been deprecated with the"
" v0.67 release. Please use the gRPC interface instead.\n"
"For more information visit: "
"https://mapdl.docs.pyansys.com/version/0.66/getting_started/versioning.html#corba-interface"
)
if version < 170:
raise VersionError("CORBA AAS mode requires MAPDL v17.0 or newer.")
if version >= 211:
warnings.warn(
"CORBA AAS mode not recommended in MAPDL 2021R1 or newer.\n"
"Recommend using gRPC mode instead."
)

elif mode == "console":
if os.name == "nt":
raise ValueError("Console mode requires Linux.")
Expand All @@ -1746,18 +1716,17 @@
elif version == 202 and os.name == "nt":
# Windows supports it as of 2020R2
mode = "grpc"
elif version >= 170:
mode = "corba"
else:
if os.name == "nt":
raise VersionError(
"Running MAPDL as a service requires "
"v17.0 or greater on Windows."
"MAPDL 2020R2 or greater on Windows."
)
mode = "console"

if version < 130:
warnings.warn("MAPDL as a service has not been tested on MAPDL < v13")
mode = "console"

Check warning on line 1729 in src/ansys/mapdl/core/launcher.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/mapdl/core/launcher.py#L1729

Added line #L1729 was not covered by tests

return mode

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/mapdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def print_com(self, value):

@property
def connection(self):
"""Return the type of connection to the instance, namely: grpc, corba or console."""
"""Return the type of connection to the instance, namely: grpc, or console."""
return self._mode

@property
Expand Down
Loading
Loading