ansys-pre-commit-hooks


Nameansys-pre-commit-hooks JSON
Version 0.5.1 PyPI version JSON
download
home_pagehttps://github.com/ansys/pre-commit-hooks
SummaryA Python wrapper to create Ansys-tailored pre-commit hooks
upload_time2025-01-17 13:40:47
maintainerANSYS, Inc.
docs_urlNone
authorANSYS, Inc.
requires_python<4,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Ansys pre-commit hooks
======================
|pyansys| |python| |pypi| |GH-CI| |MIT| |black| |pre-commit-ci|

.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC
   :target: https://docs.pyansys.com/
   :alt: PyAnsys

.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pre-commit-hooks?logo=pypi
   :target: https://pypi.org/project/ansys-pre-commit-hooks/
   :alt: Python

.. |pypi| image:: https://img.shields.io/pypi/v/ansys-pre-commit-hooks.svg?logo=python&logoColor=white
   :target: https://pypi.org/project/ansys-pre-commit-hooks
   :alt: PyPI

.. |GH-CI| image:: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml/badge.svg
   :target: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml
   :alt: GH-CI

.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
   :target: https://opensource.org/licenses/MIT
   :alt: MIT

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
   :target: https://github.com/psf/black
   :alt: Black

.. |pre-commit-ci| image:: https://results.pre-commit.ci/badge/github/ansys/pre-commit-hooks/main.svg
   :target: https://results.pre-commit.ci/latest/github/ansys/pre-commit-hooks/main
   :alt: pre-commit.ci status

This Ansys repository contains `pre-commit`_ hooks for different purposes.
Currently, these hooks are available:

* ``add-license-headers``: Add missing license headers to files by using
  `REUSE <https://reuse.software/>`_ . 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 <https://dev.docs.pyansys.com/packaging/structure.html>`_

``add-license-headers`` setup
-----------------------------

Add required directories
^^^^^^^^^^^^^^^^^^^^^^^^

If you are using the ansys.jinja2 template and MIT.txt license, skip this step. By default, the hook will make symbolic links
from its "assets" directory containing LICENSES/MIT.txt and .reuse/templates/ansys.jinja2
to your repository when the hook runs. The .reuse and LICENSES directories will be deleted once the hook is
done running.

If you are using a custom template, create a directory named ``.reuse``, and if you are using a custom license, create a directory
named ``LICENSES`` in the root of your repository. The custom template cannot be named ``ansys.jinja2``, otherwise it will be removed
after the hook is done running. The custom license cannot be named ``MIT.txt`` for the same reason. The ``.reuse`` and/or ``LICENSES``
directories will have to be committed to your repository and will not be removed once the hook is done running as long as there
are custom templates or licenses in those directories. Your project should have the following layout:

 ::

   project
   ├── LICENCES
   │   └── license_name.txt
   ├── .reuse
   │   └── templates
   │       └── template_name.jinja2
   ├── src
   ├── examples
   ├── tests
   ├── .pre-commit-config.yaml
   ├── pyproject.toml

Where ``license_name`` is the name of the license that is being used, for example, MIT.txt, and
``template_name`` is the name of the custom template being used. The jinja2 file contains the
template for the license headers that are added to the files.

Licenses that are supported by ``REUSE`` can be found in the
`spdx/license-list-data <https://github.com/spdx/license-list-data/tree/main/text>`_ repository.
Please select a license text file from that repository, and copy it to the LICENSES directory.

Set custom arguments
^^^^^^^^^^^^^^^^^^^^

.. code:: yaml

   - repo: https://github.com/ansys/pre-commit-hooks
     rev: v0.5.1
     hooks:
     - id: add-license-headers
       args: ["--custom_copyright", "custom copyright phrase", "--custom_template", "template_name", "--custom_license", "license_name", "--ignore_license_check", "--start_year", "2023"]

``args`` can also be formatted as follows:

.. code:: yaml

   args:
   - --custom_copyright=custom copyright phrase
   - --custom_template=template_name
   - --custom_license=license_name
   - --ignore_license_check
   - --start_year=2023

* ``custom copyright phrase`` is the copyright line you want to include in the license
  header. By default, it uses ``"ANSYS, Inc. and/or its affiliates."``.
* ``template_name`` is the name of the .jinja2 file located in ``.reuse/templates/``.
  By default, it uses ``ansys``.
* ``license_name`` is the name of the license being used. For example, MIT, ECL-1.0, etc.
  To view a list of licenses that are supported by ``REUSE``, see
  https://github.com/spdx/license-list-data/tree/main/text. By default it uses ``MIT``.
* ``ignore_license_check`` is whether or not to check for the license in the header. By default,
  it is ``False``, meaning the files are checked for both the copyright and licensing information
  in the header. Add ``--ignore_license_check`` to ignore checking for licensing information
  in the files.
* ``start_year`` is the start year of the copyright statement. By default, the ``start_year`` is
  the current year, making the copyright statement
  "Copyright (C) 2024 ANSYS, Inc. and/or its affiliates." If you are adding license headers
  to packages released before the current year, add the ``start_year`` argument with the year your
  package was released. For example, if ``start_year`` is 2023, the copyright statement would be
  "Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates." assuming the current year is 2024.

Specify directories to run the hook on
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By default, the hook will run on proto files in any directory, as well as python files within
directories named ``src``, ``examples``, and ``tests``. To specify additional files and/or directories
the hook should run on, add the necessary regex to the ``files`` line in your
.pre-commit-config.yaml file:

.. code:: yaml

   - repo: https://github.com/ansys/pre-commit-hooks
     rev: v0.5.1
     hooks:
     - id: add-license-headers
       files: '(src|examples|tests|newFolder)/.*\.(py|newExtension)|\.(proto|newExtension)'

Ignore specific files or file types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In .pre-commit-config.yaml:

.. code:: yaml

  - repo: https://github.com/ansys/pre-commit-hooks
    rev: v0.5.1
    hooks:
    - id: add-license-headers
      exclude: |
          (?x)^(
              path/to/file1.py |
              path/to/.*\.(ts|cpp) |
              (.folder1|folder2)/.* |
              .*\.js |
              \..* |
          )$

* ``path/to/file1.py`` excludes the stated file.
* ``path/to/.*\.(ts|cpp)`` excludes all .ts and .cpp files within the ``path/to`` directory.
* ``(.folder1|folder2)/.*`` excludes directories named .folder1 and folder2.
* ``.*\.js`` excludes all .js files in all directories.
* ``\..*`` excludes all hidden files.

``tech-review`` setup
---------------------

These are the default values for the arguments of the tech-review hook:

* ``--author_maint_name=ANSYS, Inc.``
* ``--author_maint_email=pyansys.core@ansys.com``
* ``--license=MIT``
* ``--url=https://github.com/ansys/{repo-name}``, replacing ``repo-name`` with the name of the repository

The ``--author_maint_name`` is the name of the author and maintainer in the ``pyproject.toml`` file.
By default, it is "Ansys, Inc.".

The ``--author_maint_email`` is the email of the author and maintainer in the ``pyproject.toml`` file.
By default, it is "pyansys.core@ansys.com".

The ``--license`` argument is the license that is being used by your repository. By default, it is
MIT.

The ``--url`` argument is automatically rendered based on the repository name. If your repository
is not in the Ansys organization, please add this argument to your configuration in
.pre-commit-config.yaml.

The ``--product`` argument is required if a ``README.rst`` or ``README.md`` file does not
exist in your repository and you want the template to render correctly. The product
for ``PyMechanical`` would be ``mechanical``, for example.

The ``--non_compliant_name`` flag can be used if your repository does not follow the typical
naming convention of ``ansys-*-*``.

