Templates#
Starting a new project from scratch is a tedious task. To simplify the starting process and make project generation more dynamic, the ansys-templates tool was created. Using this tool ensures that any project rendered is compliant with the latest PyAnsys coding and API style guidelines.
The ansys-templates
tool#
The ansys-templates tool is a command-ine interface that provides a collection of templates. When you use this tool to create a PyAnsys project, your responses to the several questions that are asked result in dynamic project generation.
To install the latest stable version of this tool, see Getting started in the Ansys templates documentation. Here are important links for this tool:
Repository: ansys/ansys-templates
Documentation: https://templates.ansys.com
Issues board: ansys/ansys-templates#issues
Note
If you encounter any problem during the installation or usage of this tool, open a new issue on the ansys-templates issues board.
PyAnsys available templates#
There are two templates that you can use to create PyAnsys
projects: pyansys
and pyansys-advanced
.
Important
To access these templates, you must install ansys-templates. For information on how to use this tool, see User guide in the Ansys templates documentation.
PyAnsys template#
The pyansys
template ships only with the required directories and files to
quickly set up a PyAnsys-compliant project. This template provides the following:
A
src/ansys/product/library/
directoryA
setup.py
fileGeneration of
doc/
andtests/
directoriesA generic
.gitignore
file for Python librariesBuild, doc, and test requirements files
Metadata files like
README.rst
andLICENSE
To create a project based on the pyansys
template, run
this code:
ansys-templates new pyansys
PyAnsys advanced template#
The pyansys-advanced
template is an enhanced version of the pyansys
template.
It ships with the same files as the preceding template but also includes additional
features:
Allows you to select the project file (
setup.py
orpyproject.toml
)Uses Tox for testing and task automation
Includes GitHub Actions for CI purposes
Uses pre-commit for checking coding style
To create a project based on the pyansys-advanced
template, run this code:
ansys-templates new pyansys-advanced