Skip to content

Commit 459f033

Browse files
authored
Merge branch 'main' into maint/ubuntu_latest
2 parents 337f2e7 + 7e6433c commit 459f033

File tree

10 files changed

+66
-83
lines changed

10 files changed

+66
-83
lines changed

.github/workflows/ci_cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
steps:
6464

6565
- name: "Download HTML documentation artifacts"
66-
uses: actions/download-artifact@v4
66+
uses: actions/download-artifact@v5
6767
with:
6868
name: documentation-html
6969
path: documentation-html
@@ -84,7 +84,7 @@ jobs:
8484
steps:
8585

8686
- name: "Download HTML documentation"
87-
uses: actions/download-artifact@v4
87+
uses: actions/download-artifact@v5
8888
with:
8989
name: documentation-html
9090
path: documentation-html
@@ -96,7 +96,7 @@ jobs:
9696
dest: documentation-html.zip
9797

9898
- name: "Download PDF documentation"
99-
uses: actions/download-artifact@v4
99+
uses: actions/download-artifact@v5
100100
with:
101101
name: documentation-pdf
102102
path: documentation-pdf
@@ -125,7 +125,7 @@ jobs:
125125
steps:
126126

127127
- name: "Download HTML documentation artifacts"
128-
uses: actions/download-artifact@v4
128+
uses: actions/download-artifact@v5
129129
with:
130130
name: documentation-html
131131
path: documentation-html

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Syncer
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- uses: micnncim/action-label-syncer@v1
1818
env:
1919
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/nightly-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Setup headless display
1717
uses: pyvista/setup-headless-display-action@v4
1818

19-
- uses: actions/checkout@v4
19+
- uses: actions/checkout@v5
2020

2121
- name: Set up Python
2222
uses: actions/setup-python@v5

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ repos:
22

33

44
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
rev: v0.11.13
5+
rev: v0.12.9
66
hooks:
77
- id: ruff-check
88
- id: ruff-format
@@ -20,13 +20,13 @@ repos:
2020
args: ["--ignore-words", "doc/styles/config/vocabularies/ANSYS/accept.txt"]
2121

2222
- repo: https://github.com/pre-commit/pre-commit-hooks
23-
rev: v5.0.0
23+
rev: v6.0.0
2424
hooks:
2525
- id: check-merge-conflict
2626
- id: debug-statements
2727

2828
- repo: https://github.com/python-jsonschema/check-jsonschema
29-
rev: 0.33.0
29+
rev: 0.33.3
3030
hooks:
3131
- id: check-github-workflows
3232
name: "Check GitHub workflows"

doc/source/getting-started/administration.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ the public release of a PyAnsys library must go through a project approval proce
88
First step
99
----------
1010

11+
.. danger::
12+
13+
Open-source allows users not only to view the source code, but also to modify, share, and reuse it under specific conditions.
14+
It differs from making it public as anyone can use and build upon the content.
15+
Do not commit any proprietary information belonging either to Ansys or to external sources. If you are uncertain, consult your manager.
16+
1117
To trigger the public release process, project leads must first complete the
1218
`open source request form`_.
1319

doc/source/how-to/documenting.rst

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -763,79 +763,7 @@ are changing. For more information, see :ref:`Branching model`.
763763
As you are making changes in this branch, you want to periodically generate the
764764
documentation locally so that you can test your changes before you create a
765765
GitHub pull request. For more information, see :ref:`Build documentation`.
766-
767-
Use PyMeilisearch as a documentation search engine
768-
--------------------------------------------------
769-
770-
PyMeilisearch is a Python client library that lets you use MeiliSearch, an open
771-
source search engine, to provide fast and relevant documentation search capabilities.
772-
773-
To use PyMeilisearch as a search engine for multi-version documentation, perform
774-
these steps.
775-
776-
#. Ensure that you are using `Ansys Sphinx Theme <Ansys_Sphinx_theme_repo_>`_ version 0.8
777-
or later for building your library's documentation.
778-
779-
#. In the ``conf.py`` file in the ``doc/source`` directory, include these lines:
780-
781-
.. code-block:: python
782-
783-
import os
784-
785-
from ansys_sphinx_theme import convert_version_to_pymeilisearch
786-
787-
788-
cname = os.getenv("DOCUMENTATION_CNAME", "<DEFAULT_CNAME>")
789-
"""Canonical name (CNAME) of the webpage hosting the documentation."""
790-
791-
html_theme_options = {
792-
"use_meilisearch": {
793-
"api_key": os.getenv("MEILISEARCH_API_KEY", ""),
794-
"index_uids": {
795-
f"<your-index-name>{convert_version_to_pymeilisearch(__version__)}": "index name to display", # noqa: E501
796-
},
797-
},
798-
...
799-
}
800-
801-
#. In these lines, replace *<your-index-name>* with the name for your MeiliSearch index.
802-
803-
The ``convert_version_to_pymeilisearch`` function converts your library's version into
804-
a format suitable for MeiliSearch indexing.
805-
806-
#. Enable documentation index deployment for development and stable versions using Ansys actions:
807-
808-
.. code-block:: yaml
809-
810-
jobs:
811-
doc-deploy-index:
812-
name: "Index the documentation and scrap using PyMeilisearch"
813-
runs-on: ubuntu-latest
814-
needs: doc-deploy
815-
if: github.event_name == 'push'
816-
steps:
817-
- name: Scrape the stable documentation to PyMeilisearch
818-
run: |
819-
VERSION=$(python -c "from <your-package> import __version__; print('.'.join(__version__.split('.')[:2]))")
820-
VERSION_MEILI=$(python -c "from <your-package> import __version__; print('-'.join(__version__.split('.')[:2]))")
821-
echo "Calculated VERSION: $VERSION"
822-
echo "Calculated VERSION_MEILI: $VERSION_MEILI"
823-
824-
- name: "Deploy the latest documentation index"
825-
uses: ansys/actions/[email protected]
826-
with:
827-
cname: "<library>.docs.pyansys.com/version/$VERSION"
828-
index-name: "<index-name>v$VERSION_MEILI"
829-
host-url: "<meilisearch-host-url>"
830-
api-key: ${{ secrets.MEILISEARCH_API_KEY }}
831-
832-
#. Replace *<your-package>*, *<your-index-name>*, and *<library>* with appropriate values
833-
for your project.
834-
835-
The version of your package is automatically calculated and used for indexing, ensuring that
836-
your documentation remains up to date. For more information, see the `PyMeilisearch`_ and
837-
`Ansys Sphinx Theme <ansys-sphinx-theme-doc_>`_ documentation.
838-
766+
839767
.. _SEO:
840768

