ansys-pre-commit-hooks 0.5.0__tar.gz → 0.5.2__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.0/src/ansys_pre_commit_hooks.egg-info → ansys_pre_commit_hooks-0.5.2}/PKG-INFO +8 -182
- ansys_pre_commit_hooks-0.5.2/README.rst +211 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/pyproject.toml +5 -6
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/setup.py +6 -5
- ansys_pre_commit_hooks-0.5.2/src/ansys/pre_commit_hooks/VERSION +1 -0
- ansys_pre_commit_hooks-0.5.2/src/ansys/pre_commit_hooks/__pycache__/__init__.cpython-312.pyc +0 -0
- ansys_pre_commit_hooks-0.5.2/src/ansys/pre_commit_hooks/__pycache__/tech_review.cpython-312.pyc +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/add_license_headers.py +91 -53
- ansys_pre_commit_hooks-0.5.0/src/ansys/pre_commit_hooks/assets/LICENSES/MIT.txt → ansys_pre_commit_hooks-0.5.2/src/ansys/pre_commit_hooks/templates/LICENSE +2 -2
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2/src/ansys_pre_commit_hooks.egg-info}/PKG-INFO +8 -182
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys_pre_commit_hooks.egg-info/SOURCES.txt +2 -2
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys_pre_commit_hooks.egg-info/requires.txt +6 -5
- ansys_pre_commit_hooks-0.5.0/README.rst +0 -386
- ansys_pre_commit_hooks-0.5.0/src/ansys/pre_commit_hooks/VERSION +0 -1
- ansys_pre_commit_hooks-0.5.0/src/ansys/pre_commit_hooks/__pycache__/__init__.cpython-310.pyc +0 -0
- ansys_pre_commit_hooks-0.5.0/src/ansys/pre_commit_hooks/__pycache__/tech_review.cpython-310.pyc +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/AUTHORS +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/LICENSE +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/MANIFEST.in +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/setup.cfg +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/__init__.py +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/assets/.reuse/templates/ansys.jinja2 +0 -0
- /ansys_pre_commit_hooks-0.5.0/src/ansys/pre_commit_hooks/templates/LICENSE → /ansys_pre_commit_hooks-0.5.2/src/ansys/pre_commit_hooks/assets/LICENSES/MIT.txt +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/assets/licenses.json +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/tech_review.py +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/AUTHORS +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/CODE_OF_CONDUCT.md +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/CONTRIBUTING.md +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/CONTRIBUTORS.md +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/README.md +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/README.rst +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys/pre_commit_hooks/templates/dependabot.yml +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys_pre_commit_hooks.egg-info/dependency_links.txt +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys_pre_commit_hooks.egg-info/entry_points.txt +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/src/ansys_pre_commit_hooks.egg-info/top_level.txt +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/tests/test_add_license_headers.py +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/tests/test_metadata.py +0 -0
- {ansys_pre_commit_hooks-0.5.0 → ansys_pre_commit_hooks-0.5.2}/tests/test_tech_review.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: ansys-pre-commit-hooks
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: A Python wrapper to create Ansys-tailored pre-commit hooks
|
|
5
5
|
Home-page: https://github.com/ansys/pre-commit-hooks
|
|
6
6
|
Author: ANSYS, Inc.
|
|
@@ -25,18 +25,19 @@ Requires-Python: >=3.9,<4
|
|
|
25
25
|
License-File: LICENSE
|
|
26
26
|
License-File: AUTHORS
|
|
27
27
|
Requires-Dist: GitPython==3.1.44
|
|
28
|
-
Requires-Dist: importlib-metadata==8.
|
|
28
|
+
Requires-Dist: importlib-metadata==8.6.1
|
|
29
29
|
Requires-Dist: Jinja2==3.1.5
|
|
30
30
|
Requires-Dist: reuse==5.0.2
|
|
31
31
|
Requires-Dist: requests==2.32.3
|
|
32
|
-
Requires-Dist: semver==3.0.
|
|
32
|
+
Requires-Dist: semver==3.0.4
|
|
33
33
|
Requires-Dist: toml==0.10.2
|
|
34
34
|
Provides-Extra: doc
|
|
35
|
-
Requires-Dist: ansys-sphinx-theme[autoapi]==1.2
|
|
35
|
+
Requires-Dist: ansys-sphinx-theme[autoapi]==1.3.2; extra == "doc"
|
|
36
36
|
Requires-Dist: numpydoc==1.8.0; extra == "doc"
|
|
37
|
-
Requires-Dist: sphinx==8.1
|
|
38
|
-
Requires-Dist: sphinx-autodoc-typehints==3.
|
|
37
|
+
Requires-Dist: sphinx==8.2.1; extra == "doc"
|
|
38
|
+
Requires-Dist: sphinx-autodoc-typehints==3.1.0; extra == "doc"
|
|
39
39
|
Requires-Dist: sphinx-copybutton==0.5.1; extra == "doc"
|
|
40
|
+
Requires-Dist: sphinx_design==0.6.1; extra == "doc"
|
|
40
41
|
Provides-Extra: tests
|
|
41
42
|
Requires-Dist: pytest==8.3.4; extra == "tests"
|
|
42
43
|
Requires-Dist: pytest-cov==6.0.0; extra == "tests"
|
|
@@ -87,7 +88,7 @@ Ansys pre-commit hooks
|
|
|
87
88
|
:alt: pre-commit.ci status
|
|
88
89
|
|
|
89
90
|
This Ansys repository contains `pre-commit`_ hooks for different purposes.
|
|
90
|
-
|
|
91
|
+
The following hooks are currently available:
|
|
91
92
|
|
|
92
93
|
* ``add-license-headers``: Add missing license headers to files by using
|
|
93
94
|
`REUSE <https://reuse.software/>`_ . To use this hook, you must
|
|
@@ -95,181 +96,6 @@ Currently, these hooks are available:
|
|
|
95
96
|
* ``tech-review``: Do a technical review of your repository according to
|
|
96
97
|
`Ansys repository requirements <https://dev.docs.pyansys.com/packaging/structure.html>`_
|
|
97
98
|
|
|
98
|
-
``add-license-headers`` setup
|
|
99
|
-
-----------------------------
|
|
100
|
-
|
|
101
|
-
Add required directories
|
|
102
|
-
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
103
|
-
|
|
104
|
-
If you are using the ansys.jinja2 template and MIT.txt license, skip this step. By default, the hook will make symbolic links
|
|
105
|
-
from its "assets" directory containing LICENSES/MIT.txt and .reuse/templates/ansys.jinja2
|
|
106
|
-
to your repository when the hook runs. The .reuse and LICENSES directories will be deleted once the hook is
|
|
107
|
-
done running.
|
|
108
|
-
|
|
109
|
-
If you are using a custom template, create a directory named ``.reuse``, and if you are using a custom license, create a directory
|
|
110
|
-
named ``LICENSES`` in the root of your repository. The custom template cannot be named ``ansys.jinja2``, otherwise it will be removed
|
|
111
|
-
after the hook is done running. The custom license cannot be named ``MIT.txt`` for the same reason. The ``.reuse`` and/or ``LICENSES``
|
|
112
|
-
directories will have to be committed to your repository and will not be removed once the hook is done running as long as there
|
|
113
|
-
are custom templates or licenses in those directories. Your project should have the following layout:
|
|
114
|
-
|
|
115
|
-
::
|
|
116
|
-
|
|
117
|
-
project
|
|
118
|
-
├── LICENCES
|
|
119
|
-
│ └── license_name.txt
|
|
120
|
-
├── .reuse
|
|
121
|
-
│ └── templates
|
|
122
|
-
│ └── template_name.jinja2
|
|
123
|
-
├── src
|
|
124
|
-
├── examples
|
|
125
|
-
├── tests
|
|
126
|
-
├── .pre-commit-config.yaml
|
|
127
|
-
├── pyproject.toml
|
|
128
|
-
|
|
129
|
-
Where ``license_name`` is the name of the license that is being used, for example, MIT.txt, and
|
|
130
|
-
``template_name`` is the name of the custom template being used. The jinja2 file contains the
|
|
131
|
-
template for the license headers that are added to the files.
|
|
132
|
-
|
|
133
|
-
Licenses that are supported by ``REUSE`` can be found in the
|
|
134
|
-
`spdx/license-list-data <https://github.com/spdx/license-list-data/tree/main/text>`_ repository.
|
|
135
|
-
Please select a license text file from that repository, and copy it to the LICENSES directory.
|
|
136
|
-
|
|
137
|
-
Set custom arguments
|
|
138
|
-
^^^^^^^^^^^^^^^^^^^^
|
|
139
|
-
|
|
140
|
-
.. code:: yaml
|
|
141
|
-
|
|
142
|
-
- repo: https://github.com/ansys/pre-commit-hooks
|
|
143
|
-
rev: v0.5.0
|
|
144
|
-
hooks:
|
|
145
|
-
- id: add-license-headers
|
|
146
|
-
args: ["--custom_copyright", "custom copyright phrase", "--custom_template", "template_name", "--custom_license", "license_name", "--ignore_license_check", "--start_year", "2023"]
|
|
147
|
-
|
|
148
|
-
``args`` can also be formatted as follows:
|
|
149
|
-
|
|
150
|
-
.. code:: yaml
|
|
151
|
-
|
|
152
|
-
args:
|
|
153
|
-
- --custom_copyright=custom copyright phrase
|
|
154
|
-
- --custom_template=template_name
|
|
155
|
-
- --custom_license=license_name
|
|
156
|
-
- --ignore_license_check
|
|
157
|
-
- --start_year=2023
|
|
158
|
-
|
|
159
|
-
* ``custom copyright phrase`` is the copyright line you want to include in the license
|
|
160
|
-
header. By default, it uses ``"ANSYS, Inc. and/or its affiliates."``.
|
|
161
|
-
* ``template_name`` is the name of the .jinja2 file located in ``.reuse/templates/``.
|
|
162
|
-
By default, it uses ``ansys``.
|
|
163
|
-
* ``license_name`` is the name of the license being used. For example, MIT, ECL-1.0, etc.
|
|
164
|
-
To view a list of licenses that are supported by ``REUSE``, see
|
|
165
|
-
https://github.com/spdx/license-list-data/tree/main/text. By default it uses ``MIT``.
|
|
166
|
-
* ``ignore_license_check`` is whether or not to check for the license in the header. By default,
|
|
167
|
-
it is ``False``, meaning the files are checked for both the copyright and licensing information
|
|
168
|
-
in the header. Add ``--ignore_license_check`` to ignore checking for licensing information
|
|
169
|
-
in the files.
|
|
170
|
-
* ``start_year`` is the start year of the copyright statement. By default, the ``start_year`` is
|
|
171
|
-
the current year, making the copyright statement
|
|
172
|
-
"Copyright (C) 2024 ANSYS, Inc. and/or its affiliates." If you are adding license headers
|
|
173
|
-
to packages released before the current year, add the ``start_year`` argument with the year your
|
|
174
|
-
package was released. For example, if ``start_year`` is 2023, the copyright statement would be
|
|
175
|
-
"Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates." assuming the current year is 2024.
|
|
176
|
-
|
|
177
|
-
Specify directories to run the hook on
|
|
178
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
179
|
-
|
|
180
|
-
By default, the hook will run on proto files in any directory, as well as python files within
|
|
181
|
-
directories named ``src``, ``examples``, and ``tests``. To specify additional files and/or directories
|
|
182
|
-
the hook should run on, add the necessary regex to the ``files`` line in your
|
|
183
|
-
.pre-commit-config.yaml file:
|
|
184
|
-
|
|
185
|
-
.. code:: yaml
|
|
186
|
-
|
|
187
|
-
- repo: https://github.com/ansys/pre-commit-hooks
|
|
188
|
-
rev: v0.5.0
|
|
189
|
-
hooks:
|
|
190
|
-
- id: add-license-headers
|
|
191
|
-
files: '(src|examples|tests|newFolder)/.*\.(py|newExtension)|\.(proto|newExtension)'
|
|
192
|
-
|
|
193
|
-
Ignore specific files or file types
|
|
194
|
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
195
|
-
|
|
196
|
-
In .pre-commit-config.yaml:
|
|
197
|
-
|
|
198
|
-
.. code:: yaml
|
|
199
|
-
|
|
200
|
-
- repo: https://github.com/ansys/pre-commit-hooks
|
|
201
|
-
rev: v0.5.0
|
|
202
|
-
hooks:
|
|
203
|
-
- id: add-license-headers
|
|
204
|
-
exclude: |
|
|
205
|
-
(?x)^(
|
|
206
|
-
path/to/file1.py |
|
|
207
|
-
path/to/.*\.(ts|cpp) |
|
|
208
|
-
(.folder1|folder2)/.* |
|
|
209
|
-
.*\.js |
|
|
210
|
-
\..* |
|
|
211
|
-
)$
|
|
212
|
-
|
|
213
|
-
* ``path/to/file1.py`` excludes the stated file.
|
|
214
|
-
* ``path/to/.*\.(ts|cpp)`` excludes all .ts and .cpp files within the ``path/to`` directory.
|
|
215
|
-
* ``(.folder1|folder2)/.*`` excludes directories named .folder1 and folder2.
|
|
216
|
-
* ``.*\.js`` excludes all .js files in all directories.
|
|
217
|
-
* ``\..*`` excludes all hidden files.
|
|
218
|
-
|
|
219
|
-
``tech-review`` setup
|
|
220
|
-
---------------------
|
|
221
|
-
|
|
222
|
-
These are the default values for the arguments of the tech-review hook:
|
|
223
|
-
|
|
224
|
-
* ``--author_maint_name=ANSYS, Inc.``
|
|
225
|
-
* ``--author_maint_email=pyansys.core@ansys.com``
|
|
226
|
-
* ``--license=MIT``
|
|
227
|
-
* ``--url=https://github.com/ansys/{repo-name}``, replacing ``repo-name`` with the name of the repository
|
|
228
|
-
|
|
229
|
-
The ``--author_maint_name`` is the name of the author and maintainer in the ``pyproject.toml`` file.
|
|
230
|
-
By default, it is "Ansys, Inc.".
|
|
231
|
-
|
|
232
|
-
The ``--author_maint_email`` is the email of the author and maintainer in the ``pyproject.toml`` file.
|
|
233
|
-
By default, it is "pyansys.core@ansys.com".
|
|
234
|
-
|
|
235
|
-
The ``--license`` argument is the license that is being used by your repository. By default, it is
|
|
236
|
-
MIT.
|
|
237
|
-
|
|
238
|
-
The ``--url`` argument is automatically rendered based on the repository name. If your repository
|
|
239
|
-
is not in the Ansys organization, please add this argument to your configuration in
|
|
240
|
-
.pre-commit-config.yaml.
|
|
241
|
-
|
|
242
|
-
The ``--product`` argument is required if a ``README.rst`` or ``README.md`` file does not
|
|
243
|
-
exist in your repository and you want the template to render correctly. The product
|
|
244
|
-
for ``PyMechanical`` would be ``mechanical``, for example.
|
|
245
|
-
|
|
246
|
-
The ``--non_compliant_name`` flag can be used if your repository does not follow the typical
|
|
247
|
-
naming convention of ``ansys-*-*``.
|
|
248
|
-
|
|
249
|
-
Technical review hook in ``ansys/pre-commit-hooks``' .pre-commit-config.yaml file:
|
|
250
|
-
|
|
251
|
-
.. code:: yaml
|
|
252
|
-
|
|
253
|
-
- repo: https://github.com/ansys/pre-commit-hooks
|
|
254
|
-
rev: v0.5.0
|
|
255
|
-
hooks:
|
|
256
|
-
- id: tech-review
|
|
257
|
-
args:
|
|
258
|
-
- --product=pre_commit_hooks
|
|
259
|
-
- --non_compliant_name
|
|
260
|
-
|
|
261
|
-
Technical review hook in ``PyMechanical``'s .pre-commit-config.yaml file:
|
|
262
|
-
|
|
263
|
-
.. code:: yaml
|
|
264
|
-
|
|
265
|
-
- repo: https://github.com/ansys/pre-commit-hooks
|
|
266
|
-
rev: v0.5.0
|
|
267
|
-
hooks:
|
|
268
|
-
- id: tech-review
|
|
269
|
-
args:
|
|
270
|
-
- --product=mechanical
|
|
271
|
-
|
|
272
|
-
|
|
273
99
|
How to install
|
|
274
100
|
--------------
|
|
275
101
|
|
|
@@ -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/
|
|
@@ -5,7 +5,7 @@ requires = [
|
|
|
5
5
|
"Jinja2==3.1.5",
|
|
6
6
|
"reuse==5.0.2",
|
|
7
7
|
"requests==2.32.3",
|
|
8
|
-
"semver==3.0.
|
|
8
|
+
"semver==3.0.4",
|
|
9
9
|
"toml==0.10.2",
|
|
10
10
|
"wheel",
|
|
11
11
|
]
|
|
@@ -43,12 +43,11 @@ markers = [
|
|
|
43
43
|
[tool.towncrier]
|
|
44
44
|
package = "ansys.pre_commit_hooks"
|
|
45
45
|
directory = "doc/changelog.d"
|
|
46
|
-
filename = "
|
|
47
|
-
start_string = "
|
|
48
|
-
underlines = ["", "", ""]
|
|
46
|
+
filename = "doc/source/changelog.rst"
|
|
47
|
+
start_string = ".. towncrier release notes start\n"
|
|
49
48
|
template = "doc/changelog.d/changelog_template.jinja"
|
|
50
|
-
title_format = "
|
|
51
|
-
issue_format = "
|
|
49
|
+
title_format = "`{version} <https://github.com/ansys/pre-commit-hooks/releases/tag/v{version}>`_ - {project_date}"
|
|
50
|
+
issue_format = "`#{issue} <https://github.com/ansys/pre-commit-hooks/pull/{issue}>`_"
|
|
52
51
|
|
|
53
52
|
[[tool.towncrier.type]]
|
|
54
53
|
directory = "added"
|
|
@@ -69,20 +69,21 @@ setup(
|
|
|
69
69
|
python_requires=">=3.9,<4",
|
|
70
70
|
install_requires=[
|
|
71
71
|
"GitPython==3.1.44",
|
|
72
|
-
"importlib-metadata==8.
|
|
72
|
+
"importlib-metadata==8.6.1",
|
|
73
73
|
"Jinja2==3.1.5",
|
|
74
74
|
"reuse==5.0.2",
|
|
75
75
|
"requests==2.32.3",
|
|
76
|
-
"semver==3.0.
|
|
76
|
+
"semver==3.0.4",
|
|
77
77
|
"toml==0.10.2",
|
|
78
78
|
],
|
|
79
79
|
extras_require={
|
|
80
80
|
"doc": [
|
|
81
|
-
"ansys-sphinx-theme[autoapi]==1.2
|
|
81
|
+
"ansys-sphinx-theme[autoapi]==1.3.2",
|
|
82
82
|
"numpydoc==1.8.0",
|
|
83
|
-
"sphinx==8.1
|
|
84
|
-
"sphinx-autodoc-typehints==3.
|
|
83
|
+
"sphinx==8.2.1",
|
|
84
|
+
"sphinx-autodoc-typehints==3.1.0",
|
|
85
85
|
"sphinx-copybutton==0.5.1",
|
|
86
|
+
"sphinx_design==0.6.1",
|
|
86
87
|
],
|
|
87
88
|
"tests": [
|
|
88
89
|
"pytest==8.3.4",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.5.2
|
|
Binary file
|