Skip to content

Commit

Permalink
DOCS: Remove examples (#5242)
Browse files Browse the repository at this point in the history
Co-authored-by: maxcapodi78 <Shark78>
Co-authored-by: Sebastien Morais <[email protected]>
  • Loading branch information
Samuelopez-ansys and SMoraisAnsys authored Oct 5, 2024
1 parent 08db6d0 commit c9df21d
Show file tree
Hide file tree
Showing 91 changed files with 20 additions and 14,189 deletions.
111 changes: 10 additions & 101 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
# TODO: Update to ansys/actions/doc-build@v6 once we remove examples
doc-build:
name: Documentation build without examples
name: Documentation build
runs-on: ubuntu-latest
needs: [doc-style]
steps:
Expand All @@ -91,7 +91,7 @@ jobs:
- name: Install pyaedt and documentation dependencies
run: |
pip install .[doc-no-examples]
pip install .[doc]
- name: Retrieve PyAEDT version
id: version
Expand All @@ -105,119 +105,28 @@ jobs:
sudo apt install graphviz texlive-latex-extra latexmk texlive-xetex texlive-fonts-extra -y
# TODO: Update this step once pyaedt-examples is ready
- name: Build HTML documentation without examples
- name: Build HTML documentation
run: |
make -C doc clean
make -C doc html-no-examples
make -C doc html
# Verify that sphinx generates no warnings
- name: Check for warnings
run: |
python doc/print_errors.py
- name: Upload HTML documentation without examples artifact
- name: Upload HTML documentation without artifact
uses: actions/upload-artifact@v3
with:
name: documentation-no-examples-html
name: documentation-html
path: doc/_build/html
retention-days: 7

- name: Build PDF documentation without examples
- name: Build PDF documentation
run: |
make -C doc pdf-no-examples
- name: Upload PDF documentation without examples artifact
uses: actions/upload-artifact@v3
with:
name: documentation-no-examples-pdf
path: doc/_build/latex/PyAEDT-Documentation-*.pdf
retention-days: 7

# # =================================================================================================
# # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# # =================================================================================================

doc-build-with-examples:
name: Documentation build with examples
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: [ self-hosted, Windows, pyaedt ]
needs: [doc-style]
timeout-minutes: 720
steps:
- name: Install Git and checkout project
uses: actions/checkout@v4

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

- name: Create virtual environment
run: |
python -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install pip -U
python -m pip install wheel setuptools -U
python -c "import sys; print(sys.executable)"
- name: Install pyaedt and documentation dependencies
run: |
.venv\Scripts\Activate.ps1
pip install .[doc]
- name: Retrieve PyAEDT version
id: version
run: |
.venv\Scripts\Activate.ps1
echo "PYAEDT_VERSION=$(python -c 'from ansys.aedt.core import __version__; print(__version__)')" >> $GITHUB_OUTPUT
echo "PyAEDT version is: $(python -c "from ansys.aedt.core import __version__; print(__version__)")"
- name: Install CI dependencies (e.g. vtk-osmesa)
run: |
.venv\Scripts\Activate.ps1
# Uninstall conflicting dependencies
pip uninstall --yes vtk
pip install --extra-index-url https://wheels.vtk.org vtk-osmesa
# TODO: Update this step once pyaedt-examples is ready
# NOTE: Use environment variable to keep the doctree and avoid redundant build for PDF pages
- name: Build HTML documentation with examples
env:
SPHINXBUILD_KEEP_DOCTREEDIR: "1"
run: |
.venv\Scripts\Activate.ps1
.\doc\make.bat clean
.\doc\make.bat html
# TODO: Keeping this commented as reminder of https://github.com/ansys/pyaedt/issues/4296
# # Verify that sphinx generates no warnings
# - name: Check for warnings
# run: |
# .venv\Scripts\Activate.ps1
# python doc/print_errors.py

# Use environment variable to remove the doctree after the build of PDF pages
- name: Build PDF documentation with examples
env:
SPHINXBUILD_KEEP_DOCTREEDIR: "0"
run: |
.venv\Scripts\Activate.ps1
.\doc\make.bat pdf
# - name: Add assets to HTML docs
# run: |
# zip -r documentation-html.zip ./doc/_build/html
# mv documentation-html.zip ./doc/_build/html/_static/assets/download/
# cp doc/_build/latex/PyAEDT-Documentation-*.pdf ./doc/_build/html/_static/assets/download/pyaedt.pdf

- name: Upload HTML documentation with examples artifact
uses: actions/upload-artifact@v3
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
make -C doc pdf
- name: Upload PDF documentation without examples artifact
- name: Upload PDF documentation
uses: actions/upload-artifact@v3
with:
name: documentation-pdf
Expand Down Expand Up @@ -492,7 +401,7 @@ jobs:
release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [package, doc-build-with-examples]
needs: [package, doc-build]
runs-on: ubuntu-latest
steps:
- name: Release to the public PyPI repository
Expand Down
27 changes: 2 additions & 25 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,16 @@ clean: .install-deps
# @echo
# @echo "Check finished. Report is in $(LINKCHECKDIR)."

html-no-examples: .install-deps
@echo "Building HTML pages without examples."
export PYAEDT_DOC_RUN_EXAMPLES="0"
export PYAEDT_DOC_USE_GIF="1"
@# FIXME: currently linkcheck freezes and further investigation must be performed
@# @$(SPHINXBUILD) -M linkcheck "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(LINKCHECKOPTS) $(O)
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)."