Technical review hook in ``ansys/pre-commit-hooks``' .pre-commit-config.yaml file:

.. code:: yaml

  - repo: https://github.com/ansys/pre-commit-hooks
    rev: v0.5.1
    hooks:
    - id: tech-review
      args:
      - --product=pre_commit_hooks
      - --non_compliant_name

Technical review hook in ``PyMechanical``'s .pre-commit-config.yaml file:

.. code:: yaml

  - repo: https://github.com/ansys/pre-commit-hooks
    rev: v0.5.1
    hooks:
    - id: tech-review
      args:
      - --product=mechanical


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:

.. code:: bash

    python -m pip install -U pip

Then, to install the package, run this command:

.. code:: bash

    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:

   .. code:: bash

      git clone https://github.com/ansys/pre-commit-hooks

#. Create a fresh-clean Python environment and activate it with these commands:

   .. code:: bash

      # 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.ps1

#. Ensure that you have the latest required build system tools by
   running this command:

   .. code:: bash

      python -m pip install -U pip flit tox twine


#. Install the project in editable mode by running one of these commands:

   .. code:: bash

      # 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:

   .. code:: bash

      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 always call style commands, such as `black`_, `isort`_,
and `flake8`_, 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:

.. code:: bash

    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:

.. code:: bash

    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:

.. code:: bash

    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:

.. code:: bash

    python -m pip install .
    python -m build
    python -m twine check dist/*


.. LINKS AND REFERENCES
.. _black: https://github.com/psf/black
.. _flake8: https://flake8.pycqa.org/en/latest/
.. _isort: https://github.com/PyCQA/isort
.. _pip: https://pypi.org/project/pip/
.. _pre-commit: https://pre-commit.com/
.. _PyAnsys Developer's Guide: https://dev.docs.pyansys.com/
.. _pytest: https://docs.pytest.org/en/stable/
.. _Sphinx: https://www.sphinx-doc.org/en/master/
.. _tox: https://tox.wiki/

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ansys/pre-commit-hooks",
    "name": "ansys-pre-commit-hooks",
    "maintainer": "ANSYS, Inc.",
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": "pyansys.core@ansys.com",
    "keywords": null,
    "author": "ANSYS, Inc.",
    "author_email": "pyansys.core@ansys.com",
    "download_url": "https://files.pythonhosted.org/packages/56/f7/f0e17362dc51e4784e42fbceb62976565afa749f8b16eab4a268fa80a3ac/ansys_pre_commit_hooks-0.5.1.tar.gz",
    "platform": null,
    "description": "Ansys pre-commit hooks\n======================\n|pyansys| |python| |pypi| |GH-CI| |MIT| |black| |pre-commit-ci|\n\n.. |pyansys| image:: https://img.shields.io/badge/Py-Ansys-ffc107.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABDklEQVQ4jWNgoDfg5mD8vE7q/3bpVyskbW0sMRUwofHD7Dh5OBkZGBgW7/3W2tZpa2tLQEOyOzeEsfumlK2tbVpaGj4N6jIs1lpsDAwMJ278sveMY2BgCA0NFRISwqkhyQ1q/Nyd3zg4OBgYGNjZ2ePi4rB5loGBhZnhxTLJ/9ulv26Q4uVk1NXV/f///////69du4Zdg78lx//t0v+3S88rFISInD59GqIH2esIJ8G9O2/XVwhjzpw5EAam1xkkBJn/bJX+v1365hxxuCAfH9+3b9/+////48cPuNehNsS7cDEzMTAwMMzb+Q2u4dOnT2vWrMHu9ZtzxP9vl/69RVpCkBlZ3N7enoDXBwEAAA+YYitOilMVAAAAAElFTkSuQmCC\n   :target: https://docs.pyansys.com/\n   :alt: PyAnsys\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pre-commit-hooks?logo=pypi\n   :target: https://pypi.org/project/ansys-pre-commit-hooks/\n   :alt: Python\n\n.. |pypi| image:: https://img.shields.io/pypi/v/ansys-pre-commit-hooks.svg?logo=python&logoColor=white\n   :target: https://pypi.org/project/ansys-pre-commit-hooks\n   :alt: PyPI\n\n.. |GH-CI| image:: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml/badge.svg\n   :target: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml\n   :alt: GH-CI\n\n.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg\n   :target: https://opensource.org/licenses/MIT\n   :alt: MIT\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat\n   :target: https://github.com/psf/black\n   :alt: Black\n\n.. |pre-commit-ci| image:: https://results.pre-commit.ci/badge/github/ansys/pre-commit-hooks/main.svg\n   :target: https://results.pre-commit.ci/latest/github/ansys/pre-commit-hooks/main\n   :alt: pre-commit.ci status\n\nThis Ansys repository contains `pre-commit`_ hooks for different purposes.\nCurrently, these hooks are available:\n\n* ``add-license-headers``: Add missing license headers to files by using\n  `REUSE <https://reuse.software/>`_ . To use this hook, you must\n  have ``REUSE`` implemented in your repository.\n* ``tech-review``: Do a technical review of your repository according to\n  `Ansys repository requirements <https://dev.docs.pyansys.com/packaging/structure.html>`_\n\n``add-license-headers`` setup\n-----------------------------\n\nAdd required directories\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf you are using the ansys.jinja2 template and MIT.txt license, skip this step. By default, the hook will make symbolic links\nfrom its \"assets\" directory containing LICENSES/MIT.txt and .reuse/templates/ansys.jinja2\nto your repository when the hook runs. The .reuse and LICENSES directories will be deleted once the hook is\ndone running.\n\nIf you are using a custom template, create a directory named ``.reuse``, and if you are using a custom license, create a directory\nnamed ``LICENSES`` in the root of your repository. The custom template cannot be named ``ansys.jinja2``, otherwise it will be removed\nafter the hook is done running. The custom license cannot be named ``MIT.txt`` for the same reason. The ``.reuse`` and/or ``LICENSES``\ndirectories will have to be committed to your repository and will not be removed once the hook is done running as long as there\nare custom templates or licenses in those directories. Your project should have the following layout:\n\n ::\n\n   project\n   \u251c\u2500\u2500 LICENCES\n   \u2502   \u2514\u2500\u2500 license_name.txt\n   \u251c\u2500\u2500 .reuse\n   \u2502   \u2514\u2500\u2500 templates\n   \u2502       \u2514\u2500\u2500 template_name.jinja2\n   \u251c\u2500\u2500 src\n   \u251c\u2500\u2500 examples\n   \u251c\u2500\u2500 tests\n   \u251c\u2500\u2500 .pre-commit-config.yaml\n   \u251c\u2500\u2500 pyproject.toml\n\nWhere ``license_name`` is the name of the license that is being used, for example, MIT.txt, and\n``template_name`` is the name of the custom template being used. The jinja2 file contains the\ntemplate for the license headers that are added to the files.\n\nLicenses that are supported by ``REUSE`` can be found in the\n`spdx/license-list-data <https://github.com/spdx/license-list-data/tree/main/text>`_ repository.\nPlease select a license text file from that repository, and copy it to the LICENSES directory.\n\nSet custom arguments\n^^^^^^^^^^^^^^^^^^^^\n\n.. code:: yaml\n\n   - repo: https://github.com/ansys/pre-commit-hooks\n     rev: v0.5.1\n     hooks:\n     - id: add-license-headers\n       args: [\"--custom_copyright\", \"custom copyright phrase\", \"--custom_template\", \"template_name\", \"--custom_license\", \"license_name\", \"--ignore_license_check\", \"--start_year\", \"2023\"]\n\n``args`` can also be formatted as follows:\n\n.. code:: yaml\n\n   args:\n   - --custom_copyright=custom copyright phrase\n   - --custom_template=template_name\n   - --custom_license=license_name\n   - --ignore_license_check\n   - --start_year=2023\n\n* ``custom copyright phrase`` is the copyright line you want to include in the license\n  header. By default, it uses ``\"ANSYS, Inc. and/or its affiliates.\"``.\n* ``template_name`` is the name of the .jinja2 file located in ``.reuse/templates/``.\n  By default, it uses ``ansys``.\n* ``license_name`` is the name of the license being used. For example, MIT, ECL-1.0, etc.\n  To view a list of licenses that are supported by ``REUSE``, see\n  https://github.com/spdx/license-list-data/tree/main/text. By default it uses ``MIT``.\n* ``ignore_license_check`` is whether or not to check for the license in the header. By default,\n  it is ``False``, meaning the files are checked for both the copyright and licensing information\n  in the header. Add ``--ignore_license_check`` to ignore checking for licensing information\n  in the files.\n* ``start_year`` is the start year of the copyright statement. By default, the ``start_year`` is\n  the current year, making the copyright statement\n  \"Copyright (C) 2024 ANSYS, Inc. and/or its affiliates.\" If you are adding license headers\n  to packages released before the current year, add the ``start_year`` argument with the year your\n  package was released. For example, if ``start_year`` is 2023, the copyright statement would be\n  \"Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.\" assuming the current year is 2024.\n\nSpecify directories to run the hook on\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nBy default, the hook will run on proto files in any directory, as well as python files within\ndirectories named ``src``, ``examples``, and ``tests``. To specify additional files and/or directories\nthe hook should run on, add the necessary regex to the ``files`` line in your\n.pre-commit-config.yaml file:\n\n.. code:: yaml\n\n   - repo: https://github.com/ansys/pre-commit-hooks\n     rev: v0.5.1\n     hooks:\n     - id: add-license-headers\n       files: '(src|examples|tests|newFolder)/.*\\.(py|newExtension)|\\.(proto|newExtension)'\n\nIgnore specific files or file types\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIn .pre-commit-config.yaml:\n\n.. code:: yaml\n\n  - repo: https://github.com/ansys/pre-commit-hooks\n    rev: v0.5.1\n    hooks:\n    - id: add-license-headers\n      exclude: |\n          (?x)^(\n              path/to/file1.py |\n              path/to/.*\\.(ts|cpp) |\n              (.folder1|folder2)/.* |\n              .*\\.js |\n              \\..* |\n          )$\n\n* ``path/to/file1.py`` excludes the stated file.\n* ``path/to/.*\\.(ts|cpp)`` excludes all .ts and .cpp files within the ``path/to`` directory.\n* ``(.folder1|folder2)/.*`` excludes directories named .folder1 and folder2.\n* ``.*\\.js`` excludes all .js files in all directories.\n* ``\\..*`` excludes all hidden files.\n\n``tech-review`` setup\n---------------------\n\nThese are the default values for the arguments of the tech-review hook:\n\n* ``--author_maint_name=ANSYS, Inc.``\n* ``--author_maint_email=pyansys.core@ansys.com``\n* ``--license=MIT``\n* ``--url=https://github.com/ansys/{repo-name}``, replacing ``repo-name`` with the name of the repository\n\nThe ``--author_maint_name`` is the name of the author and maintainer in the ``pyproject.toml`` file.\nBy default, it is \"Ansys, Inc.\".\n\nThe ``--author_maint_email`` is the email of the author and maintainer in the ``pyproject.toml`` file.\nBy default, it is \"pyansys.core@ansys.com\".\n\nThe ``--license`` argument is the license that is being used by your repository. By default, it is\nMIT.\n\nThe ``--url`` argument is automatically rendered based on the repository name. If your repository\nis not in the Ansys organization, please add this argument to your configuration in\n.pre-commit-config.yaml.\n\nThe ``--product`` argument is required if a ``README.rst`` or ``README.md`` file does not\nexist in your repository and you want the template to render correctly. The product\nfor ``PyMechanical`` would be ``mechanical``, for example.\n\nThe ``--non_compliant_name`` flag can be used if your repository does not follow the typical\nnaming convention of ``ansys-*-*``.\n\nTechnical review hook in ``ansys/pre-commit-hooks``' .pre-commit-config.yaml file:\n\n.. code:: yaml\n\n  - repo: https://github.com/ansys/pre-commit-hooks\n    rev: v0.5.1\n    hooks:\n    - id: tech-review\n      args:\n      - --product=pre_commit_hooks\n      - --non_compliant_name\n\nTechnical review hook in ``PyMechanical``'s .pre-commit-config.yaml file:\n\n.. code:: yaml\n\n  - repo: https://github.com/ansys/pre-commit-hooks\n    rev: v0.5.1\n    hooks:\n    - id: tech-review\n      args:\n      - --product=mechanical\n\n\nHow to install\n--------------\n\nThe following sections provide instructions for installing the ``ansys-pre-commit-hooks``\npackage in two installation modes: user and developer.\n\nFor users\n^^^^^^^^^\n\nBefore installing the package, to ensure that you\nhave the latest version of `pip`_, run this command:\n\n.. code:: bash\n\n    python -m pip install -U pip\n\nThen, to install the package, run this command:\n\n.. code:: bash\n\n    python -m pip install ansys-pre-commit-hooks\n\nFor developers\n^^^^^^^^^^^^^^\n\nInstalling the package in developer mode allows you to modify and\nenhance the source code.\n\nBefore contributing to the project, ensure that you are familiar with\nthe `PyAnsys Developer's Guide`_.\n\nFor a developer installation, you must follow these steps:\n\n#. Clone the repository with this command:\n\n   .. code:: bash\n\n      git clone https://github.com/ansys/pre-commit-hooks\n\n#. Create a fresh-clean Python environment and activate it with these commands:\n\n   .. code:: bash\n\n      # Create a virtual environment\n      python -m venv .venv\n\n      # Activate it in a POSIX system\n      source .venv/bin/activate\n\n      # Activate it in Windows CMD environment\n      .venv\\Scripts\\activate.bat\n\n      # Activate it in Windows Powershell\n      .venv\\Scripts\\Activate.ps1\n\n#. Ensure that you have the latest required build system tools by\n   running this command:\n\n   .. code:: bash\n\n      python -m pip install -U pip flit tox twine\n\n\n#. Install the project in editable mode by running one of these commands:\n\n   .. code:: bash\n\n      # Install the minimum requirements\n      python -m pip install -e .\n\n      # Install the minimum + tests requirements\n      python -m pip install -e .[tests]\n\n      # Install the minimum + doc requirements\n      python -m pip install -e .[doc]\n\n      # Install all requirements\n      python -m pip install -e .[tests,doc]\n\n#. Verify your development installation by running this command:\n\n   .. code:: bash\n\n      tox\n\n\nHow to test it\n--------------\n\nThis project takes advantage of `tox`_. This tool automates common\ndevelopment tasks (similar to Makefile), but it is oriented towards\nPython development.\n\nUsing ``tox``\n^^^^^^^^^^^^^\n\nWhile Makefile has rules, ``tox`` has environments. In fact, ``tox`` creates its\nown virtual environment so that anything being tested is isolated from the project\nto guarantee the project's integrity.\n\nThese environment commands are provided:\n\n- **tox -e style**: Checks for coding style quality.\n- **tox -e py**: Checks for unit tests.\n- **tox -e py-coverage**: Checks for unit testing and code coverage.\n- **tox -e doc**: Checks for successfully building the documentation.\n\n\nRaw testing\n^^^^^^^^^^^\n\nIf required, you can always call style commands, such as `black`_, `isort`_,\nand `flake8`_, or unit testing commands, such as `pytest`_, from the command line.\nHowever, calling these commands does not guarantee that your project is\nbeing tested in an isolated environment, which is the reason why tools like\n``tox`` exist.\n\n\nA note on ``pre-commit``\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe style checks take advantage of `pre-commit`_. Developers are not forced but\nencouraged to install this tool by running this command:\n\n.. code:: bash\n\n    python -m pip install pre-commit && pre-commit install\n\n\nDocumentation\n-------------\n\nFor building documentation, you can run the usual rules provided in the\n`Sphinx`_ Makefile with a command that is formatted like this:\n\n.. code:: bash\n\n    make -C doc/ html && your_browser_name doc/html/index.html\n\nHowever, the recommended way of checking documentation integrity is by\nrunning ``tox`` with a command that is formatted like this:\n\n.. code:: bash\n\n    tox -e doc && your_browser_name .tox/doc_out/index.html\n\n\nDistributing\n------------\n\nIf you would like to create either source or wheel files, install\nthe building requirements and then execute the build module with these commands:\n\n.. code:: bash\n\n    python -m pip install .\n    python -m build\n    python -m twine check dist/*\n\n\n.. LINKS AND REFERENCES\n.. _black: https://github.com/psf/black\n.. _flake8: https://flake8.pycqa.org/en/latest/\n.. _isort: https://github.com/PyCQA/isort\n.. _pip: https://pypi.org/project/pip/\n.. _pre-commit: https://pre-commit.com/\n.. _PyAnsys Developer's Guide: https://dev.docs.pyansys.com/\n.. _pytest: https://docs.pytest.org/en/stable/\n.. _Sphinx: https://www.sphinx-doc.org/en/master/\n.. _tox: https://tox.wiki/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python wrapper to create Ansys-tailored pre-commit hooks",
    "version": "0.5.1",
    "project_urls": {
        "Documentation": "https://pre-commit-hooks.docs.pyansys.com",
        "Homepage": "https://github.com/ansys/pre-commit-hooks",
        "Source": "https://github.com/ansys/pre-commit-hooks/",
        "Tracker": "https://github.com/ansys/pre-commit-hooks/issues"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6dea4fad3b58ac642799ef6190b1112fa4ba5fecfef4768256cc7614931843ae",
                "md5": "fc5c2b6cef978ece79311dc30ef8f91f",
                "sha256": "d5251f0120b2fed8f033714c8e04d6095bb1b59072edf5e43eb78f3e5ad14b5f"
            },
            "downloads": -1,
            "filename": "ansys_pre_commit_hooks-0.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc5c2b6cef978ece79311dc30ef8f91f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 48576,
            "upload_time": "2025-01-17T13:40:44",
            "upload_time_iso_8601": "2025-01-17T13:40:44.464267Z",
            "url": "https://files.pythonhosted.org/packages/6d/ea/4fad3b58ac642799ef6190b1112fa4ba5fecfef4768256cc7614931843ae/ansys_pre_commit_hooks-0.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "56f7f0e17362dc51e4784e42fbceb62976565afa749f8b16eab4a268fa80a3ac",
                "md5": "e4af3d8d0b7806089e94248c7669ba01",
                "sha256": "27b44d92a769d6c1ebd54703613bbc54501caeee7677a0fe578c76bd86651133"
            },
            "downloads": -1,
            "filename": "ansys_pre_commit_hooks-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e4af3d8d0b7806089e94248c7669ba01",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 55139,
            "upload_time": "2025-01-17T13:40:47",
            "upload_time_iso_8601": "2025-01-17T13:40:47.646452Z",
            "url": "https://files.pythonhosted.org/packages/56/f7/f0e17362dc51e4784e42fbceb62976565afa749f8b16eab4a268fa80a3ac/ansys_pre_commit_hooks-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 13:40:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ansys",
    "github_project": "pre-commit-hooks",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "ansys-pre-commit-hooks"
}
        
Elapsed time: 2.44754s