Skip to content

Commit 6fe5946

Browse files
Add pre-commit config and run in CI (#177)
Co-authored-by: ludovicsteinbach <ludovicsteinbach@users.noreply.github.com>
1 parent 960967b commit 6fe5946

File tree

703 files changed

+20264
-13633
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

703 files changed

+20264
-13633
lines changed

.github/dependabot.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ updates:
1818
interval: "weekly"
1919
labels:
2020
- "maintenance"
21-
21+
2222
- package-ecosystem: "pip" # See documentation for possible values
2323
directory: "/ansys-grantami-serverapi-openapi/" # Location of package manifests
2424
schedule:

.github/workflows/generate_library.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
token: ${{ steps.get_workflow_token.outputs.token }}
3131
ref: ${{ github.event.pull_request.head.ref }}
32-
32+
3333
- name: "Set up JDK 11"
3434
uses: actions/setup-java@v4
3535
with:
@@ -58,11 +58,10 @@ jobs:
5858
poetry lock --no-update
5959
working-directory: ansys-grantami-serverapi-openapi
6060

61-
- name: "Install and run black"
61+
- name: "Install and run pre-commit"
6262
run: |
63-
pip install black
64-
black ./src ./tests
65-
working-directory: ansys-grantami-serverapi-openapi
63+
pip install pre-commit
64+
! pre-commit run --all-files
6665
6766
- name: "Commit changes to library code"
6867
uses: EndBug/add-and-commit@v9

.isort.cfg

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[settings]
2+
profile=black
3+
force_sort_within_sections=true
4+
line_length=100
5+
default_section=THIRDPARTY
6+
src_paths=src,tests

.m2/settings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</pluginRepositories>
3939
</profile>
4040
</profiles>
41-
41+
4242
<servers>
4343
<server>
4444
<id>github</id>

.pre-commit-config.yaml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
repos:
2+
3+
- repo: https://github.com/psf/black
4+
rev: 24.3.0
5+
hooks:
6+
- id: black
7+
files: '^ansys-grantami-serverapi-openapi/(src|tests)'
8+
args:
9+
- '--line-length=100'
10+
11+
- repo: https://github.com/pycqa/isort
12+
rev: 5.13.2
13+
hooks:
14+
- id: isort
15+
files: '^ansys-grantami-serverapi-openapi/(src|tests)'
16+
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v4.5.0
19+
hooks:
20+
- id: check-yaml
21+
- id: debug-statements
22+
- id: check-merge-conflict
23+
- id: trailing-whitespace
24+
25+
- repo: https://github.com/ansys/pre-commit-hooks
26+
rev: v0.2.8
27+
hooks:
28+
- id: add-license-headers
29+
args:
30+
- --start_year=2023
31+
files: 'ansys-grantami-serverapi-openapi/(src|tests)/.*\.(py)'

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ Once the tag is pushed to GitHub, a workflow will build and publish the release.
5252
As stated above, direct use of this package is unsupported. The recommended approach is to use the idiomatic
5353
libraries written for specific API areas.
5454

55-
We do understand that internal or external users might want to experiment with Granta MI Server API functionality that
55+
We do understand that internal or external users might want to experiment with Granta MI Server API functionality that
5656
is not exposed via an idiomatic python library. To that extent, the following sections demonstrate how to install and
5757
get started with the library.
5858

5959
### Requirements
60-
The `ansys-grantami-serverapi-openapi` package requires Granta MI. The following table details compatibility between
60+
The `ansys-grantami-serverapi-openapi` package requires Granta MI. The following table details compatibility between
6161
Granta MI releases and versions of the Python package.
6262

6363
| Granta MI | ansys-grantami-serverapi-openapi |
@@ -69,8 +69,8 @@ Granta MI releases and versions of the Python package.
6969

7070
### Installation
7171

72-
During active development phases of Granta MI, this repository is kept up to date with new versions of the API
73-
documentation. To use the most up-to-date version of this package in another project, add a dependency on the
72+
During active development phases of Granta MI, this repository is kept up to date with new versions of the API
73+
documentation. To use the most up-to-date version of this package in another project, add a dependency on the
7474
repository's main branch, e.g. with poetry:
7575

7676
```console
@@ -84,7 +84,7 @@ Or with pip:
8484
```
8585

8686
### Minimal setup
87-
The following code snippet demonstrates how to perform the minimal setup required to interact with the API using this
87+
The following code snippet demonstrates how to perform the minimal setup required to interact with the API using this
8888
library.
8989

9090
```python
@@ -130,11 +130,11 @@ class Connection(ApiClientFactory):
130130

131131
if __name__ == '__main__':
132132
from ansys.grantami.serverapi_openapi import api
133-
133+
134134
# Update URL and connection method for your system
135135
URL = "http://my_server_name/mi_servicelayer"
136136
api_client = Connection(api_url=URL).with_autologon().connect()
137-
137+
138138
schema_api = api.SchemaApi(api_client)
139139
server_version = schema_api.v1alpha_schema_mi_version_get()
140140
print(server_version.version)

ansys-grantami-serverapi-openapi/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
55
[tool.poetry]
66
name = "ansys-grantami-serverapi-openapi"
77
description = "Autogenerated client library for the Granta MI Server API."
8-
version = "3.0.0.dev234"
8+
version = "3.0.0.dev236"
99
license = "MIT"
1010
authors = ["ANSYS, Inc. <pyansys.core@ansys.com>"]
1111
maintainers = ["ANSYS, Inc. <pyansys.core@ansys.com>"]

0 commit comments

Comments
 (0)