@@ -913,4 +913,61 @@ files for inclusion in the documentation.
913
913
| examples/02-HFSS/HFSS_Spiral.py | examples-design-and-simulation-of-spiral-inductors.py |
914
914
+-------------------------------------------------+-------------------------------------------------------+
915
915
916
- If you have questions about SEO, email the `PyAnsy Core team <pyansys_core_email _>`_.
916
+ If you have questions about SEO, email the `PyAnsys Core team <pyansys_core_email _>`_.
917
+
918
+ Facilitating contributions in the form of examples
919
+ --------------------------------------------------
920
+
921
+ One of the main challenges we face inside our libraries is the lack of examples. Examples are
922
+ critical for users to understand how to use the library and present new functionality. They are also
923
+ a great mechanism to educate users on the best practices of using it.
924
+
925
+ When users want to contribute examples, we need to make it as easy as possible for them to do so. This
926
+ means that we need to provide a clear structure for them to follow. We also need to make sure that the
927
+ build process is as simple as possible.
928
+
929
+ 2 best practices for examples are:
930
+
931
+ - **Providing a template **: This is a great way to ensure that users follow the same structure. It also makes it easy for
932
+ them to get started. The template should include all the necessary information, such as the name of the
933
+ example, a description, and the code itself.
934
+ - **Verifying the example **: This is a great way to ensure that the example works as expected. It also helps to catch any
935
+ errors before they are submitted. The verification process should include running the example and checking
936
+ the output. If the example fails, it should be easy for the user to fix it.
937
+
938
+ Providing a template
939
+ ~~~~~~~~~~~~~~~~~~~~
940
+
941
+ Here is an example of how to promote the use of templates for examples:
942
+
943
+ - `PyAnsys Geometry examples template <PyAnsys_geometry_examples_template _>`_
944
+ - `PyPrimeMesh examples template <PyPrimemesh_examples_template _>`_
945
+
946
+ These templates are also referred to in the contributing guidelines:
947
+
948
+ - `PyAnsys Geometry example contribution guidelines <PyAnsys_geometry_examples_contribution _>`_
949
+
950
+ Verifying examples
951
+ ~~~~~~~~~~~~~~~~~~
952
+
953
+ The verification process will depend on each library and the tools used for generating the examples. Within
954
+ our ecosystem, we are using Sphinx Gallery and NBSphinx to generate the examples, and the build process
955
+ is slightly different for each library.
956
+
957
+ However, the following approach could be useful for all libraries:
958
+
959
+ - Create a Makefile target that only runs a specific example.
960
+
961
+ This target should be used to run the example and check the output. If the example fails, it should be easy for the user to fix it.
962
+ An example of this is the ``make `` target in PyAnsys Geometry:
963
+
964
+ .. code-block :: console
965
+
966
+ ./make.bat single-example examples/01_getting_started/01_math.mystnb
967
+
968
+ .. code-block :: console
969
+
970
+ make single-example examples/01_getting_started/01_math.mystnb
971
+
972
+ The pull request in which this was added is: `PyAnsys Geometry PR #1893 <PyAnsys_geometry_pull_1893 _>`_
973
+ This implementation is specific for NB Sphinx, but the idea is to create a target that runs a specific example and checks the output.
0 commit comments