Skip to content

Commit

Permalink
Merge branch 'main' into ci/multidependabot-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 authored Jun 12, 2023
2 parents e466203 + 2db27b9 commit 31b0736
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 55 deletions.
48 changes: 21 additions & 27 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -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"]
Expand All @@ -13,38 +13,36 @@ 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

- 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()
Expand All @@ -53,6 +51,8 @@ body:
```
* Check obtained error...
Use the following text box:
value: |
Steps:
* First I did...
Expand All @@ -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'
Expand All @@ -91,26 +91,25 @@ 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:
- '3.7'
- '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: |
<details><summary>
Show the Report!
</summary>
<details><summary>Show the Report!</summary>
```text
Expand All @@ -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: |
<details><summary>
Show the installed packages!
</summary>
<details><summary>Show the installed packages!</summary>
```text
Expand All @@ -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: |
<details><summary>
Show the logger output file.
</summary>
<details><summary>Show the logger output file.</summary>
```text
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/cache_cleaner.yml
Original file line number Diff line number Diff line change
@@ -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 }}
21 changes: 4 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,21 +99,14 @@ jobs:
- name: "Setup Python"
uses: actions/setup-python@v4
with:
cache: 'pip'
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Install OS packages"
run: |
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
Expand Down Expand Up @@ -288,21 +280,15 @@ 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"
run: |
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
Expand Down Expand Up @@ -639,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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -74,12 +74,12 @@ 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",
"numpydoc==1.5.0",
"pandas==2.0.1",
"pandas==2.0.2",
"plotly==5.14.1",
"pypandoc==1.11",
"pytest-sphinx==0.5.0",
Expand Down
17 changes: 15 additions & 2 deletions src/ansys/mapdl/core/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
)


@skip_if_not_on_ci
@pytest.mark.parametrize("edit", [True, False])
@pytest.mark.parametrize(
"test_input,expected",
Expand Down Expand Up @@ -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
6 changes: 5 additions & 1 deletion tests/test_mapdl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test MAPDL interface"""
from datetime import datetime
import os
from pathlib import Path
import re
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 31b0736

Please sign in to comment.