Ansys pre-commit hooks
This Ansys repository contains pre-commit hooks for different purposes. The following hooks are currently available:
add-license-headers: Add missing license headers to files by using REUSE . To use this hook, you must have REUSE implemented in your repository.
tech-review: Do a technical review of your repository according to Ansys repository requirements
- pyansys-quality-report: Check PyAnsys quality
with selectable rules and a machine-readable JSON report.
Configure the quality report in the .pre-commit-config.yaml file:
- repo: https://github.com/ansys/pre-commit-hooks
rev: v0.8.1
hooks:
- id: pyansys-quality-report
args: [--show-all]
verbose: true
Run pre-commit run pyansys-quality-report --all-files (or prek run pyansys-quality-report --all-files) to show warnings and errors. Use --show-all to include passing checks, --check RM003 to select a rule, --ignore RM004 to omit one, --color never for plain output, or --json for JSON output. Colors are enabled by default, including for captured output. The current rules and options are documented in the quality report guide.
How to install
The following sections provide instructions for installing the ansys-pre-commit-hooks package in two installation modes: user and developer.
For users
Before installing the package, to ensure that you have the latest version of pip, run this command:
python -m pip install -U pip
Then, to install the package, run this command:
python -m pip install ansys-pre-commit-hooks
For developers
Installing the package in developer mode allows you to modify and enhance the source code.
Before contributing to the project, ensure that you are familiar with the PyAnsys Developer’s Guide.
For a developer installation, you must follow these steps:
Clone the repository with this command:
git clone https://github.com/ansys/pre-commit-hooksCreate a fresh-clean Python environment and activate it with these commands:
# Create a virtual environment python -m venv .venv # Activate it in a POSIX system source .venv/bin/activate # Activate it in Windows CMD environment .venv\Scripts\activate.bat # Activate it in Windows Powershell .venv\Scripts\Activate.ps1Ensure that you have the latest required build system tools by running this command:
python -m pip install -U pip flit tox twineInstall the project in editable mode by running one of these commands:
# Install the minimum requirements python -m pip install -e . # Install the minimum + tests requirements python -m pip install -e .[tests] # Install the minimum + doc requirements python -m pip install -e .[doc] # Install all requirements python -m pip install -e .[tests,doc]Verify your development installation by running this command:
tox
How to test it
This project takes advantage of tox. This tool automates common development tasks (similar to Makefile), but it is oriented towards Python development.
Using tox
While Makefile has rules, tox has environments. In fact, tox creates its own virtual environment so that anything being tested is isolated from the project to guarantee the project’s integrity.
These environment commands are provided:
tox -e style: Checks for coding style quality.
tox -e py: Checks for unit tests.
tox -e py-coverage: Checks for unit testing and code coverage.
tox -e doc: Checks for successfully building the documentation.
Raw testing
If required, you can call ruff check --fix . and ruff format . with Ruff, or unit testing commands, such as pytest, from the command line. However, calling these commands does not guarantee that your project is being tested in an isolated environment, which is the reason why tools like tox exist.
A note on pre-commit
The style checks take advantage of pre-commit. Developers are not forced but encouraged to install this tool by running this command:
python -m pip install pre-commit && pre-commit install
Documentation
For building documentation, you can run the usual rules provided in the Sphinx Makefile with a command that is formatted like this:
make -C doc/ html && your_browser_name doc/html/index.html
However, the recommended way of checking documentation integrity is by running tox with a command that is formatted like this:
tox -e doc && your_browser_name .tox/doc_out/index.html
Distributing
If you would like to create either source or wheel files, install the building requirements and then execute the build module with these commands:
python -m pip install .
python -m build
python -m twine check dist/*
Metadata
Release files for ansys-pre-commit-hooks 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ansys_pre_commit_hooks-0.8.1.tar.gz | 87.6 kB | With provenance | Details for ansys_pre_commit_hooks-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ansys_pre_commit_hooks-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for ansys_pre_commit_hooks-0.8.1-py3-none-any.whl |
Total release size: 164.0 kB
Release files / ansys_pre_commit_hooks-0.8.1.tar.gz
| Download URL | ansys_pre_commit_hooks-0.8.1.tar.gz |
|---|---|
| Size | 87.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
caf7fb2b742fed35fdf4112e276169467381166e5352c4f396330c61b51fbdf4
|
|
BLAKE2b-256 checksum How to use checksums |
0819d406c27f3d983ce532eeab6273f41777a29244b7ab5c1342c9f0732bbc02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logRelease files / ansys_pre_commit_hooks-0.8.1-py3-none-any.whl
| Download URL | ansys_pre_commit_hooks-0.8.1-py3-none-any.whl |
|---|---|
| Size | 76.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42127aa0d33386f1ca7d12764c081f26aa3e934565f4a9620252ea3f03e3119c
|
|
BLAKE2b-256 checksum How to use checksums |
9d81d61178353607369f331853bc6eb9d50feab4def48f6f1d5752f84197edc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logSecurity for ansys-pre-commit-hooks 0.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ansys_pre_commit_hooks-0.8.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.