Skip to content

feat: separate graphics target #567

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

Draft
wants to merge 40 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cf36aaa
feat: separating graphic dependencies
clatapie Apr 2, 2025
0e87a6b
feat: separating graphic dependencies -2
clatapie Apr 3, 2025
e0e4ba9
feat: separating graphic dependencies - 3
clatapie Apr 3, 2025
e221bba
Merge branch 'main' into feat/separate-graphics
clatapie Apr 3, 2025
35842e4
fix: fixing ``testing``
clatapie Apr 3, 2025
852ff15
Merge branch 'feat/separate-graphics' of https://github.com/pyansys/p…
clatapie Apr 3, 2025
a8966f7
fix: adding ``scooby`` as a graphic dependency
clatapie Apr 3, 2025
a146986
fix: unit tests
clatapie Apr 3, 2025
7fde82f
fix: disabling ``pre-commit-hooks`` for the moment
clatapie Apr 3, 2025
881b87d
fix: testing environment installation
clatapie Apr 3, 2025
289f342
fix: disabling Python 3.9
clatapie Apr 3, 2025
f45b404
fix: adding ``MAIN_PYTHON_VERSION`` env variable in cicd
clatapie Apr 3, 2025
2faf43d
fix: ``MAIN_PYTHON_VERSION``
clatapie Apr 3, 2025
0627397
fix: ``scooby`` as a dependency + ``Sphinx`` requires Python>3.11
clatapie Apr 3, 2025
2391f24
fix: ``scooby`` as a dependency - 2
clatapie Apr 3, 2025
52601ea
fix: adding a placeholder for ``plot`` definition
clatapie Apr 3, 2025
0b30e12
review: applying changes after @RobPasMue's suggestions
clatapie Apr 3, 2025
92dccd9
fix: vtk version
clatapie Apr 3, 2025
3d51155
fix: deprecated ``stitle`` argument
clatapie Apr 3, 2025
4bdc839
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 3, 2025
3103892
fix: removing cyclic import
clatapie Apr 3, 2025
3fc752d
Merge branch 'feat/separate-graphics' of https://github.com/pyansys/p…
clatapie Apr 3, 2025
b063561
ci: ``skip-install`` true in ``doc_build``
clatapie Apr 3, 2025
4550b13
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 3, 2025
9b323d0
fix: ``are_graphics_available`` method
clatapie Apr 3, 2025
2c04884
Merge branch 'feat/separate-graphics' of https://github.com/pyansys/p…
clatapie Apr 3, 2025
d506e20
fix: applying @RobPasMue's suggestions ``pv=None``
clatapie Apr 4, 2025
1fdb87b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2025
33198a4
fix: pre-commit
clatapie Apr 4, 2025
e2ad58f
Merge branch 'feat/separate-graphics' of https://github.com/pyansys/p…
clatapie Apr 4, 2025
6965688
fix: doc and ``@wraps``
clatapie Apr 4, 2025
561c7df
fix: remove ``checkout`` from ``doc-build`` action
clatapie Apr 4, 2025
5753023
fix: unit tests
clatapie Apr 4, 2025
99ad42c
fix: unit tests - 2
clatapie Apr 4, 2025
d1c968e
fix: unit tests - 3
clatapie Apr 4, 2025
e887807
fix: ``skip_no_graphics``
clatapie Apr 4, 2025
b59f36c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2025
62d16bc
fix: adding latest changes - issue with ``vtk``
clatapie Apr 4, 2025
c18d169
Merge branch 'feat/separate-graphics' of https://github.com/pyansys/p…
clatapie Apr 4, 2025
009ca24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 4, 2025
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
248 changes: 121 additions & 127 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
PYMAPDL_START_INSTANCE: FALSE
DOCKER_PACKAGE: ghcr.io/pyansys/pymapdl/mapdl
DOCUMENTATION_CNAME: reader.docs.pyansys.com
MAIN_PYTHON_VERSION: "3.11"

on:
pull_request:
Expand All @@ -24,42 +25,13 @@ concurrency:
cancel-in-progress: true

