Skip to content

Commit

Permalink
Create a minimal requirements file (#2443)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
germa89 and germa89 authored Nov 2, 2023
1 parent 3db9285 commit d89968a
Show file tree
Hide file tree
Showing 55 changed files with 1,922 additions and 541 deletions.
14 changes: 14 additions & 0 deletions .ci/run_vms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Run some vm manuals"""
from ansys.mapdl.core import launch_mapdl
from ansys.mapdl.core.examples import vmfiles

mapdl = launch_mapdl()

vms = list(vmfiles.keys())

for i, vm in enumerate(vms[:2]):
mapdl.clear()
print(f"Running the vm {i}: {vm}")
output = mapdl.input(vmfiles[vm])
print(f"Running the vm {i}: Successfully completed")
mapdl.exit()
91 changes: 85 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ defaults:
permissions:
contents: write
packages: read

pull-requests: write

jobs:

doc-style:
Expand Down Expand Up @@ -263,7 +264,7 @@ jobs:
run: cat log.txt

build-test:
name: "Remote: Build and unit testing"
name: "Remote: Build & test"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 35
Expand Down Expand Up @@ -458,7 +459,7 @@ jobs:
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."
build-test-ubuntu:
name: "Local: Build and unit testing on Ubuntu"
name: "Local: Build & test on Ubuntu"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 55
Expand All @@ -482,8 +483,6 @@ jobs:
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false
fetch-depth: 0


- name: "Setup Python"
Expand Down Expand Up @@ -581,10 +580,89 @@ jobs:
with:
name: ubuntu-v22.2.0-local.xml
path: ./ubuntu-v22.2.0-local.xml

- name: 'Upload minimal requirements file'
uses: actions/upload-artifact@v3
with:
name: minimum_requirements.txt
path: ./minimum_requirements.txt

build-test-ubuntu-minimal:
name: "Local: Build & test minimal package on Ubuntu"
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
timeout-minutes: 55
container:
image: ghcr.io/ansys/mapdl:v22.2-ubuntu
options: "-u=0:0 --entrypoint /bin/bash"
credentials:
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
ON_LOCAL: true
ON_UBUNTU: true
# Because there is no 'ansys-tools-path' we need to input the executable path.
PYMAPDL_MAPDL_EXEC: /ansys_inc/v222/ansys/bin/ansys222

steps:
- name: "Install Git and checkout project"
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: "Setup Python"
uses: actions/setup-python@v4
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: "Checking Python"
run: |
python --version
python -m pip install --upgrade pip
- name: "Install ansys-mapdl-core"
run: |
python -m pip install . --no-deps
python -m pip install -r minimum_requirements.txt
python -c "from ansys.mapdl import core as pymapdl; print('Import successfull')"
- name: "Running some verification manual examples"
run: |
unset PYMAPDL_START_INSTANCE
export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
python .ci/run_vms.py
- name: "Unit testing requirements installation"
run: |
python -m pip install pytest pytest-rerunfailures pytest-cov
- name: "Unit testing"
run: |
unset PYMAPDL_START_INSTANCE
export ANSYSLMD_LICENSE_FILE=1055@${{ secrets.LICENSE_SERVER }}
pytest -k "not test_dpf" \
${{ env.PYTEST_ARGUMENTS }} \
--skip-regression-check \
--cov-report=xml:ubuntu-v22.2.0-local-minimal.xml
- uses: codecov/codecov-action@v3
name: "Upload coverage to Codecov"
with:
token: ${{ secrets.CODECOV_TOKEN }}
root_dir: ${{ github.workspace }}
name: ubuntu-v22.2.0-local-minimal.xml
flags: ubuntu,local,v22.2.0,minimal

- name: 'Upload coverage artifacts'
uses: actions/upload-artifact@v3
with:
name: ubuntu-v22.2.0-local-minimal.xml
path: ./ubuntu-v22.2.0-local-minimal.xml

test-windows:
if: github.repository == ''
name: "Local: Build and unit testing on Windows"
name: "Local: Build & test on Windows"
runs-on: [self-hosted, Windows, pymapdl]
timeout-minutes: 30
env:
Expand Down Expand Up @@ -676,6 +754,7 @@ jobs:
./**/*.tar.gz
./**/*pymapdl-Documentation-*.pdf
./**/ansys-mapdl-core*.zip
./minimum_requirements.txt
- name: Upload to Public PyPi
env:
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/contribution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use these issue templates:
* **🎓 Adding an example**: Proposing a new example for the library
* **💡 New feature**: Enhancements to the code

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


Viewing PyMAPDL documentation
Expand Down
6 changes: 6 additions & 0 deletions minimum_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ansys-api-mapdl==0.5.1
importlib-metadata==6.8.0
numpy==1.26.1
platformdirs==3.11.0
psutil==5.9.6
pyansys-tools-versioning==0.5.0
20 changes: 12 additions & 8 deletions src/ansys/mapdl/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,18 @@

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


from ansys.tools.path.path import (
change_default_ansys_path,
find_ansys,
get_ansys_path,
get_available_ansys_installations,
save_ansys_path,
)
try:
from ansys.tools.path.path import (
change_default_ansys_path,
find_ansys,
get_ansys_path,
get_available_ansys_installations,
save_ansys_path,
)
except:
# We don't really use these imports in the library. They are here for
# convenience.
pass

from ansys.mapdl.core._version import SUPPORTED_ANSYS_VERSIONS
from ansys.mapdl.core.convert import convert_apdl_block, convert_script
Expand Down
Loading

0 comments on commit d89968a

Please sign in to comment.