Skip to content

Commit 4faf464

Browse files
authored
MAINT: modernize project layout (#115)
* Remove configure scripts * Collect deps under requirements/ dir * Add tox.ini for automation * Update CI/CD to new tox workflow * Update .pre-commit-confgi.yml * Update to latest ansys-sphinx-theme==0.4.2
1 parent 1e93189 commit 4faf464

File tree

8 files changed

+267
-89
lines changed

8 files changed

+267
-89
lines changed

.github/workflows/ci-build.yml

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Documentation Build
1+
name: CI
22

33
on:
44
pull_request:
@@ -8,70 +8,62 @@ on:
88
branches:
99
- main
1010

11+
env:
12+
MAIN_PYTHON_VERSION: '3.10'
13+
1114
jobs:
12-
pre-commit:
13-
name: Pre-commit checks
14-
runs-on: ubuntu-latest
1515

16+
style:
17+
name: Code style
18+
runs-on: ubuntu-latest
1619
steps:
1720
- uses: actions/checkout@v2
18-
- name: Setup Python
21+
- name: Set up Python
1922
uses: actions/setup-python@v2
2023
with:
21-
python-version: '3.10'
22-
- name: Install pre-commit requirements
24+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
25+
- name: Install dependencies
2326
run: |
24-
pip install pre-commit~=2.16.0
27+
python -m pip install --upgrade pip tox
28+
- name: Test with tox
29+
run: tox -e style
2530

26-
- name: Run pre-commit
27-
run: |
28-
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
29-
30-
docs_build:
31+
docs:
32+
name: Documentation
3133
runs-on: ubuntu-latest
32-
3334
steps:
3435
- uses: actions/checkout@v2
3536

36-
- name: Setup Python
37-
uses: actions/setup-python@v2.2.2
37+
- name: Set up Python
38+
uses: actions/setup-python@v2
3839
with:
39-
python-version: 3.8
40+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
4041

41-
- name: Install diagrams dependencies
42+
- name: Install system dependencies
4243
run: |
4344
sudo apt-get update
44-
sudo apt-get install nodejs npm graphviz
45+
sudo apt-get install -y texlive-latex-extra latexmk nodejs npm graphviz
4546
npm install -g @mermaid-js/mermaid-cli
4647
47-
- name: Build HTML Documentation
48+
- name: Install Python dependencies
4849
run: |
49-
pip install -r requirements_docs.txt --disable-pip-version-check
50-
make -C doc html SPHINXOPTS="-W"
51-
touch doc/build/html/.nojekyll
52-
echo "dev.docs.pyansys.com" > doc/build/html/CNAME
53-
54-
- name: Deploy to gh-pages on main
55-
if: github.ref == 'refs/heads/main'
56-
uses: JamesIves/[email protected]
57-
with:
58-
token: ${{ secrets.github_token }}
59-
branch: gh-pages
60-
folder: doc/build/html
61-
clean: true
62-
single-commit: true
63-
50+
python -m pip install --upgrade pip tox
51+
52+
- name: Build HTML documentation
53+
run: tox -e doc
54+
6455
- name: Build PDF Documentation
6556
run: |
6657
sudo apt update
6758
sudo apt-get install -y texlive-latex-extra latexmk
59+
python -m pip install -r requirements/requirements_doc.txt
6860
make -C doc latexpdf
6961
70-
- name: Upload HTML Documentation
62+
- name: Upload HTML documentation
7163
uses: actions/[email protected]
7264
with:
7365
name: HTML-Documentation
74-
path: doc/build/html
66+
path: .tox/doc_out_html/
7567
retention-days: 7
7668

7769
- name: Upload PDF Documentation
@@ -81,17 +73,27 @@ jobs:
8173
path: doc/build/latex/*.pdf
8274
retention-days: 7
8375

84-
Release:
76+
- name: Deploy to gh-pages
77+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
78+
uses: JamesIves/[email protected]
79+
with:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
BRANCH: gh-pages
82+
FOLDER: .tox/doc_out_html/
83+
CLEAN: true
84+
SINGLE_COMMIT: true
85+
86+
release:
8587
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
86-
needs: docs_build
88+
needs: [style, docs]
8789
runs-on: ubuntu-latest
8890
steps:
8991
- uses: actions/checkout@v2
9092

9193
- name: Set up Python
9294
uses: actions/setup-python@v1
9395
with:
94-
python-version: 3.8
96+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
9597

9698
- uses: actions/download-artifact@v2
9799

.github/workflows/nightly-build.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
name: Nightly Documentation Build
22

3-
43
on:
54
schedule: # UTC at 0400
65
- cron: '0 4 * * */2' # To run every 3 days
76
workflow_dispatch:
87

8+
env:
9+
MAIN_PYTHON_VERSION: '3.10'
10+
911
jobs:
10-
nightly_docs_build:
12+
nightly-docs:
13+
name: Nightly documentation
1114
runs-on: ubuntu-latest
12-
1315
steps:
1416
- uses: actions/checkout@v2
1517

16-
- name: Setup Python
17-
uses: actions/setup-python@v2.2.2
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
1820
with:
19-
python-version: 3.8
21+
python-version: ${{ env.MAIN_PYTHON_VERSION }}
2022

21-
- name: Install mermaid-cli
23+
- name: Install system dependencies
2224
run: |
2325
sudo apt-get update
24-
sudo apt-get install nodejs npm graphviz
26+
sudo apt-get install -y texlive-latex-extra latexmk nodejs npm graphviz
2527
npm install -g @mermaid-js/mermaid-cli
2628
27-
- name: Build HTML Documentation
29+
- name: Install Python dependencies
2830
run: |
29-
pip install -r requirements_docs.txt --disable-pip-version-check
30-
make -C doc html SPHINXOPTS="-W"
31-
touch doc/build/html/.nojekyll
32-
echo "dev.docs.pyansys.com" > doc/build/html/CNAME
33-
31+
python -m pip install --upgrade pip tox
32+
33+
- name: Build HTML documentation
34+
run: tox -e doc
35+
3436
- name: Build PDF Documentation
3537
run: |
3638
sudo apt update
3739
sudo apt-get install -y texlive-latex-extra latexmk
40+
python -m pip install -r requirements/requirements_doc.txt
3841
make -C doc latexpdf
3942
40-
- name: Upload HTML Documentation
43+
- name: Upload HTML documentation
4144
uses: actions/[email protected]
4245
with:
4346
name: HTML-Documentation
44-
path: doc/build/html
47+
path: .tox/doc_out_html/
4548
retention-days: 7
4649

4750
- name: Upload PDF Documentation
@@ -52,10 +55,11 @@ jobs:
5255
retention-days: 7
5356

5457
- name: Deploy to gh-pages
55-
uses: JamesIves/[email protected]
58+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
59+
uses: JamesIves/[email protected]
5660
with:
57-
token: ${{ secrets.github_token }}
58-
branch: gh-pages
59-
folder: doc/build/html
60-
clean: true
61-
single-commit: true
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
BRANCH: gh-pages
63+
FOLDER: .tox/doc_out_html/
64+
CLEAN: true
65+
SINGLE_COMMIT: true

.gitignore

Lines changed: 157 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,165 @@
1-
# Compiled source #
2-
###################
3-
*.pyc
1+
# Created by https://www.toptal.com/developers/gitignore/api/python
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
43

5-
# packages
6-
dist/*
4+
### Python ###
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
79

8-
# Pip generated folders #
9-
#########################
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
share/python-wheels/
1028
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
1132

12-
# Build docs and packages
13-
build/*
14-
doc/build/
15-
.vscode/
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
cover/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
doc/_build/
77+
78+
# PyBuilder
79+
.pybuilder/
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# poetry
102+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103+
# This is especially recommended for binary packages to ensure reproducibility, and is more
104+
# commonly ignored for libraries.
105+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106+
#poetry.lock
16107

17-
# virtual environment
108+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
109+
__pypackages__/
110+
111+
# Celery stuff
112+
celerybeat-schedule
113+
celerybeat.pid
114+
115+
# SageMath parsed files
116+
*.sage.py
117+
118+
# Environments
119+
.env
120+
.venv
121+
env/
18122
venv/
123+
ENV/
124+
env.bak/
125+
venv.bak/
126+
127+
# Spyder project settings
128+
.spyderproject
129+
.spyproject
130+
131+
# Rope project settings
132+
.ropeproject
133+
134+
# mkdocs documentation
135+
/site
136+
137+
# mypy
138+
.mypy_cache/
139+
.dmypy.json
140+
dmypy.json
141+
142+
# Pyre type checker
143+
.pyre/
144+
145+
# pytype static type analyzer
146+
.pytype/
147+
148+
# Cython debug symbols
149+
cython_debug/
150+
151+
# PyCharm
152+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
153+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
154+
# and can be added to the global gitignore or merged into this file. For a more nuclear
155+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
156+
.idea/
157+
158+
# Visual Studio
159+
.vs/
160+
.vscode/
161+
162+
# End of https://www.toptal.com/developers/gitignore/api/python
19163

20-
# sphinx autogen
164+
# Sphinx autogen
21165
doc/source/how-to/api/*

0 commit comments

Comments
 (0)