jobs:
doc_build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v3

- name: Build project documentation
uses: ansys/actions/doc-build@v8
with:
dependencies: 'pandoc'
skip-dependencies-cache: true
use-python-cache: false
python-version: "3.10"
sphinxopts: "-j auto"

doc-deploy-dev:
name: Upload development documentation
runs-on: ubuntu-latest
needs: [doc_build]
if: github.ref == 'refs/heads/main'
steps:
- uses: ansys/actions/doc-deploy-dev@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

build:
name: Build and Test
smoke-tests:
name: Build wheels and smoke tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]

steps:
Expand All @@ -70,7 +42,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'requirements/*.txt'

- name: Build ManyLinux wheel
if: ${{ runner.os == 'Linux' }}
Expand Down Expand Up @@ -105,23 +76,15 @@ jobs:
pip install (get-item .\dist\*.whl)
pip list

- name: Setup headless display
uses: pyvista/setup-headless-display-action@v3

- name: Install test requirements
run: pip install -r requirements/requirements_test.txt

- name: Test
run: pytest -v tests/ --durations=0

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ runner.os }}-${{ matrix.python-version }}
path: dist/
retention-days: 7

mac_build:

smoke-tests-mac:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
name: Build wheels on MacOS
runs-on: macos-latest
Expand All @@ -140,10 +103,105 @@ jobs:
with:
path: ./wheelhouse/*.whl


doc_build:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: "Install Git and checkout project"
uses: actions/[email protected]

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

- name: "Install OS packages"
run: |
sudo apt update
sudo apt install pandoc

- name: "Install ansys-mapdl-reader and doc dependencies"
run: |
pip install .[doc]

- name: Setup headless display
uses: pyvista/setup-headless-display-action@v3

- name: Build project documentation
uses: ansys/actions/doc-build@v8
with:
dependencies: 'pandoc'
python-version: ${{ env.MAIN_PYTHON_VERSION }}
skip-install: true
checkout: false
sphinxopts: "-j auto"
use-python-cache: false


testing:
name: Testing
runs-on: ${{ matrix.os }}
needs: [smoke-tests]
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# cache: 'pip'

- name: Setup headless display
uses: pyvista/setup-headless-display-action@v3

- name: Install test requirements
run: pip install -e .[tests]

- name: Test
run: pytest -v tests/ --durations=0


testing-no-graphics:
name: Testing with minimum requirements (no graphics)
needs: [smoke-tests]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# cache: 'pip'

- name: Setup headless display
uses: pyvista/setup-headless-display-action@v3

- name: Install minimal test requirements
run: |
pip install -e .[tests-minimal]

- name: Test
run: pytest -v tests/ --durations=0


automerge-prs:
name: Automerge PRs (dependabot and pre-commit.ci only)
runs-on: ubuntu-latest
needs: [build, doc_build]
needs: [testing, testing-no-graphics, doc_build]
if: github.event_name == 'pull_request'
permissions:
contents: write
Expand All @@ -155,89 +213,10 @@ jobs:
approver: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
approver-token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}

# pymapdl_tests:
# name: PyMAPDL Unit Testing
# runs-on: ubuntu-latest
# needs: build
# strategy:
# matrix:
# mapdl-version: ['v21.1.1', 'v21.2.1', 'v22.1.0']

# steps:

# - name: Checkout PyMAPDL
# uses: actions/checkout@v4
# with:
# repository: 'pyansys/pymapdl' #checking out main. Not release

# - name: Display structure of downloaded PyMAPDL files
# run: ls -R

# - name: Downloading artifacts
# uses: actions/download-artifact@v4

# - name: Display structure of downloaded artifact files
# run: ls -R

# - name: Setup Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.8

# - name: Install OS packages
# run: |
# sudo apt update
# sudo apt install libgl1-mesa-glx xvfb

# - name: Linux pip cache
# uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: Python-${{ runner.os }}-3.8-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_*.txt') }}
# restore-keys: |
# Python-${{ runner.os }}-3.8

# - name: Test virtual framebuffer
# run: |
# pip install -r .ci/requirements_test_xvfb.txt
# xvfb-run python .ci/display_test.py

# - name: Install ansys-mapdl-core
# run: |
# python -m pip install --upgrade pip
# pip install .
# xvfb-run python -c "from ansys.mapdl import core as pymapdl; print(pymapdl.Report())"

# - name: Install ansys-mapdl-reader
# run: |
# pip install ansys-mapdl-reader-${{ runner.os }}-3.8/*.whl
# xvfb-run python -c "from ansys.mapdl import reader as pymapdl_reader; print(pymapdl_reader); print('Installation and smoke test correct')"

# - name: Login in Github Container registry
# uses: docker/login-action@v1
# with:
# registry: ghcr.io
# username: ${{ secrets.GH_USERNAME }}
# password: ${{ secrets.GITHUB_TOKEN }}

# - name: Pull, launch, and validate MAPDL service
# run: .ci/start_mapdl.sh
# env:
# LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
# MAPDL_IMAGE: ${{ env.DOCKER_PACKAGE }}:${{ matrix.mapdl-version }}

# - name: Unit Testing
# run: |
# pip install -r requirements/requirements_tests.txt
# xvfb-run pytest -v

# - name: Display MAPDL Logs
# if: always()
# run: cat log.txt

Release:

release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [doc_build, build, mac_build]
needs: [doc_build, smoke-tests-mac, testing, testing-no-graphics]
runs-on: ubuntu-latest
steps:
- name: Set up Python
Expand Down Expand Up @@ -275,11 +254,12 @@ jobs:
./**/*.zip
./**/*.pdf


