Skip to content

Commit a0d8d77

Browse files
committed
initial CI attempt
1 parent c6e7b74 commit a0d8d77

File tree

12 files changed

+264
-75
lines changed

12 files changed

+264
-75
lines changed

.github/workflows/ci-build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Documentation Build
2+
on: [push, pull_request, workflow_dispatch]
3+
4+
jobs:
5+
docs_build:
6+
runs-on: ubuntu-20.04
7+
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Setup Python
12+
uses: actions/[email protected]
13+
with:
14+
python-version: 3.8
15+
16+
- name: Build HTML Documentation
17+
run: |
18+
pip install -r requirements_docs.txt --disable-pip-version-check
19+
make -C doc html SPHINXOPTS="-W"
20+
touch doc/build/html/.nojekyll
21+
echo "dev.docs.pyansys.com" > doc/build/html/CNAME
22+
23+
- name: Build PDF Documentation
24+
run: |
25+
sudo apt install apt-get install -y texlive-latex-base
26+
make -C doc latexpdf
27+
28+
- name: Upload HTML Documentation
29+
uses: actions/[email protected]
30+
with:
31+
name: Documentation
32+
path: doc/build/html
33+
retention-days: 7
34+
35+
- name: Upload PDF Documentation
36+
uses: actions/[email protected]
37+
with:
38+
name: Documentation
39+
path: doc/build/latex/*.pdf
40+
retention-days: 7
41+
42+
- name: Deploy to gh-pages
43+
if: github.ref == 'refs/heads/main'
44+
uses: JamesIves/[email protected]
45+
with:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
BRANCH: gh-pages
48+
FOLDER: doc/build/html
49+
CLEAN: true
50+
single-commit: true

.github/workflows/style.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# check spelling, codestyle
2+
name: Style Check
3+
4+
on: [push, pull_request, workflow_dispatch]
5+
6+
jobs:
7+
stylecheck:
8+
runs-on: ubuntu-20.04
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Setup Python
14+
uses: actions/[email protected]
15+
with:
16+
python-version: 3.8
17+
18+
- name: Check Style
19+
run: |
20+
pip install -r requirements_style.txt --disable-pip-version-check
21+
make

README.rst

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
1-
Introduction
2-
############
1+
PyAnsys Developer's Guide
2+
#########################
33

4-
Through the PyAnsys project, Ansys provides Python libraries that
5-
expose Ansys technologies to the Python ecosystem. These libraries
6-
are more than reusable scripts. They are clear, concise, and
7-
maintainable APIs and interfaces. Their useful functions, classes,
8-
and plugins eliminate the need to write scripts and code from scratch.
4+
This guide serves as the central document for:
95

10-
These libraries play a vital role in:
11-
12-
- Application automation
13-
- Machine learning
14-
- Postprocessing
15-
- Data visualization
16-
- Workflow orchestrations
17-
- Data manipulation and export
18-
19-
20-
Purpose
21-
#######
22-
The PyAnsys project is the central site for:
23-
24-
- Ansys developers who want to create and "own" libraries
6+
- Ansys developers who want to create and "own" libraries.
257
- Anyone in the Python community who wants to contribute to a
26-
library
8+
library.
279
- Anyone who is interested in learning more about the PyAnsys
28-
project and libraries
29-
30-
10+
project and libraries.

doc/source/conf.py

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
from pyansys_sphinx_theme import __version__
1+
from datetime import datetime
22

33
# Project information
4-
project = 'pyansys_sphinx_theme'
5-
copyright = '2021, ANSYS'
6-
author = 'PyAnsys Open Source Developers'
7-
release = version = __version__
4+
project = 'PyAnsys Developers Guide'
5+
copyright = f'{datetime.now().year}, ANSYS'
6+
author = 'ANSYS, Inc.'
7+
release = version = '0.1.dev0'
88

9-
# optionally use the default pyansys logo
109
html_logo = 'https://docs.pyansys.com/_static/pyansys-logo-black-cropped.png'
11-
1210
html_theme = 'pyansys_sphinx_theme'
1311

14-
# specify the location of your github repo
1512
html_theme_options = {
16-
"github_url": "https://github.com/pyansys/pyansys-sphinx-theme",
13+
"github_url": "https://github.com/pyansys/about",
1714
"show_prev_next": False
1815
}
1916

@@ -30,3 +27,40 @@
3027
# The master toctree document.
3128
master_doc = 'index'
3229

30+
31+
master_doc = 'index'
32+
33+
latex_elements = {}
34+
35+
# Grouping the document tree into LaTeX files. List of tuples
36+
# (source start file, target name, title,
37+
# author, documentclass [howto, manual, or own class]).
38+
latex_documents = [
39+
(master_doc,
40+
f'pyansys_dev_guide_v{version}.tex',
41+
"PyAnsys Developer's Guide",
42+
author,
43+
'manual'),
44+
]
45+
46+
47+
# # -- Options for manual page output ------------------------------------------
48+
49+
# # One entry per manual page. List of tuples
50+
# # (source start file, name, description, authors, manual section).
51+
# man_pages = [
52+
# (master_doc, 'ansys.mapdl.core', 'ansys.mapdl.core Documentation',
53+
# [author], 1)
54+
# ]
55+
56+
57+
# # -- Options for Texinfo output ----------------------------------------------
58+
59+
# # Grouping the document tree into Texinfo files. List of tuples
60+
# # (source start file, target name, title, author,
61+
# # dir menu entry, description, category)
62+
# texinfo_documents = [
63+
# (master_doc, 'ansys.mapdl.core', 'ansys.mapdl.core Documentation',
64+
# author, 'ansys.mapdl.core', 'Pythonic interface to MAPDL using gRPC',
65+
# 'Engineering Software'),
66+
# ]

doc/source/documentation/class_documentation.rst

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ Class Documentation
44
There are two main ways of using Sphinx to document an API class:
55

66
* Manually describe "how" and "why" to use a class in either
7-
a "User Guide" or an example within the library's documentation
7+
a "User Guide" or an example within the library's documentation .
88
* Automatically generate API documentation for classes using the
9-
``autoclass`` or ``autosummary`` directive
9+
``autoclass`` or ``autosummary`` directive.
1010

1111
Manual Documentation
1212
--------------------
1313

1414
To manually describe the "how" and "why" usage of a class, use the
15-
``.. code:: python`` directive:
16-
17-
.. code::
15+
``.. code:: python`` directive::
1816

1917
Initialize ``my_module.MyClass`` with initial parameters. These
2018
parameters are automatically assigned to the class.
@@ -26,6 +24,8 @@ To manually describe the "how" and "why" usage of a class, use the
2624
>>> my_obj.parm1
2725
'apple'
2826

27+
This will be rendered as:
28+
2929
Initialize ``my_module.MyClass`` with initial parameters. These
3030
parameters are automatically assigned to the class.
3131

@@ -43,22 +43,18 @@ Auto-Generated Documentation
4343
To automatically genereate class descriptions, use either the ``autoclass``
4444
or ``autosummary`` directive.
4545

46-
For simple classes, you can use the ``autoclass`` directive:
47-
48-
49-
.. code::
46+
For simple classes, you can use the ``autoclass`` directive::
5047

5148
.. autoclass:: pyansys_sphinx_theme.samples.ExampleClass
5249
:members:
5350

51+
Which is rendered as:
5452

5553
.. autoclass:: pyansys_sphinx_theme.samples.ExampleClass
5654
:members:
5755

5856
For complex classes with many methods, you should use
59-
the ``autosummary`` directive:
60-
61-
.. code::
57+
the ``autosummary`` directive::
6258

6359
.. autoclass:: pyansys_sphinx_theme.samples.Complex
6460

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,60 @@
1-
Docstrings
2-
##########
1+
.. _docstrings:
32

4-
When writing docstrings for PyAnsys libraries, you should pick either
5-
the `numpydoc`_ or `googledoc`_ documentation style. Adhering to the
6-
selected style permits usage of the `sphinx.ext.napoleon
7-
<https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html>`_
8-
extension, which is included in Sphinx version 1.3 and later.
3+
Docstring Standards
4+
###################
5+
When writing docstrings for PyAnsys libraries, use the `numpydoc`_
6+
documentation style. To use `numpydoc`_ add the following to your
7+
``conf.py``:
98

9+
.. code:: python
10+
11+
extensions = ['numpydoc',
12+
# other extensions
13+
]
14+
15+
16+
Minimum Requirements
17+
--------------------
18+
PyAnsys libary docstrings contain at a minimum the following
19+
`numpydoc`_ sections:
20+
21+
* `Short description <https://numpydoc.readthedocs.io/en/latest/format.html#short-summary>`_.
22+
* `Extended Summary <https://numpydoc.readthedocs.io/en/latest/format.html#extended-summary>`_ (if applicable)
23+
* `Parameters <https://numpydoc.readthedocs.io/en/latest/format.html#parameters>`_ if applicable
24+
* `Returns <https://numpydoc.readthedocs.io/en/latest/format.html#returns>`_ if applicable
25+
* `Examples <https://numpydoc.readthedocs.io/en/latest/format.html#examples>`_
26+
27+
These sections should follow the numpydoc standards. To avoid
28+
inconsistencies between PyAnsys libaries, adhere to the following
29+
additional standards:
30+
31+
32+
Parameters
33+
~~~~~~~~~~
34+
Always specify the type, and whenever necessary, provide the full class name::
35+
36+
Parameters
37+
----------
38+
my_obj : :class:`ansys.<product>.<library>.FooClass`
39+
Description of FooClass.
40+
some_int : int
41+
Some interger value.
42+
43+
.. note::
44+
These parameter descriptions have punctuation.
45+
46+
47+
Returns
48+
~~~~~~~
49+
Returns section contains only the return type and no the name and type::
50+
51+
Returns
52+
-------
53+
int
54+
Description of some return value.
55+
56+
Example Docstrings
57+
------------------
1058
Methods and functions should generally be documented with the
1159
``Examples`` docstring section to make the usage of the method or
1260
function clear. Here is a sample function:
@@ -25,12 +73,28 @@ This directive renders the sample function as:
2573
.. autofunction:: pyansys_sphinx_theme.sample_func.func
2674

2775

76+
Validation
77+
----------
78+
Enable validation of docstrings during the sphinx build by adding the
79+
following line to ``conf.py``::
80+
81+
numpydoc_validation_checks = {"GL08"}
82+
83+
This will issue the following warning for any objects without a docstring::
84+
85+
"The object does not have a docstring"
86+
87+
The ``"GL08"`` code is required at minimum for PyAnsys projects.
88+
Other codes may be enforced at a later date; for a full listing see
89+
`numpydoc Validation Check
90+
<https://numpydoc.readthedocs.io/en/latest/validation.html#validation>`_.
91+
92+
2893
Additional Information
2994
----------------------
30-
Additional examples and notes regarding Numpy or Google docstrings can
31-
be found at `sphinx.ext.napoleon
32-
<https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html>`_.
33-
A consistent documentation style should be followed whenever possible.
95+
Additional examples and notes can be found at `numpydoc`_. Reference
96+
their documentation as the primary source of information regarding
97+
docstring styles aside from the directives noted here.
3498

3599
.. _numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html
36100
.. _googledoc: https://google.github.io/styleguide/

doc/source/documentation/index.rst

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
1-
Documentation
2-
#############
3-
Good documentation drives library adoption and usage.
1+
API Documentation
2+
#################
3+
Good documentation drives library adoption and usage and is the
4+
foundation for a good developer experience. Even with the best
5+
interfaces and the most functional product, no one will adopt the API
6+
if they don't know how to use it or if they aren't convinced by the
7+
documentation or examples they are presented with.
8+
9+
Good API documentation provides the following:
10+
11+
* Increased adoption and improved experience for the developers using
12+
the API or libary.
13+
* Reduction in the time spent on-boarding new users (both contributors
14+
and users of the project).
15+
* Better maintainance of the codebase. The time spent reading the
16+
source is often orders of magnitude greater than the time spent
17+
writing it. Well documented code (both in user-facing docstrings
18+
and developer comments) pays dividends in code maintaince.
19+
* Reduces the amount of time spent understanding the features API.
20+
21+
The documentation for a PyAnsys libary should contain the following
22+
23+
* Module, class, method, and function documentation strings. See
24+
:ref:`docstrings`.
25+
* Full examples gallery. See `PyMAPDL Examples
26+
<https://mapdldocs.pyansys.com/examples/index.html>`_
27+
* User guide.
28+
* Link to this contributing guide.
429

530
.. toctree::
631
:hidden:
732
:maxdepth: 3
833

934
docstrings
1035
class_documentation
11-
coding_style
36+
coding_style

0 commit comments

Comments
 (0)