Skip to content

Commit 6405a55

Browse files
authored
Use numpydoc (#583)
* add templates * add templates in earnest * fix docbuild * post doc updates * finish post and math docstring cleanup * fix docstring warnings * in progress add validations * finalize doc cleanup * cleanup CI; fix flake8 error
1 parent 4fe510a commit 6405a55

File tree

114 files changed

+3156
-2693
lines changed

Some content is hidden

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

114 files changed

+3156
-2693
lines changed

.ci/azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ trigger:
1818
jobs:
1919
- job: Linux
2020
variables:
21-
python.version: '3.8' # limited to < Python 3.8 due to VTK req
21+
python.version: '3.8'
2222
DISPLAY: ':99.0'
2323
MAPDL.IMAGE: 'docker.pkg.github.com/pyansys/pymapdl/mapdl'
2424
PYMAPDL_PORT: 32771 # default of 50052 does not work on azure devops

.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
exclude = venv, __init__.py
2+
exclude = venv, __init__.py, build
33
# To be added after refactoring code to be compliant: E501, F401, W191, W291, W293
44
select = W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, F403
55
count = True
Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# Build documentation
22
name: Documentation Build
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
push:
8+
tags:
9+
- "*"
10+
branches:
11+
- main
12+
513

614
jobs:
715
docs_build:
@@ -19,9 +27,9 @@ jobs:
1927
- uses: actions/checkout@v2
2028

2129
- name: Setup Python
22-
uses: actions/setup-python@v2.1.4
30+
uses: actions/setup-python@v2
2331
with:
24-
python-version: 3.7
32+
python-version: 3.8
2533

2634
- name: Install, start, and test the virtual framebuffer
2735
run: |
@@ -47,27 +55,31 @@ jobs:
4755
LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }}
4856
GH_USERNAME: ${{ secrets.GH_USERNAME }}
4957
GH_PAT: ${{ secrets.REPO_DOWNLOAD_PAT }}
58+
59+
- name: Install OS packages
60+
run: |
61+
sudo apt update
62+
sudo apt install zip pandoc -qy
5063
5164
- name: Build Documentation
5265
run: |
53-
sudo apt install pandoc -qy
5466
pip install -r requirements_docs.txt
55-
make -C doc html
56-
env:
57-
PYMAPDL_CI_NO_AUTODOC: True
67+
make -C doc html SPHINXOPTS="-j auto -w build_errors.txt -N"
5868
59-
- name: Full Documentation Build
60-
if: startsWith(github.ref, 'refs/tags/')
69+
# Verify that sphinx generates no warnings
70+
- name: Check for warnings
71+
run: python doc/print_errors.py
72+
73+
- name: Zip documentation
6174
run: |
62-
sudo apt install pandoc -qy
63-
pip install -r requirements_docs.txt
64-
make -C doc html
65-
75+
cd doc/build/html
76+
zip -r PyMAPDL_documentation.zip *
77+
6678
- name: Upload Documentation
67-
uses: actions/upload-artifact@v2.2.1
79+
uses: actions/upload-artifact@v2
6880
with:
6981
name: Documentation
70-
path: doc/build/html
82+
path: doc/build/html/PyMAPDL_documentation.zip
7183
retention-days: 7
7284

7385
- name: Deploy

.github/workflows/smoke-tests.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
name: Smoke Tests
22
# verify we can install on a variety of Python versions and OSes
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
push:
8+
tags:
9+
- "*"
10+
branches:
11+
- main
512

613
jobs:
714
testimport:

.github/workflows/style.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
# check spelling, codestyle
22
name: Style Check
33

4-
on: [push, pull_request, workflow_dispatch]
4+
on:
5+
pull_request:
6+
workflow_dispatch:
7+
push:
8+
tags:
9+
- "*"
10+
branches:
11+
- main
512