html: .install-deps
@echo "Building HTML pages with examples."
export PYAEDT_DOC_RUN_EXAMPLES="1"
export PYAEDT_DOC_USE_GIF="1"
@echo "Building HTML pages."
@# FIXME: currently linkcheck freezes and further investigation must be performed
@# @$(SPHINXBUILD) -M linkcheck "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(LINKCHECKOPTS) $(O)
@$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)."

pdf-no-examples: .install-deps
@echo "Building PDF pages without examples."
export PYAEDT_DOC_RUN_EXAMPLES="0"
export PYAEDT_DOC_USE_GIF="0"
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
(test -f $(BUILDDIR)/latex/PyAEDT-Documentation-*.pdf && echo pdf exists) || exit 1
@echo "Build finished. The PDF pages are in $(BUILDDIR)."

pdf: .install-deps
@echo "Building PDF pages with examples."
export PYAEDT_DOC_RUN_EXAMPLES="1"
export PYAEDT_DOC_USE_GIF="0"
@echo "Building PDF pages."
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
(test -f $(BUILDDIR)/latex/PyAEDT-Documentation-*.pdf && echo pdf exists) || exit 1
Expand Down
40 changes: 2 additions & 38 deletions doc/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ REM End of CICD dedicated setup
if "%1" == "" goto help
if "%1" == "clean" goto clean
if "%1" == "html" goto html
if "%1" == "html-no-examples" goto html-no-examples
if "%1" == "pdf" goto pdf
if "%1" == "pdf-no-examples" goto pdf-no-examples

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
Expand Down Expand Up @@ -59,23 +57,7 @@ for /d /r %SOURCEDIR% %%d in (_autosummary) do @if exist "%%d" rmdir /s /q "%%d"
goto end

:html
echo Building HTML pages with examples
set PYAEDT_DOC_RUN_EXAMPLES=1
set PYAEDT_DOC_USE_GIF=1
::FIXME: currently linkcheck freezes and further investigation must be performed
::%SPHINXBUILD% -M linkcheck %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %LINKCHECKOPTS% %O%
%SPHINXBUILD% -M html %SOURCEDIR% %BUILDDIR%
echo
echo "Build finished. The HTML pages are in %BUILDDIR%."
goto end

:html-no-examples
echo Building HTML pages without examples
set PYAEDT_DOC_RUN_EXAMPLES=0
set PYAEDT_DOC_USE_GIF=1
if not exist "source\examples" mkdir "source\examples"
echo Examples> source\examples\index.rst
echo ========> source\examples\index.rst
echo Building HTML pages
::FIXME: currently linkcheck freezes and further investigation must be performed
::%SPHINXBUILD% -M linkcheck %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %LINKCHECKOPTS% %O%
%SPHINXBUILD% -M html %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
Expand All @@ -84,25 +66,7 @@ echo "Build finished. The HTML pages are in %BUILDDIR%."
goto end

:pdf
echo Building PDF pages with examples
set PYAEDT_DOC_RUN_EXAMPLES=1
set PYAEDT_DOC_USE_GIF=0
%SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
cd "%BUILDDIR%\latex"
for %%f in (*.tex) do (
xelatex "%%f" --interaction=nonstopmode)
echo "Build finished. The PDF pages are in %BUILDDIR%."
goto end

