Skip to content

Commit 9e4c9ab

Browse files
akaszynskiMaxJPRey
andauthored
add breadcrumb and pre-commit (#51)
* push always * initial pre-commit add * add pre-commit fully * Commit the actual fix. * Fix typo in the test_practices to validate pre-commit. * Update .pre-commit-config.yaml Co-authored-by: Maxime Rey <[email protected]> * add dependabot * add breadcrumbs * move wsl guide out * fully implement pre-commit * use 3.10 properly Co-authored-by: Maxime Rey <[email protected]> Co-authored-by: Maxime Rey <[email protected]>
1 parent 5efc94a commit 9e4c9ab

20 files changed

+335
-624
lines changed

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
exclude = build, doc/source/conf.py
3+
select = W191, W291, W293, W391, E115, E117, E122, E124, E125, E225, E231, E301, E303, E501, F401, F403
4+
count = True
5+
max-complexity = 10
6+
max-line-length = 100
7+
statistics = True

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip" # See documentation for possible values
4+
directory: "/" # Location of package manifests
5+
insecure-external-code-execution: allow
6+
schedule:
7+
interval: "daily"
8+
labels:
9+
- "maintenance"
10+
- "dependencies"

.github/workflows/ci-build.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ on:
99
- main
1010

1111
jobs:
12+
pre-commit:
13+
name: Pre-commit checks
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Setup Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.10'
22+
- name: Install pre-commit requirements
23+
run: |
24+
pip install pre-commit~=2.16.0
25+
26+
- name: Run pre-commit
27+
run: |
28+
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
29+
1230
docs_build:
1331
runs-on: ubuntu-latest
1432

@@ -26,6 +44,16 @@ jobs:
2644
make -C doc html SPHINXOPTS="-W"
2745
touch doc/build/html/.nojekyll
2846
echo "dev.docs.pyansys.com" > doc/build/html/CNAME
47+
48+
- name: Deploy to gh-pages on main
49+
if: github.ref == 'refs/heads/main'
50+
uses: JamesIves/[email protected]
51+
with:
52+
token: ${{ secrets.github_token }}
53+
branch: gh-pages
54+
folder: docs/build/html
55+
clean: true
56+
single-commit: true
2957

3058
- name: Build PDF Documentation
3159
run: |
@@ -64,17 +92,9 @@ jobs:
6492
- name: Display structure of downloaded files
6593
run: ls -R
6694

67-
- name: Deploy to gh-pages
68-
uses: JamesIves/[email protected]
69-
with:
70-
token: ${{ secrets.github_token }}
71-
branch: gh-pages
72-
folder: HTML-Documentation
73-
clean: true
74-
single-commit: true
75-
7695
- name: Release
7796
uses: softprops/action-gh-release@v1
7897
with:
98+
generate_release_notes: true
7999
files: |
80100
./*PDF*/*.pdf

.github/workflows/style.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 21.12b0
4+
hooks:
5+
- id: black
6+
exclude: "^({{cookiecutter.project_slug}}/)"
7+
- repo: https://github.com/asottile/reorder_python_imports
8+
rev: v2.6.0
9+
hooks:
10+
- id: reorder-python-imports
11+
args: ["--py37-plus"]
12+
exclude: "^({{cookiecutter.project_slug}}/)"
13+
- repo: https://gitlab.com/PyCQA/flake8
14+
rev: 3.9.2
15+
hooks:
16+
- id: flake8
17+
exclude: "^({{cookiecutter.project_slug}}/)"
18+
- repo: https://github.com/codespell-project/codespell
19+
rev: v2.1.0
20+
hooks:
21+
- id: codespell
22+
args: [--ignore-words=ignore_words.txt, -S \*.pyc\,\*.xml\,\*.txt\,\*.gif\,\*.png\,\*.jpg\,\*.js\,\*.html\,\*.doctree\,\*.ttf\,\*.woff\,\*.woff2\,\*.eot\,\*.mp4\,\*.inv\,\*.pickle\,\*.ipynb\,flycheck\*\,./.git/\*\,./.hypothesis/\*\,\*.yml\,./doc/build/\*\,./doc/images/\*\,./dist/\*\,\*~\,.hypothesis\*\,./doc/source/examples/\*\,\*cover\,\*.dat\,\*.mac]

doc/source/conf.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,39 @@
1+
"""Sphinx documentation configuration file for the pyansys developer's guide."""
12
from datetime import datetime
23

3-
from pyansys_sphinx_theme import __version__, pyansys_logo_black
4+
from pyansys_sphinx_theme import __version__
5+
from pyansys_sphinx_theme import pyansys_logo_black
46

57
# Project information
6-
project = 'PyAnsys Developers Guide'
8+
project = "PyAnsys Developer's Guide"
79
copyright = f"(c) {datetime.now().year} ANSYS, Inc. All rights reserved"
810
author = "Ansys Inc."
9-
release = version = '0.2.dev0'
11+
release = version = "0.2.dev0"
1012

1113
html_logo = pyansys_logo_black
12-
html_theme = 'pyansys_sphinx_theme'
14+
html_theme = "pyansys_sphinx_theme"
1315

1416
html_theme_options = {
15-
"github_url": "https://github.com/pyansys/about",
16-
"show_prev_next": False
17+
"github_url": "https://github.com/pyansys/dev-guide",
18+
"show_prev_next": False,
19+
"show_breadcrumbs": True,
20+
"additional_breadcrumbs": [
21+
("PyAnsys", "https://docs.pyansys.com/"),
22+
],
1723
}
1824

25+
# necessary for proper breadcrumb title
26+
html_short_title = html_title = project
27+
1928
# Sphinx extensions
2029
extensions = [
2130
"sphinx_copybutton",
22-
'sphinx_toolbox.collapse',
23-
'sphinx.ext.autodoc',
24-
'sphinx.ext.autosummary',
25-
'sphinx.ext.intersphinx',
26-
'sphinx.ext.napoleon',
27-
'sphinx.ext.todo',
31+
"sphinx_toolbox.collapse",
32+
"sphinx.ext.autodoc",
33+
"sphinx.ext.autosummary",
34+
"sphinx.ext.intersphinx",
35+
"sphinx.ext.napoleon",
36+
"sphinx.ext.todo",
2837
]
2938

3039
# Intersphinx mapping
@@ -38,22 +47,24 @@
3847
}
3948

