From 89ada8ac1525a259eec28bde128a5b50bc5e6798 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 31 May 2023 13:05:54 +0200 Subject: [PATCH 01/11] Improving cache management (#2068) * Using setup-python cache option. Setting a workflow for cleaning up cache * Update .github/workflows/ci.yml --- .github/workflows/cache_cleaner.yml | 56 +++++++++++++++++++++++++++++ .github/workflows/ci.yml | 20 ++--------- 2 files changed, 59 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/cache_cleaner.yml diff --git a/.github/workflows/cache_cleaner.yml b/.github/workflows/cache_cleaner.yml new file mode 100644 index 0000000000..e65222e589 --- /dev/null +++ b/.github/workflows/cache_cleaner.yml @@ -0,0 +1,56 @@ +name: cleanup caches by a branch +on: + workflow_dispatch: + pull_request: + types: + - closed + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Cleanup PR caches + if: github.event_name != 'workflow_dispatch' + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm && echo "Deleting cache with key: $cacheKey" + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Cleanup by workflow dispatch + if: github.event_name == 'workflow_dispatch' + run: | + gh extension install actions/gh-actions-cache + + REPO=${{ github.repository }} + + echo "Fetching list of cache key" + cacheKeysForPR=$(gh actions-cache list -R $REPO | cut -f 1 ) + + ## Setting this to not fail the workflow while deleting cache keys. + set +e + echo "Deleting caches..." + for cacheKey in $cacheKeysForPR + do + gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm && echo "Deleting cache with key: $cacheKey" + done + echo "Done" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 949423ae17..051de94132 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,6 @@ env: # You should go up in number, if you go down (or repeat a previous value) # you might end up reusing a previous cache if it haven't been deleted already. # It applies 7 days retention policy by default. - RESET_PIP_CACHE: 0 RESET_EXAMPLES_CACHE: 0 RESET_DOC_BUILD_CACHE: 0 RESET_AUTOSUMMARY_CACHE: 0 @@ -100,6 +99,7 @@ jobs: - name: "Setup Python" uses: actions/setup-python@v4 with: + cache: 'pip' python-version: ${{ env.MAIN_PYTHON_VERSION }} - name: "Install OS packages" @@ -107,14 +107,6 @@ jobs: sudo apt update sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk graphviz - - name: "Cache pip" - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} - restore-keys: | - Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }} - - name: "Test virtual framebuffer" run: | pip install -r .ci/requirements_test_xvfb.txt @@ -288,6 +280,8 @@ jobs: - name: "Setup Python" uses: actions/setup-python@v4 with: + cache: 'pip' + cache-dependency-path: pyproject.toml python-version: ${{ env.MAIN_PYTHON_VERSION }} - name: "Install os packages" @@ -295,14 +289,6 @@ jobs: sudo apt update sudo apt install libgl1-mesa-glx xvfb - - name: "Cache pip" - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} - restore-keys: | - Python-v${{ env.RESET_PIP_CACHE }}-Linux-${{ env.MAIN_PYTHON_VERSION }} - - name: "Test virtual framebuffer" run: | pip install -r .ci/requirements_test_xvfb.txt From 58ab4fc7a6c1c9635a16507f95645f62cc80ec90 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 31 May 2023 13:08:03 +0200 Subject: [PATCH 02/11] Improving bug template (#2091) --- .github/ISSUE_TEMPLATE/bug.yml | 48 +++++++++++++++------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 0046db8305..4cfc19e3e4 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,4 +1,4 @@ -name: 🐞 Bug, problem, error +name: 🐞 Bug, problem, or error description: Fill a bug report here title: "Bug located in ..." labels: ["bug"] @@ -13,26 +13,24 @@ body: - type: checkboxes id: new-bug attributes: - label: Before submitting the issue + label: 🤓 Before submitting the issue description: | Ensure that the following conditions are met. - Visit [Troubleshooting section](https://mapdl.docs.pyansys.com/troubleshoot/index.html) for more information. - options: - - label: I have visited the Troubleshooting section. + - label: I have visited the [Troubleshooting section](https://mapdl.docs.pyansys.com/troubleshoot/index.html). required: true - - label: I have searched among the existing issues. + - label: I have searched among the [existing issues](https://github.com/ansys/pymapdl/issues?q=). required: true - - label: I am using a Python virtual environment. + - label: I am using a [Python virtual environment](https://docs.python.org/3/library/venv.html). required: true - - label: I have a fully updated virtual environment (i.e. ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core``) + - label: I am using the [latest version of PyMAPDL](https://github.com/ansys/pymapdl/releases) and its dependencies (fully updated virtual environment). You can update them using ``pip install --upgrade --upgrade-strategy eager ansys-mapdl-core``. required: true - type: textarea id: bug-description attributes: - label: Description of the bug + label: 🔍 Description of the bug placeholder: Describe what bug you encountered and what should have happened. validations: required: true @@ -40,11 +38,11 @@ body: - type: textarea id: steps-to-reproduce attributes: - label: Steps To Reproduce + label: 🕵️ Steps To Reproduce description: | Please write the steps in a list form e.g.: * Install this package... - * Run this input file (attached) + * Run this input file (Please attach it) and/or * Run the following commands: ```py mapdl.command1() @@ -53,6 +51,8 @@ body: ``` * Check obtained error... + Use the following text box: + value: | Steps: * First I did... @@ -79,7 +79,7 @@ body: - type: dropdown id: os-name attributes: - label: Which Operating System are you using? + label: 💻 Which Operating System are you using? multiple: false options: - 'Windows' @@ -91,7 +91,7 @@ body: - type: dropdown id: python-version attributes: - label: Which Python version are you using? + label: 🐍 Which Python version are you using? description: Run `python --version` to verify your Python version multiple: false options: @@ -99,18 +99,17 @@ body: - '3.8' - '3.9' - '3.10' + - '3.11' validations: required: false - type: textarea id: pymapdl-report attributes: - label: PyMAPDL Report + label: 📝 PyMAPDL Report description: Run `python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"` to get the PyMAPDL Report value: | -
- Show the Report! - +
Show the Report! ```text @@ -125,12 +124,10 @@ body: - type: textarea id: installed-packages attributes: - label: Installed packages + label: 📝 Installed packages description: Run `python -m pip freeze` to list installed packages value: | -
- Show the installed packages! - +
Show the installed packages! ```text @@ -145,16 +142,13 @@ body: - type: textarea id: logger_log attributes: - label: Logger output file + label: 📝 Logger output file description: | Attach the logger output file. For more information on how to set the logger and - attach its output file, see the [Troubleshooting section] - (https://mapdl.docs.pyansys.com/troubleshoot/index.html). + attach its output file, see the [Troubleshooting section](https://mapdl.docs.pyansys.com/version/stable/user_guide/troubleshoot.html). value: | -
- Show the logger output file. - +
Show the logger output file. ```text From 1a8e9d317d7898fc4f1c549983b44235e1b397e4 Mon Sep 17 00:00:00 2001 From: Jamil Hajjar Date: Wed, 31 May 2023 16:33:58 +0200 Subject: [PATCH 03/11] add cpxmod field to eigs function in math module (#2074) * add cpxmod field to eigs function in math module * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: German <28149841+germa89@users.noreply.github.com> --- src/ansys/mapdl/core/math.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ansys/mapdl/core/math.py b/src/ansys/mapdl/core/math.py index 053f2ca04a..00d89fbd91 100755 --- a/src/ansys/mapdl/core/math.py +++ b/src/ansys/mapdl/core/math.py @@ -902,7 +902,18 @@ def sparse(self, mat, thresh="", **kwargs): kwargs.setdefault("mute", True) self._mapdl.run(f"*COMP,{mat.id},SPARSE,{thresh}", **kwargs) - def eigs(self, nev, k, m=None, c=None, phi=None, algo=None, fmin=None, fmax=None): + def eigs( + self, + nev, + k, + m=None, + c=None, + phi=None, + algo=None, + fmin=None, + fmax=None, + cpxmod=None, + ): """Solve an eigenproblem. Parameters @@ -933,6 +944,8 @@ def eigs(self, nev, k, m=None, c=None, phi=None, algo=None, fmin=None, fmax=None fmin = "" if not fmax: fmax = "" + if not cpxmod: + cpxmod = "" cid = "" if not c: @@ -947,7 +960,7 @@ def eigs(self, nev, k, m=None, c=None, phi=None, algo=None, fmin=None, fmax=None self._mapdl.run("/SOLU", mute=True) self._mapdl.run("antype,modal", mute=True) - self._mapdl.run(f"modopt,{algo},{nev},{fmin},{fmax}", mute=True) + self._mapdl.run(f"modopt,{algo},{nev},{fmin},{fmax},{cpxmod}", mute=True) ev = self.vec() phistr = "" if not phi else phi.id From e267b77db200f98cfdb32e6186e46a731a8f4868 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:28:15 +0200 Subject: [PATCH 04/11] Fixing linkcode tests for release (#2098) --- tests/test_docs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_docs.py b/tests/test_docs.py index 502471081b..6bfa2ae038 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -10,7 +10,6 @@ ) -@skip_if_not_on_ci @pytest.mark.parametrize("edit", [True, False]) @pytest.mark.parametrize( "test_input,expected", @@ -52,4 +51,9 @@ def test_linkcode_resolve(test_input, expected, edit): info = {"module": "ansys.mapdl.core", "fullname": test_input} url = linkcode_resolve("py", info, edit) - assert expected in url + assert "http://github.com/pyansys/pymapdl" in url + assert "src/ansys/mapdl/core" in url + assert expected.split("/")[-1] in url + + if "main" in url: + assert expected in url From 07ef41850bc5d9d16c23187990b06555680cca1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Jun 2023 12:01:29 +0200 Subject: [PATCH 05/11] Bump pandas from 2.0.1 to 2.0.2 (#2096) Bumps [pandas](https://github.com/pandas-dev/pandas) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/pandas-dev/pandas/releases) - [Commits](https://github.com/pandas-dev/pandas/compare/v2.0.1...v2.0.2) --- updated-dependencies: - dependency-name: pandas dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e510f67e77..b3b5a839e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ tests = [ "autopep8==2.0.2", "matplotlib==3.7.1", "scipy==1.10.1", - "pandas==2.0.1", + "pandas==2.0.2", "pytest==7.3.1", "pytest-cov==4.1.0", "pyvista==0.39.1", @@ -79,7 +79,7 @@ doc = [ "jupyterlab>=3.2.8", "matplotlib==3.7.1", "numpydoc==1.5.0", - "pandas==2.0.1", + "pandas==2.0.2", "plotly==5.14.1", "pypandoc==1.11", "pytest-sphinx==0.5.0", From da9fabe9617f3e3bc49ef746a1572446e42a659c Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 2 Jun 2023 12:01:41 +0200 Subject: [PATCH 06/11] Bump to 0.66 (#2097) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b3b5a839e8..70ae958f19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections name = "ansys-mapdl-core" -version = "0.65.dev0" +version = "0.66.dev0" description = "A Python wrapper for Ansys MAPDL." readme = "README.rst" requires-python = ">=3.7" From 89e2d2d800147eb874a94740ec44707ba130170d Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 2 Jun 2023 12:16:27 +0200 Subject: [PATCH 07/11] Fixing upper version limit (#2094) Fixing upper version Co-authored-by: Camille <78221213+clatapie@users.noreply.github.com> --- tests/test_mapdl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_mapdl.py b/tests/test_mapdl.py index 0cd3a3a7ea..a617d0534c 100644 --- a/tests/test_mapdl.py +++ b/tests/test_mapdl.py @@ -1,4 +1,5 @@ """Test MAPDL interface""" +from datetime import datetime import os from pathlib import Path import re @@ -279,7 +280,10 @@ def test_str(mapdl): def test_version(mapdl): assert isinstance(mapdl.version, float) # Checking MAPDL version - assert 20.0 < mapdl.version < 24.0 # Some upper bound. + expected_version = float( + datetime.now().year - 2000 + 1 + 1 + ) # the second +1 is to give some tolerance. + assert 20.0 < mapdl.version < expected_version # Some upper bound. def test_pymapdl_version(): From ed21a679e13b40b964b5f0670be016e00427f3d9 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 2 Jun 2023 15:06:33 +0200 Subject: [PATCH 08/11] Rendering the last 5 versions in documentation (#2099) Adding 'render-last' argument --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 051de94132..76a36eda22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -625,6 +625,7 @@ jobs: cname: ${{ env.DOCUMENTATION_CNAME }} token: ${{ secrets.GITHUB_TOKEN }} python-version: ${{ env.MAIN_PYTHON_VERSION }} + render-last: '5' upload-dev-docs: name: Upload dev documentation From 660acdfd014aae1c758b8164f4642e6525d4542b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 09:14:06 +0200 Subject: [PATCH 09/11] [pre-commit.ci] pre-commit autoupdate (#2103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.23.0 → 0.23.1](https://github.com/python-jsonschema/check-jsonschema/compare/0.23.0...0.23.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e6d6d4da7..00fcf7c63a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,6 +47,6 @@ repos: # this validates our github workflow files - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.23.0 + rev: 0.23.1 hooks: - id: check-github-workflows From 54b9e2b8e58a74a5de99d63d4a564620a0e53dfc Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Mon, 12 Jun 2023 11:17:35 +0200 Subject: [PATCH 10/11] Updating pyiges package flag (#2110) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 70ae958f19..d04ae79c10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ "psutil>=5.9.4", "pyansys-tools-versioning>=0.3.3", "ansys-tools-path>=0.2.4", - "pyiges>=0.1.4", + "pyiges[full]>=0.3.0", # Since v0.3.0, the 'full' flag is needed in order to install 'geomdl' "pyvista>=0.33.0", "scipy>=1.3.0", # for sparse (consider optional?) "tqdm>=4.45.0", From 2db27b92408feb0a5381d7231c824169c23cb27b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:45:32 +0000 Subject: [PATCH 11/11] Bump imageio from 2.30.0 to 2.31.0 (#2105) * Bump imageio from 2.30.0 to 2.31.0 Bumps [imageio](https://github.com/imageio/imageio) from 2.30.0 to 2.31.0. - [Release notes](https://github.com/imageio/imageio/releases) - [Changelog](https://github.com/imageio/imageio/blob/master/CHANGELOG.md) - [Commits](https://github.com/imageio/imageio/compare/v2.30.0...v2.31.0) --- updated-dependencies: - dependency-name: imageio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Adding pyiges in test dependencies * Reverting last commit --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Camille <78221213+clatapie@users.noreply.github.com> --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d04ae79c10..39844b6db4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,7 +74,7 @@ doc = [ "ansys-sphinx-theme==0.9.9", "grpcio==1.51.1", "imageio-ffmpeg==0.4.8", - "imageio==2.30.0", + "imageio==2.31.0", "jupyter_sphinx==0.4.0", "jupyterlab>=3.2.8", "matplotlib==3.7.1",