613
jobs:
714
build:

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ pyansys/Interface.py
3333
doc/source/examples/*
3434
*.out
3535
*.tar.gz
36+
*.mypy_cache
3637

37-
# autogenerated docs
38+
# docs
3839
_autosummary
40+
doc/build_errors.txt
3941

4042

4143
# Testing

Makefile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,31 @@ CODESPELL_DIRS ?= ./
44
CODESPELL_SKIP ?= "*.pyc,*.txt,*.gif,*.png,*.jpg,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,./doc/build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/source/examples/*,*cover,*.dat,*.mac,\#*,build,./docker/mapdl/v*,./factory/*,./ansys/mapdl/core/mapdl_functions.py,PKG-INFO,*.mypy_cache/*,./docker/mapdl/*"
55
CODESPELL_IGNORE ?= "ignore_words.txt"
66

7-
all: doctest
8-
9-
doctest: codespell
7+
codestyle: codespell flake8
108

119
codespell:
1210
@echo "Running codespell"
1311
@codespell $(CODESPELL_DIRS) -S $(CODESPELL_SKIP) -I $(CODESPELL_IGNORE)
1412

1513
pydocstyle:
1614
@echo "Running pydocstyle"
17-
@pydocstyle ansys.mapdl
15+
@pydocstyle ansys.mapdl.core
1816

1917
doctest-modules:
2018
@echo "Runnnig module doctesting"
21-
pytest -v --doctest-modules ansys.mapdl
19+
pytest -v --doctest-modules ansys.mapdl.core
2220

2321
coverage:
2422
@echo "Running coverage"
25-
@pytest -v --cov ansys.mapdl
23+
@pytest -v --cov ansys.mapdl.core
2624

2725
coverage-xml:
2826
@echo "Reporting XML coverage"
29-
@pytest -v --cov ansys.mapdl --cov-report xml
27+
@pytest -v --cov ansys.mapdl.core --cov-report xml
3028

3129
coverage-html:
3230
@echo "Reporting HTML coverage"
33-
@pytest -v --cov ansys.mapdl --cov-report html
31+
@pytest -v --cov ansys.mapdl.core --cov-report html
3432

3533
flake8:
3634
@echo "Running flake8"

ansys/mapdl/core/_commands/apdl/abbreviations.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Abbreviations:
33
def abbr(self, abbr="", string="", **kwargs):
44
"""Defines an abbreviation.
55
6-
APDL Command: *ABBR
6+
APDL Command: ``*ABBR``
77
88
Parameters
99
----------
@@ -14,13 +14,15 @@ def abbr(self, abbr="", string="", **kwargs):
1414
which is the same as an ANSYS command.
1515
1616
string
17-
String of characters (60 maximum) represented by Abbr. Cannot
18-
include a $ or any of the commands C***, /COM, /GOPR, /NOPR,
19-
/QUIT, /UI, or *END. Parameter names and commands of the *DO and
20-
Use the *IF groups may not be abbreviated. If String is blank, the
21-
abbreviation is deleted. To abbreviate multiple commands, create an
22-
"unknown command" macro or define String to execute a macro file
23-
[*USE] containing the desired commands.
17+
String of characters (60 maximum) represented by Abbr.
18+
Cannot include a $ or any of the commands ``C***``, /COM,
19+
/GOPR, /NOPR, /QUIT, /UI, or ``*END``.
20+
21+
Use the ``*IF`` groups may not be abbreviated. If String
22+
is blank, the abbreviation is deleted. To abbreviate
23+
multiple commands, create an "unknown command" macro or
24+
define String to execute a macro file [``*USE``]
25+
containing the desired commands.
2426
2527
Notes
2628
-----
@@ -31,8 +33,8 @@ def abbr(self, abbr="", string="", **kwargs):
3133
any time and are available throughout the program. Abbreviations may be
3234
redefined or deleted at any time.
3335
34-
Use *STATUS to display the current list of abbreviations. For
35-
abbreviations repeated with *REPEAT, substitution occurs before the
36+
Use ``*STATUS`` to display the current list of abbreviations. For
37+
abbreviations repeated with ``*REPEAT``, substitution occurs before the
3638
repeat increments are applied. There are a number of abbreviations that
3739
are predefined by the program (these can be deleted by using the blank
3840
String option described above). Note that String will be written to the
@@ -136,7 +138,7 @@ def ucmd(self, cmd="", srnum="", **kwargs):
136138
dependent) subroutine. This feature allows user-defined commands to be
137139
programmed into the ANSYS program. Once programmed, this command can
138140
be input to the program like other commands, and can also be included
139-
in the ANSYS start-up file. See *ULIB for another way of defining user
141+
in the ANSYS start-up file. See ``*ULIB`` for another way of defining user
140142
commands.
141143
142144
Up to 10 subroutines are available for user-defined commands (USER01 to

0 commit comments

Comments
 (0)