Skip to content

Commit d89968a

Browse files
authored
Create a minimal requirements file (#2443)
* Independence from click * Independence from request * Independence from tqm * ansys-tools-path independence * Skipping modules * Minimal ci job * independence from ATP * independence from ansys-mapdl-math * Independence from matplotlib * Bug in parameters * Removing pyvista * setting configuration * Adapting test to new setup * Removing pytest * Removing pymapdl from requirements Installing in two steps. * fixing missing import * installing pymapdl from repo, no pypi * fixing issues with dpf * fixing vm runs * Missing import * fixing write to array * Fixing wrong import * Avoiding MPI issue warning in Linux * fixing no mode when no ATP * Fixing mapdl not launching * Update the image cache * Adding missing import. * disabling license check when there is no ATP. * Externalising vms execution to a python file. * Removing unused env vars * avoiding circular import * Adding coverage artifacts * Adding missing packages for proper testing * Removing checking session ID and test * Fixing orphan imported functions * Fixing calling licensing tests functions which require ATP. * Using a more clear approach based on 'requires' function * Refactoring. Using `requires` instead of global vars. * Fix missing import and missing not * replacing negative conditions by positive ones --------- Co-authored-by: germa89 <[email protected]>
1 parent 3db9285 commit d89968a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1922
-541
lines changed

.ci/run_vms.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Run some vm manuals"""
2+
from ansys.mapdl.core import launch_mapdl
3+
from ansys.mapdl.core.examples import vmfiles
4+
5+
mapdl = launch_mapdl()
6+
7+
vms = list(vmfiles.keys())
8+
9+
for i, vm in enumerate(vms[:2]):
10+
mapdl.clear()
11+
print(f"Running the vm {i}: {vm}")
12+
output = mapdl.input(vmfiles[vm])
13+
print(f"Running the vm {i}: Successfully completed")
14+
mapdl.exit()

.github/workflows/ci.yml

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ defaults:
5454
permissions:
5555
contents: write
5656
packages: read
57-
57+
pull-requests: write
58+
5859
jobs:
5960

6061
doc-style:
@@ -263,7 +264,7 @@ jobs:
263264
run: cat log.txt
264265

265266
build-test:
266-
name: "Remote: Build and unit testing"
267+
name: "Remote: Build & test"
267268
runs-on: ubuntu-latest
268269
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
269270
timeout-minutes: 35
@@ -458,7 +459,7 @@ jobs:
458459
if compgen -G './logs-${{ matrix.mapdl-version }}/*.out' > /dev/null ;then for f in ./logs-${{ matrix.mapdl-version }}/*.out; do echo "::group:: Output file $f" && cat $f && echo "::endgroup::" ; done; fi || echo "Failed to display the 'log' files."
459460
460461
build-test-ubuntu:
461-
name: "Local: Build and unit testing on Ubuntu"
462+
name: "Local: Build & test on Ubuntu"
462463
runs-on: ubuntu-latest
463464
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
464465
timeout-minutes: 55
@@ -482,8 +483,6 @@ jobs:
482483
with:
483484
repository: ${{ github.event.pull_request.head.repo.full_name }}
484485
ref: ${{ github.event.pull_request.head.ref }}
485-
persist-credentials: false
486-
fetch-depth: 0
487486

488487

489488
- name: "Setup Python"
@@ -581,10 +580,89 @@ jobs:
581580
with:
582581
name: ubuntu-v22.2.0-local.xml
583582
path: ./ubuntu-v22.2.0-local.xml
583+
584+
- name: 'Upload minimal requirements file'
585+
uses: actions/upload-artifact@v3
586+
with:
587+
name: minimum_requirements.txt
588+
path: ./minimum_requirements.txt
589+
590+
build-test-ubuntu-minimal:
591+
name: "Local: Build & test minimal package on Ubuntu"
592+
runs-on: ubuntu-latest
593+
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
594+
timeout-minutes: 55
595+
container:
596+
image: ghcr.io/ansys/mapdl:v22.2-ubuntu
597+
options: "-u=0:0 --entrypoint /bin/bash"
598+
credentials:
599+
username: ${{ secrets.GH_USERNAME }}
600+
password: ${{ secrets.GITHUB_TOKEN }}
601+
env:
602+
ON_LOCAL: true
603+
ON_UBUNTU: true
604+
# Because there is no 'ansys-tools-path' we need to input the executable path.
605+
PYMAPDL_MAPDL_EXEC: /ansys_inc/v222/ansys/bin/ansys222
606+
607+
steps:
608+
- name: "Install Git and checkout project"
609+
uses: actions/checkout@v4
610+
with:
611+
repository: ${{ github.event.pull_request.head.repo.full_name }}
612+
ref: ${{ github.event.pull_request.head.ref }}
613+
614+
- name: "Setup Python"
615+
uses: actions/setup-python@v4
616+
with:
617+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
618+
619+
- name: "Checking Python"
620+
run: |
621+
python --version
622+
python -m pip install --upgrade pip
623+
624+
- name: "Install ansys-mapdl-core"
625+
run: |
626+
python -m pip install . --no-deps
627+
python -m pip install -r minimum_requirements.txt
628+
python -c "from ansys.mapdl import core as pymapdl; print('Import successfull')"
629+
630+
- name: "Running some verification manual examples"
631+
run: |
632+
unset PYMAPDL_START_INSTANCE
633+
export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
634+
python .ci/run_vms.py
635+
636+
- name: "Unit testing requirements installation"
637+
run: |
638+
python -m pip install pytest pytest-rerunfailures pytest-cov
639+
640+
- name: "Unit testing"
641+
run: |
642+
unset PYMAPDL_START_INSTANCE
643+
export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
644+
pytest -k "not test_dpf" \
645+
${{ env.PYTEST_ARGUMENTS }} \
646+
--skip-regression-check \
647+
--cov-report=xml:ubuntu-v22.2.0-local-minimal.xml
648+
649+
- uses: codecov/codecov-action@v3
650+
name: "Upload coverage to Codecov"
651+
with:
652+
token: ${{ secrets.CODECOV_TOKEN }}
653+
root_dir: ${{ github.workspace }}
654+
name: ubuntu-v22.2.0-local-minimal.xml
655+
flags: ubuntu,local,v22.2.0,minimal
656+
657+
- name: 'Upload coverage artifacts'
658+
uses: actions/upload-artifact@v3
659+
with:
660+
name: ubuntu-v22.2.0-local-minimal.xml
661+
path: ./ubuntu-v22.2.0-local-minimal.xml
584662

585663
test-windows:
586664
if: github.repository == ''
587-
name: "Local: Build and unit testing on Windows"
665+
name: "Local: Build & test on Windows"
588666
runs-on: [self-hosted, Windows, pymapdl]
589667
timeout-minutes: 30
590668
env:
@@ -676,6 +754,7 @@ jobs:
676754
./**/*.tar.gz
677755
./**/*pymapdl-Documentation-*.pdf
678756
./**/ansys-mapdl-core*.zip
757+
./minimum_requirements.txt
679758
680759
- name: Upload to Public PyPi
681760
env:

doc/source/getting_started/contribution.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use these issue templates:
3838
* **🎓 Adding an example**: Proposing a new example for the library
3939
* **💡 New feature**: Enhancements to the code
4040

41-
If your issue does not fit into one of these categories, click on `Open a black issue <pymapdl_new_blank_issue_>`_.
41+
If your issue does not fit into one of these categories, click on `Open a blank issue <pymapdl_new_blank_issue_>`_.
4242

4343

4444
Viewing PyMAPDL documentation

minimum_requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ansys-api-mapdl==0.5.1
2+
importlib-metadata==6.8.0
3+
numpy==1.26.1
4+
platformdirs==3.11.0
5+
psutil==5.9.6
6+
pyansys-tools-versioning==0.5.0

src/ansys/mapdl/core/__init__.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,18 @@
7373

7474
__version__ = importlib_metadata.version(__name__.replace(".", "-"))
7575

76-
77-
from ansys.tools.path.path import (
78-
change_default_ansys_path,
79-
find_ansys,
80-
get_ansys_path,
81-
get_available_ansys_installations,
82-
save_ansys_path,
83-
)
76+
try:
77+
from ansys.tools.path.path import (
78+
change_default_ansys_path,
79+
find_ansys,
80+
get_ansys_path,
81+
get_available_ansys_installations,
82+
save_ansys_path,
83+
)
84+
except:
85+
# We don't really use these imports in the library. They are here for
86+
# convenience.
87+
pass
8488

8589
from ansys.mapdl.core._version import SUPPORTED_ANSYS_VERSIONS
8690
from ansys.mapdl.core.convert import convert_apdl_block, convert_script

0 commit comments

Comments
 (0)