Skip to content

Commit edfb728

Browse files
docs: restructure duplicated content (#752)
* docs: rename sessions * fix: coding style * docs: add cicd reusable actions * docs: add cicd reusable actions * fix: vale * fix: formatting tools * docs: remove docstyle * docs: update the index * docs: update the index * docs: update the index * Apply suggestions from code review Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> * docs: update the links * ci: update the labeler * ci: labels * ci: test ubundu latest * ci: revert * Apply suggestion from @Revathyvenugopal162 --------- Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com>
1 parent e9448ce commit edfb728

18 files changed

Lines changed: 198 additions & 441 deletions

File tree

.github/labeler.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
# -- Labels based on PR title ------------------------------------------------
2+
3+
'fix':
4+
- head-branch: ['fix']
5+
6+
'enhancement':
7+
- head-branch: ['feat']
8+
9+
110
documentation:
2-
- changed-files:
3-
- any-glob-to-any-file: ['doc/source/**/*']
11+
- any:
12+
- changed-files:
13+
- any-glob-to-any-file: ['doc/source/**/*']
14+
- head-branch: ['docs', 'doc']
15+
416
maintenance:
5-
- changed-files:
6-
- any-glob-to-any-file: ['.github/**/*', 'ruff.toml', 'pyproject.toml', 'docker/**/*']
17+
- any:
18+
- changed-files:
19+
- any-glob-to-any-file: ['.github/**/*', 'ruff.toml', '.pre-commit-config.yaml']
20+
- head-branch: ['maint', 'ci', 'no-ci']
21+
722
dependencies:
8-
- changed-files:
9-
- any-glob-to-any-file: ['requirements/*']
23+
- any:
24+
- changed-files:
25+
- any-glob-to-any-file: ['requirements/*']

.github/labels.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
1-
- name: bug
1+
- name: 'bug'
22
description: Something isn't working
33
color: d42a34
44

5-
- name: dependencies
5+
- name: 'dependencies'
66
description: Related with project dependencies
77
color: FFD827
88

9-
- name: documentation
9+
- name: 'documentation'
1010
description: Improvements or additions to documentation
1111
color: 0677ba
1212

13-
- name: enhancement
13+
- name: 'enhancement'
1414
description: New features or code improvements
1515
color: ffc0cb
1616

17-
- name: good first issue
17+
- name: 'good first issue'
1818
description: Easy to solve for newcomers
1919
color: 62ca50
2020

21-
- name: maintenance
21+
- name: 'maintenance'
2222
description: Package and maintenance related
2323
color: f78c37
2424

25-
- name: graphics
25+
- name: 'graphics'
2626
description: Related with plotting utilities
2727
color: 000000
2828

29-
- name: support
29+
- name: 'support'
3030
description: Further information is requested
3131
color: 6a32a5
3232

33-
- name: release
34-
description: Checklist for an upcoming release
35-
color: ffffff

.github/workflows/labeler.yml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,3 @@ jobs:
3333
with:
3434
repo-token: "${{ secrets.GITHUB_TOKEN }}"
3535

36-
# Label based on branch name
37-
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
38-
if: |
39-
startsWith(github.event.pull_request.head.ref, 'doc') ||
40-
startsWith(github.event.pull_request.head.ref, 'docs')
41-
with:
42-
labels: documentation
43-
44-
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
45-
if: |
46-
startsWith(github.event.pull_request.head.ref, 'maint') ||
47-
startsWith(github.event.pull_request.head.ref, 'no-ci') ||
48-
startsWith(github.event.pull_request.head.ref, 'docker') ||
49-
startsWith(github.event.pull_request.head.ref, 'ci')
50-
with:
51-
labels: maintenance
52-
53-
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
54-
if: startsWith(github.event.pull_request.head.ref, 'feat')
55-
with:
56-
labels: |
57-
enhancement
58-
- uses: actions-ecosystem/action-add-labels@18f1af5e3544586314bbe15c0273249c770b2daf # v1.1.3
59-
if: |
60-
startsWith(github.event.pull_request.head.ref, 'fix') ||
61-
startsWith(github.event.pull_request.head.ref, 'patch')
62-
with:
63-
labels: bug

README.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,3 @@ This guide describes the PyAnsys project organization and administration.
1515
It also provides how-to information and summarizes packaging, coding, and
1616
documentation styles. It concludes with an abstractions section that explains
1717
how apps and complex services expose only functionalities that matter to users.
18-
19-
From the **About** area for the repository, you can click the link to view
20-
the latest web-based release of this guide. In the `Releases <https://github.com/ansys/pyansys-dev-guide/releases>`_
21-
area, you can view information about all releases. In the **Assets** area for
22-
any release, you can download a PDF file of the guide.

doc/source/coding-style/deprecation.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ there is no official guidance on deprecating features within Python.
77
Thus, this topic provides deprecation best practices for PyAnsys
88
libraries.
99

10+
.. note::
11+
This page covers API-level deprecation of methods, classes, and functions.
12+
For retiring an entire repository or package lifecycle, see
13+
:ref:`deprecating`.
14+
1015
Whenever you deprecate a method, class, or function, you must take one of
1116
these actions:
1217

doc/source/coding-style/formatting-tools.rst

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ There are many tools for checking code style. This section presents some of
77
the most popular ones in the Python ecosystem. A minimum configuration is
88
provided for each one so that you can easily include them in your PyAnsys project.
99

10+
.. note::
11+
This page focuses on code-quality automation for Python projects.
12+
For documentation-focused tools such as ``blacken-docs``, ``docformatter``,
13+
``Vale``, and ``numpydoc`` validation, see
14+
:ref:`doc_style_tools`.
15+
1016
Most of the tools presented can be configured using :ref:`the
1117
\`\`pyproject.toml\`\` file`. Avoiding dotfiles leads to a much
1218
cleaner root project directory.
1319

1420
Ruff
1521
----
1622

17-
`Ruff`_ is a Python linter and code formatter written in Rust. It aims to be
18-
orders of magnitude faster than alternative tools while integrating more
19-
functionality behind a single, common interface. Ruff can therefore be used
20-
to replace the previously preferred alternatives that were `Flake8`_
23+
`Ruff`_ is a Python linter and code formatter written in Rust. It aims to be
24+
orders of magnitude faster than alternative tools while integrating more
25+
functionality behind a single, common interface. Ruff can therefore be used
26+
to replace the previously preferred alternatives that were `Flake8`_
2127
(natively re-implementing its popular plugins), `Black`_ and `isort`_.
2228

23-
It is actively developed, used in major open-source projects, and offers the following
29+
It is actively developed, used in major open-source projects, and offers the following
2430
features and advantages:
2531

2632
- Can be installed via ``pip install ruff``
@@ -47,6 +53,7 @@ may look like this:
4753
[tool.ruff.format]
4854
quote-style = "double"
4955
indent-style = "space"
56+
docstring-code-format = true
5057
5158
[tool.ruff.lint]
5259
select = [
@@ -57,6 +64,7 @@ may look like this:
5764
"N", # pep8-naming, see https://docs.astral.sh/ruff/rules/#pep8-naming-n
5865
"PTH", # flake8-use-pathlib, https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
5966
"TD", # flake8-todos, https://docs.astral.sh/ruff/rules/#flake8-todos-td
67+
"W", # pycodestyle, see https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
6068
]
6169
ignore = [
6270
"TD003", # Missing issue link in TODOs comment
@@ -69,9 +77,9 @@ may look like this:
6977
combine-as-imports = true
7078
force-sort-within-sections = true
7179
72-
Linting and formatting rules shall be added step by step when migrating a project to Ruff,
73-
gradually resolving the triggered errors. For more information about configuring Ruff, as
74-
well as a complete description of the available rules and settings, please refer to the
80+
Linting and formatting rules shall be added step by step when migrating a project to Ruff,
81+
gradually resolving the triggered errors. For more information about configuring Ruff, as
82+
well as a complete description of the available rules and settings, see the
7583
`tool's documentation <https://docs.astral.sh/ruff/configuration/>`__.
7684

7785

@@ -126,13 +134,13 @@ configuration that includes both code and documentation formatting tools.
126134
.. code-block:: yaml
127135
128136
repos:
129-
137+
130138
- repo: https://github.com/astral-sh/ruff-pre-commit
131139
rev: vX.Y.Z
132140
hooks:
133141
- id: ruff
134142
- id: ruff-format
135-
143+
136144
- repo: https://github.com/codespell-project/codespell
137145
rev: vX.Y.Z
138146
hooks:
@@ -144,7 +152,7 @@ configuration that includes both code and documentation formatting tools.
144152
- id: pydocstyle
145153
additional_dependencies: [toml]
146154
exclude: "tests/"
147-
155+
148156
- repo: https://github.com/ansys/pre-commit-hooks
149157
rev: v0.2.4
150158
hooks:
@@ -168,7 +176,7 @@ Then, ensure that you install it as a ``Git hook`` by running this command:
168176
Use ``pre-commit``
169177
~~~~~~~~~~~~~~~~~~
170178

171-
One installed as described, ``pre-commit`` automatically triggers every time
179+
Once installed as described, ``pre-commit`` automatically triggers every time
172180
that you try to commit a change. If any hook defined in the ``.pre-commit-config.yaml``
173181
file fails, you must fix the failing files, stage the new changes, and try to commit
174182
them again.
@@ -280,3 +288,40 @@ Use the following configuration in your ``.pre-commit-config.yaml`` file to be c
280288
281289
repos:
282290
# Your repository-specific configurations here
291+
292+
CI/CD integration with Ansys reusable actions
293+
----------------------------------------------
294+
295+
The PyAnsys ecosystem provides a set of reusable GitHub Actions in the
296+
`ansys/actions <https://actions.docs.ansys.com/version/stable/index.html>`_
297+
repository. These actions encapsulate common CI/CD tasks so that individual
298+
PyAnsys projects do not need to re-implement them from scratch.
299+
300+
For code style enforcement in CI, use the ``code-style`` action. It internally
301+
runs ``pre-commit`` with all hooks defined in your ``.pre-commit-config.yaml``
302+
file, guaranteeing that every pull request is checked against the same rules
303+
that developers run locally.
304+
305+
A minimal job definition looks like this:
306+
307+
.. code-block:: yaml
308+
309+
code-style:
310+
name: "Code style"
311+
runs-on: ubuntu-latest
312+
steps:
313+
- name: "Code style"
314+
uses: ansys/actions/code-style@vX.Y.Z
315+
with:
316+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
317+
318+
.. note::
319+
320+
Replace ``vX.Y.Z`` with the latest available version. For the full list of
321+
inputs and outputs supported by this action, see the
322+
`Code style action documentation
323+
<https://actions.docs.ansys.com/version/stable/style-actions/index.html#code-style-action>`_.
324+
325+
For a complete list of all reusable actions provided by the PyAnsys ecosystem,
326+
see the `Ansys actions documentation
327+
<https://actions.docs.ansys.com/version/stable/index.html>`_.

doc/source/coding-style/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ within Python.
3535

3636
pep8
3737
formatting-tools
38-
required-standard
3938
deprecation

doc/source/coding-style/required-standard.rst

Lines changed: 0 additions & 119 deletions
This file was deleted.

doc/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"min_chars_for_search": 2,
5353
"ignoreLocation": True,
5454
},
55+
"header_links_before_dropdown": 6,
5556
}
5657

5758
# necessary for proper breadcrumb title

0 commit comments

Comments
 (0)