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: ansys/ansys-templates#issues
Note
If you encounter any problem during the installation or usage of this tool, open a new issue on the repository’s Issues page.
PyAnsys templates#
The ansys-templates
tool provides two templates for creating PyAnsys
projects: pyansys
and pyansys-advanced
.
Important
To access these templates, you must install the ansys-templates
package.
For information on how to use this tool, see User guide in the
Ansys templates documentation.
PyAnsys template#
The pyansys
template ships only with required directories and files to
quickly set up a PyAnsys-compliant project:
A
src/ansys/product/library/
directoryA
setup.py
fileGeneration of
doc
andtests
directoriesA generic
.gitignore
file for Python librariesBuild, documentation, and test requirements files
Metadata files like those for the
README
andLICENSE
To create a project based on the pyansys
template, run
this command:
ansys-templates new pyansys
PyAnsys advanced template#
The pyansys-advanced
template is an enhanced version of the pyansys
template.
It ships with the same directories and files and supports additional features:
lets you 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 command:
ansys-templates new pyansys-advanced