doc-deploy-release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [Release]
needs: [release]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v8
Expand All @@ -288,3 +268,17 @@ jobs:
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}


doc-deploy-dev:
name: Upload development documentation
runs-on: ubuntu-latest
needs: [testing, testing-no-graphics, doc_build]
if: github.ref == 'refs/heads/main' && !contains(github.ref, 'refs/tags')
steps:
- uses: ansys/actions/doc-deploy-dev@v8
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dist/

# MISC
_build/
sg_execution_times.rst
pyansys/Interface.py
*.bat
doc/source/examples/*
Expand Down
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ repos:
hooks:
- id: codespell

- repo: https://github.com/ansys/pre-commit-hooks
rev: v0.5.2
hooks:
- id: add-license-headers
args:
- --start_year=2021
# need to be enabled in another PR
# - repo: https://github.com/ansys/pre-commit-hooks
# rev: v0.5.2
# hooks:
# - id: add-license-headers
# args:
# - --start_year=2021

# add this eventually
# - repo: https://github.com/pycqa/pydocstyle
Expand Down
25 changes: 14 additions & 11 deletions ansys/mapdl/reader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@

import appdirs

# Per contract with Sphinx-Gallery, this method must be available at top level
try:
# for pyvista >= 0.40
from pyvista.plotting.utilities import _get_sg_image_scraper
except ImportError:
from pyvista.utilities.sphinx_gallery import _get_sg_image_scraper


from ansys.mapdl.reader import examples
from ansys.mapdl.reader._version import __version__
from ansys.mapdl.reader.archive import (
Expand All @@ -20,7 +12,8 @@
)
from ansys.mapdl.reader.cell_quality import quality
from ansys.mapdl.reader.common import read_binary
from ansys.mapdl.reader.misc import Report, _configure_pyvista
from ansys.mapdl.reader.misc.checks import run_if_graphics_required
from ansys.mapdl.reader.misc.misc import Report, _configure_pyvista

from . import _archive

Expand All @@ -29,5 +22,15 @@

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

# set pyvista defaults
_configure_pyvista()
try:
run_if_graphics_required()
# set pyvista defaults
_configure_pyvista()
# Per contract with Sphinx-Gallery, this method must be available at top level
try:
# for pyvista >= 0.40
from pyvista.plotting.utilities import _get_sg_image_scraper
except ImportError:
from pyvista.utilities.sphinx_gallery import _get_sg_image_scraper
except ImportError:
pass
Loading
Loading