ansys-pre-commit-hooks 0.5.1__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/LICENSE +1 -1
- ansys_pre_commit_hooks-0.6.0/PKG-INFO +260 -0
- ansys_pre_commit_hooks-0.6.0/README.rst +211 -0
- ansys_pre_commit_hooks-0.6.0/pyproject.toml +144 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/setup.py +19 -49
- ansys_pre_commit_hooks-0.6.0/src/ansys/pre_commit_hooks/VERSION +1 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/__init__.py +1 -1
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/add_license_headers.py +85 -74
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/assets/licenses.json +68 -1
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/tech_review.py +15 -8
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/dependabot.yml +4 -0
- ansys_pre_commit_hooks-0.6.0/src/ansys_pre_commit_hooks.egg-info/PKG-INFO +260 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys_pre_commit_hooks.egg-info/SOURCES.txt +0 -3
- ansys_pre_commit_hooks-0.6.0/src/ansys_pre_commit_hooks.egg-info/requires.txt +18 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/tests/test_add_license_headers.py +105 -113
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/tests/test_metadata.py +1 -1
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/tests/test_tech_review.py +1 -1
- ansys_pre_commit_hooks-0.5.1/AUTHORS +0 -12
- ansys_pre_commit_hooks-0.5.1/PKG-INFO +0 -442
- ansys_pre_commit_hooks-0.5.1/README.rst +0 -386
- ansys_pre_commit_hooks-0.5.1/pyproject.toml +0 -90
- ansys_pre_commit_hooks-0.5.1/src/ansys/pre_commit_hooks/VERSION +0 -1
- ansys_pre_commit_hooks-0.5.1/src/ansys/pre_commit_hooks/__pycache__/__init__.cpython-310.pyc +0 -0
- ansys_pre_commit_hooks-0.5.1/src/ansys/pre_commit_hooks/__pycache__/tech_review.cpython-310.pyc +0 -0
- ansys_pre_commit_hooks-0.5.1/src/ansys_pre_commit_hooks.egg-info/PKG-INFO +0 -442
- ansys_pre_commit_hooks-0.5.1/src/ansys_pre_commit_hooks.egg-info/requires.txt +0 -18
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/MANIFEST.in +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/setup.cfg +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/assets/.reuse/templates/ansys.jinja2 +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/assets/LICENSES/MIT.txt +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/AUTHORS +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/CODE_OF_CONDUCT.md +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/CONTRIBUTING.md +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/CONTRIBUTORS.md +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/LICENSE +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/README.md +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys/pre_commit_hooks/templates/README.rst +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys_pre_commit_hooks.egg-info/dependency_links.txt +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys_pre_commit_hooks.egg-info/entry_points.txt +0 -0
- {ansys_pre_commit_hooks-0.5.1 → ansys_pre_commit_hooks-0.6.0}/src/ansys_pre_commit_hooks.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2023 -
|
|
3
|
+
Copyright (c) 2023 - 2026 ANSYS, Inc. and/or its affiliates.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ansys-pre-commit-hooks
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Home-page: https://github.com/ansys/pre-commit-hooks
|
|
5
|
+
Author: ANSYS, Inc.
|
|
6
|
+
Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
|
|
7
|
+
Maintainer: ANSYS, Inc.
|
|
8
|
+
Maintainer-email: "ANSYS, Inc." <pyansys.core@ansys.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Project-URL: Source, https://github.com/ansys/pre-commit-hooks/
|
|
11
|
+
Project-URL: Issues, https://github.com/ansys/pre-commit-hooks/issues
|
|
12
|
+
Project-URL: Discussions, https://github.com/ansys/pre-commit-hooks/discussions
|
|
13
|
+
Project-URL: Documentation, https://pre-commit-hooks.docs.pyansys.com
|
|
14
|
+
Project-URL: Releases, https://github.com/ansys/pre-commit-hooks/releases
|
|
15
|
+
Project-URL: Changelog, https://github.com/ansys/pre-commit-hooks/blob/main/doc/source/changelog.rst
|
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Requires-Python: >=3.10,<4
|
|
25
|
+
Description-Content-Type: text/x-rst
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: GitPython==3.1.46
|
|
28
|
+
Requires-Dist: importlib-metadata==8.7.1
|
|
29
|
+
Requires-Dist: Jinja2==3.1.6
|
|
30
|
+
Requires-Dist: reuse==6.2.0
|
|
31
|
+
Requires-Dist: requests==2.32.5
|
|
32
|
+
Requires-Dist: semver==3.0.4
|
|
33
|
+
Requires-Dist: toml==0.10.2
|
|
34
|
+
Provides-Extra: doc
|
|
35
|
+
Requires-Dist: ansys-sphinx-theme[autoapi]==1.7.2; extra == "doc"
|
|
36
|
+
Requires-Dist: numpydoc==1.10.0; extra == "doc"
|
|
37
|
+
Requires-Dist: sphinx==8.2.3; extra == "doc"
|
|
38
|
+
Requires-Dist: sphinx-autodoc-typehints==3.1.0; extra == "doc"
|
|
39
|
+
Requires-Dist: sphinx-copybutton==0.5.1; extra == "doc"
|
|
40
|
+
Provides-Extra: tests
|
|
41
|
+
Requires-Dist: pytest==9.0.2; extra == "tests"
|
|
42
|
+
Requires-Dist: pytest-cov==7.0.0; extra == "tests"
|
|
43
|
+
Dynamic: author
|
|
44
|
+
Dynamic: classifier
|
|
45
|
+
Dynamic: home-page
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
Dynamic: maintainer
|
|
48
|
+
Dynamic: requires-python
|
|
49
|
+
|
|
50
|
+
Ansys pre-commit hooks
|
|
51
|
+
======================
|
|
52
|
+
|pyansys| |python| |pypi| |GH-CI| |MIT| |black| |pre-commit-ci|
|
|
53
|
+
|
|
54
|
+
.. |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
|
|
55
|
+
:target: https://docs.pyansys.com/
|
|
56
|
+
:alt: PyAnsys
|
|
57
|
+
|
|
58
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pre-commit-hooks?logo=pypi
|
|
59
|
+
:target: https://pypi.org/project/ansys-pre-commit-hooks/
|
|
60
|
+
:alt: Python
|
|
61
|
+
|
|
62
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/ansys-pre-commit-hooks.svg?logo=python&logoColor=white
|
|
63
|
+
:target: https://pypi.org/project/ansys-pre-commit-hooks
|
|
64
|
+
:alt: PyPI
|
|
65
|
+
|
|
66
|
+
.. |GH-CI| image:: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml/badge.svg
|
|
67
|
+
:target: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml
|
|
68
|
+
:alt: GH-CI
|
|
69
|
+
|
|
70
|
+
.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
71
|
+
:target: https://opensource.org/licenses/MIT
|
|
72
|
+
:alt: MIT
|
|
73
|
+
|
|
74
|
+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
|
|
75
|
+
:target: https://github.com/psf/black
|
|
76
|
+
:alt: Black
|
|
77
|
+
|
|
78
|
+
.. |pre-commit-ci| image:: https://results.pre-commit.ci/badge/github/ansys/pre-commit-hooks/main.svg
|
|
79
|
+
:target: https://results.pre-commit.ci/latest/github/ansys/pre-commit-hooks/main
|
|
80
|
+
:alt: pre-commit.ci status
|
|
81
|
+
|
|
82
|
+
This Ansys repository contains `pre-commit`_ hooks for different purposes.
|
|
83
|
+
The following hooks are currently available:
|
|
84
|
+
|
|
85
|
+
* ``add-license-headers``: Add missing license headers to files by using
|
|
86
|
+
`REUSE <https://reuse.software/>`_ . To use this hook, you must
|
|
87
|
+
have ``REUSE`` implemented in your repository.
|
|
88
|
+
* ``tech-review``: Do a technical review of your repository according to
|
|
89
|
+
`Ansys repository requirements <https://dev.docs.pyansys.com/packaging/structure.html>`_
|
|
90
|
+
|
|
91
|
+
How to install
|
|
92
|
+
--------------
|
|
93
|
+
|
|
94
|
+
The following sections provide instructions for installing the ``ansys-pre-commit-hooks``
|
|
95
|
+
package in two installation modes: user and developer.
|
|
96
|
+
|
|
97
|
+
For users
|
|
98
|
+
^^^^^^^^^
|
|
99
|
+
|
|
100
|
+
Before installing the package, to ensure that you
|
|
101
|
+
have the latest version of `pip`_, run this command:
|
|
102
|
+
|
|
103
|
+
.. code:: bash
|
|
104
|
+
|
|
105
|
+
python -m pip install -U pip
|
|
106
|
+
|
|
107
|
+
Then, to install the package, run this command:
|
|
108
|
+
|
|
109
|
+
.. code:: bash
|
|
110
|
+
|
|
111
|
+
python -m pip install ansys-pre-commit-hooks
|
|
112
|
+
|
|
113
|
+
For developers
|
|
114
|
+
^^^^^^^^^^^^^^
|
|
115
|
+
|
|
116
|
+
Installing the package in developer mode allows you to modify and
|
|
117
|
+
enhance the source code.
|
|
118
|
+
|
|
119
|
+
Before contributing to the project, ensure that you are familiar with
|
|
120
|
+
the `PyAnsys Developer's Guide`_.
|
|
121
|
+
|
|
122
|
+
For a developer installation, you must follow these steps:
|
|
123
|
+
|
|
124
|
+
#. Clone the repository with this command:
|
|
125
|
+
|
|
126
|
+
.. code:: bash
|
|
127
|
+
|
|
128
|
+
git clone https://github.com/ansys/pre-commit-hooks
|
|
129
|
+
|
|
130
|
+
#. Create a fresh-clean Python environment and activate it with these commands:
|
|
131
|
+
|
|
132
|
+
.. code:: bash
|
|
133
|
+
|
|
134
|
+
# Create a virtual environment
|
|
135
|
+
python -m venv .venv
|
|
136
|
+
|
|
137
|
+
# Activate it in a POSIX system
|
|
138
|
+
source .venv/bin/activate
|
|
139
|
+
|
|
140
|
+
# Activate it in Windows CMD environment
|
|
141
|
+
.venv\Scripts\activate.bat
|
|
142
|
+
|
|
143
|
+
# Activate it in Windows Powershell
|
|
144
|
+
.venv\Scripts\Activate.ps1
|
|
145
|
+
|
|
146
|
+
#. Ensure that you have the latest required build system tools by
|
|
147
|
+
running this command:
|
|
148
|
+
|
|
149
|
+
.. code:: bash
|
|
150
|
+
|
|
151
|
+
python -m pip install -U pip flit tox twine
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
#. Install the project in editable mode by running one of these commands:
|
|
155
|
+
|
|
156
|
+
.. code:: bash
|
|
157
|
+
|
|
158
|
+
# Install the minimum requirements
|
|
159
|
+
python -m pip install -e .
|
|
160
|
+
|
|
161
|
+
# Install the minimum + tests requirements
|
|
162
|
+
python -m pip install -e .[tests]
|
|
163
|
+
|
|
164
|
+
# Install the minimum + doc requirements
|
|
165
|
+
python -m pip install -e .[doc]
|
|
166
|
+
|
|
167
|
+
# Install all requirements
|
|
168
|
+
python -m pip install -e .[tests,doc]
|
|
169
|
+
|
|
170
|
+
#. Verify your development installation by running this command:
|
|
171
|
+
|
|
172
|
+
.. code:: bash
|
|
173
|
+
|
|
174
|
+
tox
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
How to test it
|
|
178
|
+
--------------
|
|
179
|
+
|
|
180
|
+
This project takes advantage of `tox`_. This tool automates common
|
|
181
|
+
development tasks (similar to Makefile), but it is oriented towards
|
|
182
|
+
Python development.
|
|
183
|
+
|
|
184
|
+
Using ``tox``
|
|
185
|
+
^^^^^^^^^^^^^
|
|
186
|
+
|
|
187
|
+
While Makefile has rules, ``tox`` has environments. In fact, ``tox`` creates its
|
|
188
|
+
own virtual environment so that anything being tested is isolated from the project
|
|
189
|
+
to guarantee the project's integrity.
|
|
190
|
+
|
|
191
|
+
These environment commands are provided:
|
|
192
|
+
|
|
193
|
+
- **tox -e style**: Checks for coding style quality.
|
|
194
|
+
- **tox -e py**: Checks for unit tests.
|
|
195
|
+
- **tox -e py-coverage**: Checks for unit testing and code coverage.
|
|
196
|
+
- **tox -e doc**: Checks for successfully building the documentation.
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
Raw testing
|
|
200
|
+
^^^^^^^^^^^
|
|
201
|
+
|
|
202
|
+
If required, you can always call style commands, such as `black`_, `isort`_,
|
|
203
|
+
and `flake8`_, or unit testing commands, such as `pytest`_, from the command line.
|
|
204
|
+
However, calling these commands does not guarantee that your project is
|
|
205
|
+
being tested in an isolated environment, which is the reason why tools like
|
|
206
|
+
``tox`` exist.
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
A note on ``pre-commit``
|
|
210
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
211
|
+
|
|
212
|
+
The style checks take advantage of `pre-commit`_. Developers are not forced but
|
|
213
|
+
encouraged to install this tool by running this command:
|
|
214
|
+
|
|
215
|
+
.. code:: bash
|
|
216
|
+
|
|
217
|
+
python -m pip install pre-commit && pre-commit install
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
Documentation
|
|
221
|
+
-------------
|
|
222
|
+
|
|
223
|
+
For building documentation, you can run the usual rules provided in the
|
|
224
|
+
`Sphinx`_ Makefile with a command that is formatted like this:
|
|
225
|
+
|
|
226
|
+
.. code:: bash
|
|
227
|
+
|
|
228
|
+
make -C doc/ html && your_browser_name doc/html/index.html
|
|
229
|
+
|
|
230
|
+
However, the recommended way of checking documentation integrity is by
|
|
231
|
+
running ``tox`` with a command that is formatted like this:
|
|
232
|
+
|
|
233
|
+
.. code:: bash
|
|
234
|
+
|
|
235
|
+
tox -e doc && your_browser_name .tox/doc_out/index.html
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
Distributing
|
|
239
|
+
------------
|
|
240
|
+
|
|
241
|
+
If you would like to create either source or wheel files, install
|
|
242
|
+
the building requirements and then execute the build module with these commands:
|
|
243
|
+
|
|
244
|
+
.. code:: bash
|
|
245
|
+
|
|
246
|
+
python -m pip install .
|
|
247
|
+
python -m build
|
|
248
|
+
python -m twine check dist/*
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
.. LINKS AND REFERENCES
|
|
252
|
+
.. _black: https://github.com/psf/black
|
|
253
|
+
.. _flake8: https://flake8.pycqa.org/en/latest/
|
|
254
|
+
.. _isort: https://github.com/PyCQA/isort
|
|
255
|
+
.. _pip: https://pypi.org/project/pip/
|
|
256
|
+
.. _pre-commit: https://pre-commit.com/
|
|
257
|
+
.. _PyAnsys Developer's Guide: https://dev.docs.pyansys.com/
|
|
258
|
+
.. _pytest: https://docs.pytest.org/en/stable/
|
|
259
|
+
.. _Sphinx: https://www.sphinx-doc.org/en/master/
|
|
260
|
+
.. _tox: https://tox.wiki/
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Ansys pre-commit hooks
|
|
2
|
+
======================
|
|
3
|
+
|pyansys| |python| |pypi| |GH-CI| |MIT| |black| |pre-commit-ci|
|
|
4
|
+
|
|
5
|
+
.. |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
|
|
6
|
+
:target: https://docs.pyansys.com/
|
|
7
|
+
:alt: PyAnsys
|
|
8
|
+
|
|
9
|
+
.. |python| image:: https://img.shields.io/pypi/pyversions/ansys-pre-commit-hooks?logo=pypi
|
|
10
|
+
:target: https://pypi.org/project/ansys-pre-commit-hooks/
|
|
11
|
+
:alt: Python
|
|
12
|
+
|
|
13
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/ansys-pre-commit-hooks.svg?logo=python&logoColor=white
|
|
14
|
+
:target: https://pypi.org/project/ansys-pre-commit-hooks
|
|
15
|
+
:alt: PyPI
|
|
16
|
+
|
|
17
|
+
.. |GH-CI| image:: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml/badge.svg
|
|
18
|
+
:target: https://github.com/ansys/pre-commit-hooks/actions/workflows/ci_cd.yml
|
|
19
|
+
:alt: GH-CI
|
|
20
|
+
|
|
21
|
+
.. |MIT| image:: https://img.shields.io/badge/License-MIT-yellow.svg
|
|
22
|
+
:target: https://opensource.org/licenses/MIT
|
|
23
|
+
:alt: MIT
|
|
24
|
+
|
|
25
|
+
.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg?style=flat
|
|
26
|
+
:target: https://github.com/psf/black
|
|
27
|
+
:alt: Black
|
|
28
|
+
|
|
29
|
+
.. |pre-commit-ci| image:: https://results.pre-commit.ci/badge/github/ansys/pre-commit-hooks/main.svg
|
|
30
|
+
:target: https://results.pre-commit.ci/latest/github/ansys/pre-commit-hooks/main
|
|
31
|
+
:alt: pre-commit.ci status
|
|
32
|
+
|
|
33
|
+
This Ansys repository contains `pre-commit`_ hooks for different purposes.
|
|
34
|
+
The following hooks are currently available:
|
|
35
|
+
|
|
36
|
+
* ``add-license-headers``: Add missing license headers to files by using
|
|
37
|
+
`REUSE <https://reuse.software/>`_ . To use this hook, you must
|
|
38
|
+
have ``REUSE`` implemented in your repository.
|
|
39
|
+
* ``tech-review``: Do a technical review of your repository according to
|
|
40
|
+
`Ansys repository requirements <https://dev.docs.pyansys.com/packaging/structure.html>`_
|
|
41
|
+
|
|
42
|
+
How to install
|
|
43
|
+
--------------
|
|
44
|
+
|
|
45
|
+
The following sections provide instructions for installing the ``ansys-pre-commit-hooks``
|
|
46
|
+
package in two installation modes: user and developer.
|
|
47
|
+
|
|
48
|
+
For users
|
|
49
|
+
^^^^^^^^^
|
|
50
|
+
|
|
51
|
+
Before installing the package, to ensure that you
|
|
52
|
+
have the latest version of `pip`_, run this command:
|
|
53
|
+
|
|
54
|
+
.. code:: bash
|
|
55
|
+
|
|
56
|
+
python -m pip install -U pip
|
|
57
|
+
|
|
58
|
+
Then, to install the package, run this command:
|
|
59
|
+
|
|
60
|
+
.. code:: bash
|
|
61
|
+
|
|
62
|
+
python -m pip install ansys-pre-commit-hooks
|
|
63
|
+
|
|
64
|
+
For developers
|
|
65
|
+
^^^^^^^^^^^^^^
|
|
66
|
+
|
|
67
|
+
Installing the package in developer mode allows you to modify and
|
|
68
|
+
enhance the source code.
|
|
69
|
+
|
|
70
|
+
Before contributing to the project, ensure that you are familiar with
|
|
71
|
+
the `PyAnsys Developer's Guide`_.
|
|
72
|
+
|
|
73
|
+
For a developer installation, you must follow these steps:
|
|
74
|
+
|
|
75
|
+
#. Clone the repository with this command:
|
|
76
|
+
|
|
77
|
+
.. code:: bash
|
|
78
|
+
|
|
79
|
+
git clone https://github.com/ansys/pre-commit-hooks
|
|
80
|
+
|
|
81
|
+
#. Create a fresh-clean Python environment and activate it with these commands:
|
|
82
|
+
|
|
83
|
+
.. code:: bash
|
|
84
|
+
|
|
85
|
+
# Create a virtual environment
|
|
86
|
+
python -m venv .venv
|
|
87
|
+
|
|
88
|
+
# Activate it in a POSIX system
|
|
89
|
+
source .venv/bin/activate
|
|
90
|
+
|
|
91
|
+
# Activate it in Windows CMD environment
|
|
92
|
+
.venv\Scripts\activate.bat
|
|
93
|
+
|
|
94
|
+
# Activate it in Windows Powershell
|
|
95
|
+
.venv\Scripts\Activate.ps1
|
|
96
|
+
|
|
97
|
+
#. Ensure that you have the latest required build system tools by
|
|
98
|
+
running this command:
|
|
99
|
+
|
|
100
|
+
.. code:: bash
|
|
101
|
+
|
|
102
|
+
python -m pip install -U pip flit tox twine
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
#. Install the project in editable mode by running one of these commands:
|
|
106
|
+
|
|
107
|
+
.. code:: bash
|
|
108
|
+
|
|
109
|
+
# Install the minimum requirements
|
|
110
|
+
python -m pip install -e .
|
|
111
|
+
|
|
112
|
+
# Install the minimum + tests requirements
|
|
113
|
+
python -m pip install -e .[tests]
|
|
114
|
+
|
|
115
|
+
# Install the minimum + doc requirements
|
|
116
|
+
python -m pip install -e .[doc]
|
|
117
|
+
|
|
118
|
+
# Install all requirements
|
|
119
|
+
python -m pip install -e .[tests,doc]
|
|
120
|
+
|
|
121
|
+
#. Verify your development installation by running this command:
|
|
122
|
+
|
|
123
|
+
.. code:: bash
|
|
124
|
+
|
|
125
|
+
tox
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
How to test it
|
|
129
|
+
--------------
|
|
130
|
+
|
|
131
|
+
This project takes advantage of `tox`_. This tool automates common
|
|
132
|
+
development tasks (similar to Makefile), but it is oriented towards
|
|
133
|
+
Python development.
|
|
134
|
+
|
|
135
|
+
Using ``tox``
|
|
136
|
+
^^^^^^^^^^^^^
|
|
137
|
+
|
|
138
|
+
While Makefile has rules, ``tox`` has environments. In fact, ``tox`` creates its
|
|
139
|
+
own virtual environment so that anything being tested is isolated from the project
|
|
140
|
+
to guarantee the project's integrity.
|
|
141
|
+
|
|
142
|
+
These environment commands are provided:
|
|
143
|
+
|
|
144
|
+
- **tox -e style**: Checks for coding style quality.
|
|
145
|
+
- **tox -e py**: Checks for unit tests.
|
|
146
|
+
- **tox -e py-coverage**: Checks for unit testing and code coverage.
|
|
147
|
+
- **tox -e doc**: Checks for successfully building the documentation.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
Raw testing
|
|
151
|
+
^^^^^^^^^^^
|
|
152
|
+
|
|
153
|
+
If required, you can always call style commands, such as `black`_, `isort`_,
|
|
154
|
+
and `flake8`_, or unit testing commands, such as `pytest`_, from the command line.
|
|
155
|
+
However, calling these commands does not guarantee that your project is
|
|
156
|
+
being tested in an isolated environment, which is the reason why tools like
|
|
157
|
+
``tox`` exist.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
A note on ``pre-commit``
|
|
161
|
+
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
162
|
+
|
|
163
|
+
The style checks take advantage of `pre-commit`_. Developers are not forced but
|
|
164
|
+
encouraged to install this tool by running this command:
|
|
165
|
+
|
|
166
|
+
.. code:: bash
|
|
167
|
+
|
|
168
|
+
python -m pip install pre-commit && pre-commit install
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
Documentation
|
|
172
|
+
-------------
|
|
173
|
+
|
|
174
|
+
For building documentation, you can run the usual rules provided in the
|
|
175
|
+
`Sphinx`_ Makefile with a command that is formatted like this:
|
|
176
|
+
|
|
177
|
+
.. code:: bash
|
|
178
|
+
|
|
179
|
+
make -C doc/ html && your_browser_name doc/html/index.html
|
|
180
|
+
|
|
181
|
+
However, the recommended way of checking documentation integrity is by
|
|
182
|
+
running ``tox`` with a command that is formatted like this:
|
|
183
|
+
|
|
184
|
+
.. code:: bash
|
|
185
|
+
|
|
186
|
+
tox -e doc && your_browser_name .tox/doc_out/index.html
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
Distributing
|
|
190
|
+
------------
|
|
191
|
+
|
|
192
|
+
If you would like to create either source or wheel files, install
|
|
193
|
+
the building requirements and then execute the build module with these commands:
|
|
194
|
+
|
|
195
|
+
.. code:: bash
|
|
196
|
+
|
|
197
|
+
python -m pip install .
|
|
198
|
+
python -m build
|
|
199
|
+
python -m twine check dist/*
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
.. LINKS AND REFERENCES
|
|
203
|
+
.. _black: https://github.com/psf/black
|
|
204
|
+
.. _flake8: https://flake8.pycqa.org/en/latest/
|
|
205
|
+
.. _isort: https://github.com/PyCQA/isort
|
|
206
|
+
.. _pip: https://pypi.org/project/pip/
|
|
207
|
+
.. _pre-commit: https://pre-commit.com/
|
|
208
|
+
.. _PyAnsys Developer's Guide: https://dev.docs.pyansys.com/
|
|
209
|
+
.. _pytest: https://docs.pytest.org/en/stable/
|
|
210
|
+
.. _Sphinx: https://www.sphinx-doc.org/en/master/
|
|
211
|
+
.. _tox: https://tox.wiki/
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"setuptools>=42.0",
|
|
4
|
+
"GitPython==3.1.46",
|
|
5
|
+
"Jinja2==3.1.6",
|
|
6
|
+
"reuse==6.2.0",
|
|
7
|
+
"requests==2.32.5",
|
|
8
|
+
"semver==3.0.4",
|
|
9
|
+
"toml==0.10.2",
|
|
10
|
+
"wheel",
|
|
11
|
+
]
|
|
12
|
+
build-backend = "setuptools.build_meta"
|
|
13
|
+
|
|
14
|
+
[project]
|
|
15
|
+
name = "ansys-pre-commit-hooks"
|
|
16
|
+
dynamic = ["version", "classifiers", "description", "readme", "scripts"]
|
|
17
|
+
requires-python = ">=3.10,<4"
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = ["LICENSE"]
|
|
20
|
+
authors = [{ name = "ANSYS, Inc.", email = "pyansys.core@ansys.com" }]
|
|
21
|
+
maintainers = [{ name = "ANSYS, Inc.", email = "pyansys.core@ansys.com" }]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"GitPython==3.1.46",
|
|
24
|
+
"importlib-metadata==8.7.1",
|
|
25
|
+
"Jinja2==3.1.6",
|
|
26
|
+
"reuse==6.2.0",
|
|
27
|
+
"requests==2.32.5",
|
|
28
|
+
"semver==3.0.4",
|
|
29
|
+
"toml==0.10.2",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools.dynamic]
|
|
33
|
+
version = {file = "src/ansys/pre_commit_hooks/VERSION"}
|
|
34
|
+
readme = {file = ["README.rst"]}
|
|
35
|
+
description = {file = "A Python wrapper to create Ansys-tailored pre-commit hooks"}
|
|
36
|
+
classifiers = {file = """
|
|
37
|
+
"Development Status :: 4 - Beta",
|
|
38
|
+
"Intended Audience :: Science/Research",
|
|
39
|
+
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
40
|
+
"Operating System :: OS Independent",
|
|
41
|
+
"Programming Language :: Python :: 3.10",
|
|
42
|
+
"Programming Language :: Python :: 3.11",
|
|
43
|
+
"Programming Language :: Python :: 3.12",
|
|
44
|
+
"Programming Language :: Python :: 3.13",
|
|
45
|
+
"""}
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
doc = [
|
|
49
|
+
"ansys-sphinx-theme[autoapi]==1.7.2",
|
|
50
|
+
"numpydoc==1.10.0",
|
|
51
|
+
"sphinx==8.2.3",
|
|
52
|
+
"sphinx-autodoc-typehints==3.1.0",
|
|
53
|
+
"sphinx-copybutton==0.5.1",
|
|
54
|
+
]
|
|
55
|
+
tests = [
|
|
56
|
+
"pytest==9.0.2",
|
|
57
|
+
"pytest-cov==7.0.0",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[project.urls]
|
|
61
|
+
Source = "https://github.com/ansys/pre-commit-hooks/"
|
|
62
|
+
Issues = "https://github.com/ansys/pre-commit-hooks/issues"
|
|
63
|
+
Discussions = "https://github.com/ansys/pre-commit-hooks/discussions"
|
|
64
|
+
Documentation = "https://pre-commit-hooks.docs.pyansys.com"
|
|
65
|
+
Releases = "https://github.com/ansys/pre-commit-hooks/releases"
|
|
66
|
+
Changelog = "https://github.com/ansys/pre-commit-hooks/blob/main/doc/source/changelog.rst"
|
|
67
|
+
|
|
68
|
+
[tool.black]
|
|
69
|
+
line-length = 100
|
|
70
|
+
|
|
71
|
+
[tool.isort]
|
|
72
|
+
profile = "black"
|
|
73
|
+
force_sort_within_sections = true
|
|
74
|
+
line_length = 100
|
|
75
|
+
src_paths = ["doc", "src", "tests"]
|
|
76
|
+
|
|
77
|
+
[tool.codespell]
|
|
78
|
+
ignore-words = "doc/styles/config/vocabularies/ANSYS/accept.txt"
|
|
79
|
+
|
|
80
|
+
[tool.coverage.run]
|
|
81
|
+
source = ["ansys.pre_commit_hooks"]
|
|
82
|
+
|
|
83
|
+
[tool.coverage.report]
|
|
84
|
+
show_missing = true
|
|
85
|
+
|
|
86
|
+
[tool.pytest.ini_options]
|
|
87
|
+
minversion = "7.1"
|
|
88
|
+
addopts = "--cov=ansys.pre_commit_hooks --cov-report term-missing -vv"
|
|
89
|
+
testpaths = [
|
|
90
|
+
"tests",
|
|
91
|
+
]
|
|
92
|
+
markers = [
|
|
93
|
+
"add_license_headers: marks tests for add-license-headers hook",
|
|
94
|
+
"tech_review: marks tests for tech-review hook",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[tool.towncrier]
|
|
98
|
+
package = "ansys.pre_commit_hooks"
|
|
99
|
+
directory = "doc/changelog.d"
|
|
100
|
+
filename = "doc/source/changelog.rst"
|
|
101
|
+
start_string = ".. towncrier release notes start\n"
|
|
102
|
+
template = "doc/changelog.d/changelog_template.jinja"
|
|
103
|
+
title_format = "`{version} <https://github.com/ansys/pre-commit-hooks/releases/tag/v{version}>`_ - {project_date}"
|
|
104
|
+
issue_format = "`#{issue} <https://github.com/ansys/pre-commit-hooks/pull/{issue}>`_"
|
|
105
|
+
|
|
106
|
+
[[tool.towncrier.type]]
|
|
107
|
+
directory = "added"
|
|
108
|
+
name = "Added"
|
|
109
|
+
showcontent = true
|
|
110
|
+
|
|
111
|
+
[[tool.towncrier.type]]
|
|
112
|
+
directory = "changed"
|
|
113
|
+
name = "Changed"
|
|
114
|
+
showcontent = true
|
|
115
|
+
|
|
116
|
+
[[tool.towncrier.type]]
|
|
117
|
+
directory = "fixed"
|
|
118
|
+
name = "Fixed"
|
|
119
|
+
showcontent = true
|
|
120
|
+
|
|
121
|
+
[[tool.towncrier.type]]
|
|
122
|
+
directory = "dependencies"
|
|
123
|
+
name = "Dependencies"
|
|
124
|
+
showcontent = true
|
|
125
|
+
|
|
126
|
+
[[tool.towncrier.type]]
|
|
127
|
+
directory = "miscellaneous"
|
|
128
|
+
name = "Miscellaneous"
|
|
129
|
+
showcontent = true
|
|
130
|
+
|
|
131
|
+
[[tool.towncrier.type]]
|
|
132
|
+
directory = "documentation"
|
|
133
|
+
name = "Documentation"
|
|
134
|
+
showcontent = true
|
|
135
|
+
|
|
136
|
+
[[tool.towncrier.type]]
|
|
137
|
+
directory = "maintenance"
|
|
138
|
+
name = "Maintenance"
|
|
139
|
+
showcontent = true
|
|
140
|
+
|
|
141
|
+
[[tool.towncrier.type]]
|
|
142
|
+
directory = "test"
|
|
143
|
+
name = "Test"
|
|
144
|
+
showcontent = true
|