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

Adding warnings for Python 3.8 #2245

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
name: "Build documentation"
runs-on: ubuntu-latest
needs: doc-style
timeout-minutes: 35
timeout-minutes: 45
outputs:
PYMAPDL_VERSION: ${{ steps.version.outputs.PYMAPDL_VERSION }}
env:
Expand Down
29 changes: 29 additions & 0 deletions src/ansys/mapdl/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Importing logging
import logging
import os
import sys
from warnings import warn

import platformdirs

Expand All @@ -11,6 +13,33 @@
if not os.path.exists(USER_DATA_PATH): # pragma: no cover
os.makedirs(USER_DATA_PATH)

DEPRECATING_MINIMUM_PYTHON_VERSION = True
MINIMUM_PYTHON_VERSION = (3, 8)

first_time_file = os.path.join(USER_DATA_PATH, ".firstime")
if not os.path.exists(first_time_file): # pragma: no cover
py_ver = f"{sys.version_info[0]}.{sys.version_info[1]}"
py_ver_min = f"{MINIMUM_PYTHON_VERSION[0]}.{MINIMUM_PYTHON_VERSION[1]}"

if (
sys.version_info[1] == MINIMUM_PYTHON_VERSION[1]
and DEPRECATING_MINIMUM_PYTHON_VERSION
):
warn(
f"Support for Python {py_ver} will be dropped in the next minor " "release."
)

if sys.version_info[1] <= MINIMUM_PYTHON_VERSION[1]:
warn(
f"Python {py_ver} is not being tested or officially supported. "
"It is recommended you use a newer version of Python. "
f"The mininimum supported and tested version is {py_ver_min}.\n\n"
"**This warning is shown only the first time you run PyMAPDL.**\n"
)

with open(first_time_file, "w") as fid:
fid.write("")

EXAMPLES_PATH = os.path.join(USER_DATA_PATH, "examples")

from ansys.mapdl.core.logging import Logger
Expand Down