Skip to content

Commit 347e85d

Browse files
Switch to hatchling, and requiring Python 3.9+ (#115)
* Began switching to hatchling, and requiring Python 3.9+. * Upgrade pylint and lint. * Typing linting. * Review suggestions. Co-authored-by: Maxwell G <maxwell@gtmx.me> * Remove leftovers. * Remove old artifacts before building. Co-authored-by: Maxwell G <maxwell@gtmx.me> * Streamline. Co-authored-by: Maxwell G <maxwell@gtmx.me> * Fix dependencies. --------- Co-authored-by: Maxwell G <maxwell@gtmx.me>
1 parent 0d4b174 commit 347e85d

Some content is hidden

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

42 files changed

+660
-527
lines changed

.flake8

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
2+
# https://www.gnu.org/licenses/gpl-3.0.txt)
3+
# SPDX-License-Identifier: GPL-3.0-or-later
4+
# SPDX-FileCopyrightText: 2023 Maxwell G <maxwell@gtmx.me>
5+
6+
[flake8]
7+
extend-ignore = E203
8+
count = true
9+
max-complexity = 10
10+
# black's max-line-length is 89, but it doesn't touch long string literals.
11+
max-line-length = 100
12+
statistics = true

.github/workflows/antsibull-docs.yml

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,24 @@ jobs:
5959
- name: Install dependencies
6060
run: |
6161
python -m pip install --upgrade pip
62-
python -m pip install poetry
63-
sed -i -e 's/^python = .*/python = "^${{ matrix.python }}"/' pyproject.toml
64-
poetry install
65-
poetry update
62+
pip install -e .[coverage] ../antsibull-core
6663
working-directory: antsibull-docs
6764

6865
- name: Use antsibull-docs sphinx-init
6966
run: |
70-
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs sphinx-init --lenient --dest-dir . ${{ matrix.options }}
67+
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs sphinx-init --lenient --dest-dir . ${{ matrix.options }}
7168
working-directory: antsibull-docs
7269

7370
- name: Patch build.sh to supply code coverage
7471
run: |
75-
sed -i build.sh -e 's!antsibull-docs !poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs !g'
76-
sed -i build.sh -e 's!sphinx-build !poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m sphinx.cmd.build !g'
72+
sed -i build.sh -e 's!antsibull-docs !coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs !g'
73+
sed -i build.sh -e 's!sphinx-build !coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m sphinx.cmd.build !g'
7774
cat build.sh
7875
working-directory: antsibull-docs
7976

8077
- name: Install dependencies
8178
run: |
82-
poetry run pip install ansible-core
83-
poetry run pip install -r requirements.txt
79+
pip install ansible-core -r requirements.txt
8480
working-directory: antsibull-docs
8581

8682
- name: Install collections
@@ -93,9 +89,9 @@ jobs:
9389

9490
- name: Lint collection docs
9591
run: |
96-
poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/docker --plugin-docs
97-
poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/crypto
98-
poetry run coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/sensu/sensu_go
92+
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/docker --plugin-docs
93+
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/community/crypto
94+
coverage run -p --source antsibull_docs --source sphinx_antsibull_ext -m antsibull_docs.cli.antsibull_docs lint-collection-docs ~/.ansible/collections/ansible_collections/sensu/sensu_go
9995
working-directory: antsibull-docs
10096
if: contains(matrix.options, '--use-current')
10197

@@ -105,24 +101,29 @@ jobs:
105101
working-directory: antsibull-docs
106102

107103
- name: Validate HTML
108-
run:
109-
python .github/workflows/validate-html.py build/html/
104+
run: |
105+
pip install html5lib
106+
python tests/validate-html.py build/html/
110107
working-directory: antsibull-docs
111108

112109
- name: Test plugin rendering
113-
run:
114-
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs plugin --plugin-type module --dest-dir . community.crypto.acme_account_info
110+
run: |
111+
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs plugin --plugin-type module --dest-dir . community.crypto.acme_account_info
115112
working-directory: antsibull-docs
116113
if: contains(matrix.options, '--use-current')
117114

118-
- name: Combine and upload coverage stats
115+
- name: Combine coverage stats
119116
run: |
120-
poetry run coverage combine .coverage.*
121-
poetry run coverage report
122-
poetry run coverage xml -i
123-
poetry run codecov
117+
coverage combine .coverage.*
118+
coverage report
119+
coverage xml -i
124120
working-directory: antsibull-docs
125121

122+
- name: Upload coverage
123+
uses: codecov/codecov-action@v3
124+
with:
125+
working-directory: antsibull-docs
126+
126127
build-stable:
127128
name: 'Build stable docsite'
128129
runs-on: ubuntu-latest
@@ -147,10 +148,7 @@ jobs:
147148
- name: Install dependencies
148149
run: |
149150
python -m pip install --upgrade pip
150-
python -m pip install poetry
151-
sed -i -e 's/^python = .*/python = "^3.11"/' pyproject.toml
152-
poetry install
153-
poetry update
151+
pip install -e .[coverage] ../antsibull-core
154152
working-directory: antsibull-docs
155153

156154
- name: Get hold of deps file
@@ -161,17 +159,21 @@ jobs:
161159
- name: Build stable docs RST files
162160
run: |
163161
mkdir stable-docs
164-
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs stable --deps-file ansible.deps --dest-dir stable-docs --no-breadcrumbs --no-indexes
162+
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs stable --deps-file ansible.deps --dest-dir stable-docs --no-breadcrumbs --no-indexes
165163
working-directory: antsibull-docs
166164

167-
- name: Combine and upload coverage stats
165+
- name: Combine coverage stats
168166
run: |
169-
poetry run coverage combine .coverage.*
170-
poetry run coverage report
171-
poetry run coverage xml -i
172-
poetry run codecov
167+
coverage combine .coverage.*
168+
coverage report
169+
coverage xml -i
173170
working-directory: antsibull-docs
174171

172+
- name: Upload coverage
173+
uses: codecov/codecov-action@v3
174+
with:
175+
working-directory: antsibull-docs
176+
175177
build-devel:
176178
name: 'Build devel docsite'
177179
runs-on: ubuntu-latest
@@ -196,10 +198,7 @@ jobs:
196198
- name: Install dependencies
197199
run: |
198200
python -m pip install --upgrade pip
199-
python -m pip install poetry
200-
sed -i -e 's/^python = .*/python = "^3.11"/' pyproject.toml
201-
poetry install
202-
poetry update
201+
pip install -e .[coverage] ../antsibull-core
203202
working-directory: antsibull-docs
204203

205204
- name: Get hold of ansible.in file
@@ -210,13 +209,17 @@ jobs:
210209
- name: Build devel docs RST files
211210
run: |
212211
mkdir devel-docs
213-
poetry run coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs devel --pieces-file ansible.in --dest-dir devel-docs
212+
coverage run -p --source antsibull_docs -m antsibull_docs.cli.antsibull_docs devel --pieces-file ansible.in --dest-dir devel-docs
214213
working-directory: antsibull-docs
215214

216-
- name: Combine and upload coverage stats
215+
- name: Combine coverage stats
217216
run: |
218-
poetry run coverage combine .coverage.*
219-
poetry run coverage report
220-
poetry run coverage xml -i
221-
poetry run codecov
217+
coverage combine .coverage.*
218+
coverage report
219+
coverage xml -i
222220
working-directory: antsibull-docs
221+
222+
- name: Upload coverage
223+
uses: codecov/codecov-action@v3
224+
with:
225+
working-directory: antsibull-docs

.github/workflows/nox.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or
3+
# https://www.gnu.org/licenses/gpl-3.0.txt)
4+
# SPDX-License-Identifier: GPL-3.0-or-later
5+
# SPDX-FileCopyrightText: 2023 Maxwell G <maxwell@gtmx.me
6+
7+
name: nox
8+
'on':
9+
push:
10+
branches:
11+
- main
12+
- stable-*
13+
pull_request:
14+
branches:
15+
- main
16+
- stable-*
17+
# Run once per week (Monday at 04:00 UTC)
18+
schedule:
19+
- cron: '0 4 * * 1'
20+
workflow_dispatch:
21+
22+
jobs:
23+
nox-lint:
24+
runs-on: ubuntu-latest
25+
defaults:
26+
run:
27+
working-directory: antsibull-docs
28+
steps:
29+
- name: Check out antsibull-docs
30+
uses: actions/checkout@v3
31+
with:
32+
path: antsibull-docs
33+
- name: Check out dependent project antsibull-core
34+
uses: actions/checkout@v3
35+
with:
36+
repository: ansible-community/antsibull-core
37+
path: antsibull-core
38+
- name: Setup nox
39+
uses: wntrblm/nox@2022.11.21
40+
with:
41+
python-versions: "3.11"
42+
- run: |
43+
nox -v -e lint
44+
nox-test:
45+
runs-on: ubuntu-latest
46+
defaults:
47+
run:
48+
working-directory: antsibull-docs
49+
steps:
50+
- name: Check out antsibull-docs
51+
uses: actions/checkout@v3
52+
with:
53+
path: antsibull-docs
54+
- name: Check out dependent project antsibull-core
55+
uses: actions/checkout@v3
56+
with:
57+
repository: ansible-community/antsibull-core
58+
path: antsibull-core
59+
- name: Setup nox
60+
uses: wntrblm/nox@2022.11.21
61+
with:
62+
python-versions: "3.9, 3.10, 3.11"
63+
- name: Run unit tests
64+
run: |
65+
nox -v -e test
66+
- name: Report coverage
67+
run: |
68+
nox -v -e coverage
69+
- name: Upload coverage
70+
uses: codecov/codecov-action@v3
71+
with:
72+
working-directory: antsibull-docs

.github/workflows/pythonlinters.yml

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

0 commit comments

Comments
 (0)