4049
# The suffix(es) of source filenames.
41-
source_suffix = '.rst'
50+
source_suffix = ".rst"
4251

4352
# The master toctree document.
44-
master_doc = 'index'
53+
master_doc = "index"
4554

4655
latex_elements = {}
4756

4857
# Grouping the document tree into LaTeX files. List of tuples
4958
# (source start file, target name, title,
5059
# author, documentclass [howto, manual, or own class]).
5160
latex_documents = [
52-
(master_doc,
53-
f'pyansys_dev_guide_v{version}.tex',
54-
"PyAnsys Developer's Guide",
55-
author,
56-
'manual'),
61+
(
62+
master_doc,
63+
f"pyansys_dev_guide_v{version}.tex",
64+
"PyAnsys Developer's Guide",
65+
author,
66+
"manual",
67+
),
5768
]
5869

5970

doc/source/documentation_style/sample_func.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
def func(arg1, arg2):
22
"""Summary line <should be only one line>.
33
4-
Extended description of the function. The extended description,
5-
which can span multiple lines, should provide a general overview
4+
Extended description of the function. The extended description,
5+
which can span multiple lines, should provide a general overview
66
of the function.
77
88
.. warning::
99
Use the ``.. warning::`` directive within the docstring for any
10-
warnings that need to be explicitly stated. For example, you
11-
want to include a warning for a method that is to be deprecated
10+
warnings that need to be explicitly stated. For example, you
11+
want to include a warning for a method that is to be deprecated
1212
in the next release.
1313
1414
Parameters

0 commit comments

Comments
 (0)