841769
Optimize web searches

doc/source/how-to/vulnerabilities.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,13 @@ and the risk of command injection is significantly reduced.
204204
# Removing shell=True and using a list
205205
subprocess.run(["echo", user_input]) # User input is not executed as a shell command
206206
207+
.. note::
208+
209+
Bandit warning remains even after deactivating the `shell=True` argument.
210+
If you are sure that the command is safe, you can ignore the Bandit warning. Please
211+
check the `Ignore Bandit warnings`_ section for more information on how to do so.
212+
213+
207214

208215
**try except continue statements**
209216

@@ -285,3 +292,43 @@ provides a secure way to generate random numbers.
285292
286293
secure_random_number = secrets.randbelow(100) # Secure random number generation
287294
secure_random_letter = secrets.choice(["a", "b", "c"]) # Secure choice from a list
295+
296+
297+
Ignore Bandit warnings
298+
----------------------
299+
300+
In-line comment
301+
~~~~~~~~~~~~~~~
302+
303+
When using Bandit, you may encounter warnings that you believe are not relevant to your codebase
304+
or that you have already addressed. In such cases, you can ignore specific Bandit warnings by
305+
adding a comment to the end of the line that triggers the warning. The comment should be in the
306+
format ``# nosec <warning_id>``, where ``<warning_id>`` is the ID of the warning you want to ignore.
307+
308+
When you ignore a Bandit warning, it is essential to provide a clear comment explaining why
309+
the warning is being ignored. This helps maintainers and other developers understand the context
310+
and rationale behind the decision.
311+
312+
For example, to ignore the B404 warning, you would add `# nosec B404` to the end of the line:
313+
314+
.. code:: python
315+
316+
# Subprocess is needed to start the backend. But
317+
# the input is controlled by the library. Excluding bandit check.
318+
import subprocess # nosec B404
319+
320+
321+
.. warning::
322+
323+
Please note that ignoring Bandit warnings should be done with caution, and you should ensure
324+
that the code is safe and does not introduce any security risks. It is recommended to review the
325+
`bandit documentation`_ for more information on each warning and the potential risks involved.
326+
327+
328+
Security considerations file
329+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330+
331+
In addition to ignoring specific Bandit warnings, it is a good practice to document the ignored
332+
advisories in a dedicated file. You can find an example of such a file in the `PyACP security
333+
considerations`_ documentation page. This way, you can provide to the users a clear overview of
334+
the vulnerabilities that need to be taken into account when using the library.

doc/source/links.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
.. _unzip: https://7-zip.org/
119119
.. _conventional_commit_types: https://github.com/commitizen/conventional-commit-types/blob/master/index.json
120120
.. _Test Driven Development (TDD): https://en.wikipedia.org/wiki/Test-driven_development
121+
.. _bandit documentation: https://bandit.readthedocs.io/en/latest/
121122
.. _blacklists bandit documentation: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html
122123

123124
.. #Sphinx-related links

doc/styles/config/vocabularies/ANSYS/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ Microelectromechanical
5656
monospaced
5757
Muela
5858
[Nn]amespace
59+
nosec
5960
npm
6061
numpy
6162
[Nn]umpydoc

requirements/requirements_doc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ sphinx_design==0.6.1
66
sphinxcontrib-mermaid>=0.7.1
77
sphinx-gallery==0.19.0
88
Pillow>=9.0
9-
pyvista==0.45.2
9+
pyvista==0.46.1

0 commit comments

Comments
 (0)