:pdf-no-examples
echo Building PDF pages without examples
set PYAEDT_DOC_RUN_EXAMPLES=0
set PYAEDT_DOC_USE_GIF=0
if not exist "source\examples" mkdir "source\examples"
echo Examples> source\examples\index.rst
echo ========> source\examples\index.rst
::FIXME: currently linkcheck freezes and further investigation must be performed
::%SPHINXBUILD% -M linkcheck %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %LINKCHECKOPTS% %O%
echo Building PDF pages
%SPHINXBUILD% -M latex %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
cd "%BUILDDIR%\latex"
for %%f in (*.tex) do (
Expand Down
2 changes: 1 addition & 1 deletion doc/source/User_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ User guide

This section provides brief tutorials for helping you understand how to use PyAEDT effectively.

For end-to-end examples, see `Examples <https://aedt.docs.pyansys.com/version/stable/examples>`_.
For end-to-end examples, see `Examples <https://examples.aedt.docs.pyansys.com>`_.


.. grid:: 2
Expand Down
54 changes: 0 additions & 54 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,6 @@ def setup(app):
os.environ["PYAEDT_NON_GRAPHICAL"] = "1"
os.environ["PYAEDT_DOC_GENERATION"] = "1"

# Do not run examples by default
run_examples = bool(int(os.getenv("PYAEDT_DOC_RUN_EXAMPLES", "0")))
use_gif = bool(int(os.getenv("PYAEDT_DOC_USE_GIF", "1")))

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -258,57 +255,6 @@ def setup(app):

# gallery build requires AEDT install
# if is_windows and bool(os.getenv("PYAEDT_CI_RUN_EXAMPLES", "0")):
if run_examples:
import pyvista

# PyVista settings

# Ensure that offscreen rendering is used for docs generation
pyvista.OFF_SCREEN = True
# Save figures in specified directory
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
if not os.path.exists(pyvista.FIGURE_PATH):
os.makedirs(pyvista.FIGURE_PATH)
# Necessary for pyvista when building the sphinx gallery
pyvista.BUILDING_GALLERY = True

# Manage errors
pyvista.set_error_output_file("errors.txt")
# Must be less than or equal to the XVFB window size
pyvista.global_theme["window_size"] = np.array([1024, 768])

# suppress annoying matplotlib bug
warnings.filterwarnings(
"ignore",
category=UserWarning,
message="Matplotlib is currently using agg, which is a non-GUI backend, so it cannot show the figure.",
)

extensions.append("sphinx_gallery.gen_gallery")
sphinx_gallery_conf = {
# convert rst to md for ipynb
"pypandoc": True,
# path to your examples scripts
"examples_dirs": ["../../examples/"],
# path where to save gallery generated examples
"gallery_dirs": ["examples"],
# Pattern to search for examples files
"filename_pattern": r"\.py",
# Remove the "Download all examples" button from the top level gallery
"download_all_examples": False,
# Sort gallery examples by file name instead of number of lines (default)
"within_subsection_order": FileNameSortKey,
# Directory where function granular galleries are stored
"backreferences_dir": None,
# Modules for which function level galleries are created. In
"doc_module": "ansys-pyaedt",
"image_scrapers": ("pyvista", "matplotlib"),
"ignore_pattern": r"flycheck.*",
"thumbnail_size": (350, 350),
}
if not use_gif:
gif_ignore_pattern = r"|.*Maxwell2D_Transient\.py|.*Maxwell2D_DCConduction\.py|.*Hfss_Icepak_Coupling\.py|.*SBR_Time_Plot\.py"
sphinx_gallery_conf["ignore_pattern"] = sphinx_gallery_conf["ignore_pattern"] + gif_ignore_pattern

# -- Options for HTML output -------------------------------------------------
html_short_title = html_title = "PyAEDT"
Expand Down
6 changes: 3 additions & 3 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ enabling straightforward and efficient automation in your workflow.
It describes how the methods work and the parameters that can be used.

.. grid-item-card:: Examples :fa:`scroll`
:link: examples/index
:link-type: doc
:link: https://examples.aedt.docs.pyansys.com/

Explore examples that show how to use PyAEDT to perform different types of simulations.

Expand All @@ -59,11 +58,12 @@ enabling straightforward and efficient automation in your workflow.

Learn how to contribute to the PyAEDT codebase or documentation.


.. toctree::
:hidden:


Getting_started/index
User_guide/index
API/index
examples/index
Examples <https://examples.aedt.docs.pyansys.com/>
20 changes: 0 additions & 20 deletions examples/00-EDB/Readme.txt

This file was deleted.

Loading

0 comments on commit c9df21d

Please sign in to comment.