Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 497bd74

Browse files
greschdMaxJPRey
andauthored
Add pre-commit configuration (#11)
* Add pre-commit configuration * Update src/ansys/product/library/other_module.py Co-authored-by: Maxime Rey <[email protected]> * Use 'poetry install' instead of 'pip install' to get pinned dependencies Co-authored-by: Maxime Rey <[email protected]>
1 parent a690c1b commit 497bd74

File tree

9 files changed

+381
-107
lines changed

9 files changed

+381
-107
lines changed

.github/workflows/ci_cd.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
style:
15-
name: Style Check
15+
name: Pre-commit Check
1616
runs-on: ubuntu-latest
1717

1818
steps:
@@ -22,17 +22,14 @@ jobs:
2222
with:
2323
python-version: 3.8
2424

25-
- name: Install style requirements
25+
- name: Install pre-commit requirements
2626
run: |
27-
pip install .[style] --disable-pip-version-check
27+
pip install poetry
28+
poetry install -E pre-commit
2829
29-
- name: Codespell
30+
- name: Run pre-commit
3031
run: |
31-
make codespell
32-
33-
- name: flake8
34-
run: |
35-
make flake8
32+
poetry run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
3633
3734
main:
3835
name: Build and Testing
@@ -82,17 +79,19 @@ jobs:
8279
python-version: 3.8
8380

8481
- name: Install library, with docs extra
85-
run: pip install .[docs]
82+
run: |
83+
pip install poetry
84+
poetry install -E docs
8685
8786
- name: Build HTML
8887
run: |
89-
make -C doc html SPHINXOPTS="-W"
88+
poetry run make -C doc html SPHINXOPTS="-W"
9089
9190
- name: Build PDF Documentation
9291
run: |
9392
sudo apt update
9493
sudo apt-get install -y texlive-latex-extra latexmk
95-
make -C doc latexpdf
94+
poetry run make -C doc latexpdf
9695
9796
- name: Upload HTML Documentation
9897
uses: actions/upload-artifact@v2

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.1.0
4+
hooks:
5+
- id: black
6+
- repo: https://github.com/asottile/reorder_python_imports
7+
rev: v2.7.1
8+
hooks:
9+
- id: reorder-python-imports
10+
args: ["--py37-plus"]
11+
- repo: https://gitlab.com/PyCQA/flake8
12+
rev: 3.9.2
13+
hooks:
14+
- id: flake8
15+
- repo: https://github.com/codespell-project/codespell
16+
rev: v2.1.0
17+
hooks:
18+
- id: codespell
19+
# - repo: https://github.com/pycqa/pydocstyle
20+
# rev: 6.1.1
21+
# hooks:
22+
# - id: pydocstyle
23+
# additional_dependencies: [toml]
24+
- repo: local
25+
hooks:
26+
- id: mypy
27+
name: mypy
28+
entry: mypy
29+
language: python
30+
types: [python]
31+
require_serial: true
32+
exclude: "^(doc/)|(tests/)|(dist/)"
33+
args: []

doc/source/conf.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
"""Sphinx documentation configuration file."""
22
from datetime import datetime
33

4-
from pyansys_sphinx_theme import pyansys_logo_black
5-
64
from ansys.product.library import __version__
5+
from pyansys_sphinx_theme import pyansys_logo_black
76

87
# Project information
9-
project = 'ansys-product-library'
8+
project = "ansys-product-library"
109
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
1110
author = "Ansys Inc."
1211
release = version = __version__
1312

1413
# use the default pyansys logo
1514
html_logo = pyansys_logo_black
16-
html_theme = 'pyansys_sphinx_theme'
15+
html_theme = "pyansys_sphinx_theme"
1716

1817
# specify the location of your github repo
1918
html_theme_options = {
2019
"github_url": "https://github.com/pyansys/pyansys-sphinx-theme",
21-
"show_prev_next": False
20+
"show_prev_next": False,
2221
}
2322

2423
# Sphinx extensions
2524
extensions = [
26-
'sphinx.ext.autodoc',
27-
'sphinx.ext.autosummary',
25+
"sphinx.ext.autodoc",
26+
"sphinx.ext.autosummary",
2827
"numpydoc",
2928
"sphinx.ext.intersphinx",
3029
"sphinx_copybutton",
@@ -33,9 +32,7 @@
3332
# Intersphinx mapping
3433
intersphinx_mapping = {
3534
"python": ("https://docs.python.org/dev", None),
36-
3735
# kept here as an example
38-
3936
# "scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
4037
# "numpy": ("https://numpy.org/devdocs", None),
4138
# "matplotlib": ("https://matplotlib.org/stable", None),
@@ -73,7 +70,7 @@
7370
templates_path = ["_templates"]
7471

7572
# The suffix(es) of source filenames.
76-
source_suffix = '.rst'
73+
source_suffix = ".rst"
7774

7875
# The master toctree document.
79-
master_doc = 'index'
76+
master_doc = "index"

0 commit comments

Comments
 (0)