Skip to content

Commit a1989c6

Browse files
authored
Merge branch 'main' into feature/#409-Doc-link-&-checks
2 parents 800e2d4 + 097f0be commit a1989c6

File tree

32 files changed

+328
-168
lines changed

32 files changed

+328
-168
lines changed

.github/actions/python-environment/action.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'SPPE'
2-
description: 'Setup python and poetry environment'
2+
description: 'Set up python and poetry environment'
33

44
inputs:
55

@@ -15,25 +15,47 @@ inputs:
1515

1616
working-directory:
1717
description: 'Working directory to use'
18-
required: true
18+
required: false
1919
default: "."
2020

21+
extras:
22+
description: 'Comma-separated list of extras'
23+
required: false
24+
25+
use-cache:
26+
description: 'Use cache for poetry environment'
27+
required: false
28+
default: 'true'
29+
2130
runs:
2231

2332
using: "composite"
2433
steps:
2534

26-
- name: Setup Poetry (${{ inputs.poetry-version }})
35+
- name: Set up pipx if not present
36+
shell: bash
37+
run: |
38+
python3 -m pip install --upgrade pipx
39+
python3 -m pipx ensurepath
40+
echo "$HOME/.local/bin" >> $GITHUB_PATH
41+
42+
- name: Set up Poetry (${{ inputs.poetry-version }})
2743
shell: bash
2844
run: pipx install poetry==${{ inputs.poetry-version }}
2945

30-
- name: Setup Python (${{ inputs.python-version}})
46+
- name: Set up Python (${{ inputs.python-version}})
3147
uses: actions/setup-python@v5
3248
with:
3349
python-version: ${{ inputs.python-version }}
34-
cache: 'poetry'
50+
cache: ${{ inputs.use-cache == 'true' && 'poetry' || '' }}
3551

36-
- name: Poetry install
52+
- name: Poetry install with extras
3753
working-directory: ${{ inputs.working-directory }}
3854
shell: bash
39-
run: poetry install
55+
run: |
56+
EXTRAS=$(echo "${{ inputs.extras }}" | tr -d ' ')
57+
if [[ -n "$EXTRAS" ]]; then
58+
poetry install --extras "$EXTRAS"
59+
else
60+
poetry install
61+
fi

.github/actions/security-issues/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ runs:
3939
- name: Install Python Toolbox / Security tool
4040
shell: bash
4141
run: |
42-
pip install exasol-toolbox==1.1.0
42+
pip install exasol-toolbox==1.2.0
4343
4444
- name: Create Security Issue Report
4545
shell: bash

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: ./.github/actions/python-environment
2121

2222
- name: Check Version(s)
23-
run: poetry run -- nox -s version:check -- `poetry run -- python -c "from noxconfig import PROJECT_CONFIG; print(PROJECT_CONFIG.version_file)"`
23+
run: poetry run -- nox -s version:check
2424

2525
Documentation:
2626
name: Docs

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- name: Build Documentation
2323
run: |
2424
poetry run -- nox -s docs:multiversion
25+
rm -r .html-documentation/*/.doctrees
2526
2627
- name: Upload artifact
2728
uses: actions/upload-pages-artifact@v3

doc/changes/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
* [unreleased](unreleased.md)
4+
* [1.2.0](changes_1.2.0.md)
45
* [1.1.0](changes_1.1.0.md)
56
* [1.0.1](changes_1.0.1.md)
67
* [1.0.0](changes_1.0.0.md)
@@ -33,6 +34,7 @@
3334
hidden:
3435
---
3536
unreleased
37+
changes_1.2.0
3638
changes_1.1.0
3739
changes_1.0.1
3840
changes_1.0.0

doc/changes/changes_1.2.0.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# 1.2.0 - 2025-05-20
2+
3+
## Summary
4+
5+
With #420, any GitHub repos using the PTB for **documentation** will also need to
6+
reconfigure the GitHub Pages settings for each repo:
7+
1. Go to the affected repo's GitHub page
8+
2. Select 'Settings'
9+
3. Scroll down & select 'Pages'
10+
4. Within the 'Build and deployment' section, change 'Source' to 'GitHub Actions'.
11+
12+
This should also create a 'github-pages' environment, if it does not yet exist.
13+
For most repos using the PTB, the updating of the github pages only happens when a
14+
PR is merged to main, so please check post-merge that it worked as expected.
15+
16+
With #422, we have hardened the security in our GitHub workflows by explicitly
17+
setting permissions to the default GitHub token. In a few repos who greatly differ
18+
from the default PTB setup, this might lead to small issues which require the allowed
19+
permissions to be increased for specific jobs.
20+
21+
## ⚒️ Refactorings
22+
23+
* [#412](https://github.com/exasol/python-toolbox/issues/392): Refactored pre commit hook package version.py into nox task
24+
25+
## Security
26+
27+
* [#420](https://github.com/exasol/python-toolbox/issues/420): Replaced 3rd party action with GitHub actions for gh-pages
28+
* [#422](https://github.com/exasol/python-toolbox/issues/422): Set permissions within the GitHub workflows to restrict usage of the default GitHub token
29+
30+
## ✨ Features
31+
32+
* [#161](https://github.com/exasol/python-toolbox/issues/161): Added support for installing extras & not using a cache to the python-environment action
33+
* [#408](https://github.com/exasol/python-toolbox/issues/408): Added support for GitHub runners who do not per default have pipx to use the python-environment action
34+
* [#433](https://github.com/exasol/python-toolbox/issues/433): Removed directory .html-documentation/.doctrees after creating documentation
35+
* [#436](https://github.com/exasol/python-toolbox/issues/436): Updated template for new projects to poetry 2.x
36+
37+
## Bugfixes
38+
39+
* [#428](https://github.com/exasol/python-toolbox/issues/428): Fixed detecting report coverage failures
40+
* [#434](https://github.com/exasol/python-toolbox/issues/434): Adapted template so new projects do not fail from lint errors

doc/changes/unreleased.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,12 @@
22

33
## Summary
44

5-
With #420, any GitHub repos using the PTB for **documentation** will also need to
6-
reconfigure the GitHub Pages settings for each repo:
7-
1. Go to the affected repo's GitHub page
8-
2. Select 'Settings'
9-
3. Scroll down & select 'Pages'
10-
4. Within the 'Build and deployment' section, change 'Source' to 'GitHub Actions'.
5+
With #441, please ensure that the location of the `version.py` is given for `Config.version_file`,
6+
which is specified in the `noxconfig.py`
117

12-
This should also create a 'github-pages' environment, if it does not yet exist.
13-
For most repos using the PTB, the updating of the github pages only happens when a
14-
PR is merged to main, so please check post-merge that it worked as expected.
8+
## 📚 Documentation
9+
* Updated getting_started.rst for allowing tag-based releases
1510

16-
With #422, we have hardened the security in our GitHub workflows by explicitly
17-
setting permissions to the default GitHub token. In a few repos who greatly differ
18-
from the default PTB setup, this might lead to small issues which require the allowed
19-
permissions to be increased for specific jobs.
11+
## ✨ Features
2012

21-
## ⚒️ Refactorings
22-
23-
* [#412](https://github.com/exasol/python-toolbox/issues/392): Refactored pre commit hook package version.py into nox task
24-
25-
## Security
26-
27-
* [#420](https://github.com/exasol/python-toolbox/issues/420): Replaced 3rd party action with GitHub actions for gh-pages
28-
* [#422](https://github.com/exasol/python-toolbox/issues/422): Set permissions within the GitHub workflows to restrict usage of the default GitHub token
13+
* [#441](https://github.com/exasol/python-toolbox/issues/441): Switched nox task for `version:check` to use the config value of `version_file` to specify the location of the `version.py`

doc/github_actions/python_environment.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ Parameters
1919
- Poetry version to use
2020
- True
2121
- 2.1.2
22+
* - working-directory
23+
- Working directory to use
24+
- False
25+
- .
26+
* - extras
27+
- Comma-separated list of extras
28+
- False
29+
- (not used by default)
30+
* - use-cache
31+
- Use cache for poetry environment
32+
- False
33+
- true
2234

2335
Example Usage
2436
-------------
@@ -40,9 +52,12 @@ Example Usage
4052
uses: actions/checkout@v4
4153
4254
- name: Setup Python & Poetry Environment
43-
uses: exasol/python-toolbox/.github/actions/python-environment@0.21.0
55+
uses: exasol/python-toolbox/.github/actions/python-environment@1.1.0
4456
with:
4557
python-version: 3.12
4658
poetry-version: 2.1.2
59+
working-directory: pytest-backend
60+
use-cache: false
61+
extras: 'numpy,pandas'
4762
4863
...

doc/user_guide/getting_started.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,22 @@ forward, and you just can use the example *noxfile.py* below.
186186
Within the `gh-pages.yml`, we use the GitHub `upload-pages-artifact` and `deploy-pages`
187187
actions. In order to properly deploy your pages, you'll need to reconfigure the GitHub
188188
Pages settings for the repo:
189+
189190
1. Go to the affected repo's GitHub page
190191
2. Select 'Settings'
191192
3. Scroll down & select 'Pages'
192193
4. Within the 'Build and deployment' section, change 'Source' to 'GitHub Actions'.
193194

195+
We also need to configure settings for github-pages environment:
196+
197+
1. Go to the affected repo's GitHub page
198+
2. Select 'Settings'
199+
3. Scroll down & select 'Environment'
200+
4. Click on 'github-pages'
201+
5. In the 'Deployment branches and tags', click 'Add deployment branch or tag rule'
202+
6. Select 'Ref type' to be 'Tag' and set the 'Name pattern' to `[0-9]*.[0-9]*.[0-9]*` (or whatever matches that repo's tags)
203+
204+
194205
8. Go 🥜
195206
+++++++++++++
196207
You are ready to use the toolbox. With *nox -l* you can list all available tasks.

exasol/toolbox/metrics.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,20 @@ def total_coverage(file: Union[str, Path]) -> float:
112112
encoding="utf-8",
113113
)
114114
stdout = p.stdout.strip()
115-
if (p.returncode == 1) and (stdout == "No data to report."):
116-
print(
115+
116+
if p.returncode != 0:
117+
message = (
117118
f"The following command"
118119
f" returned non-zero exit status {p.returncode}:\n"
119120
f' {" ".join(p.args)}\n'
120-
f"{stdout}\n"
121-
"Returning total coverage 100 %.",
122-
file=sys.stderr,
121+
f"{stdout}"
123122
)
124-
return 100.0
123+
if (p.returncode == 1) and (stdout == "No data to report."):
124+
print(f"{message}\nReturning total coverage 100 %.", file=sys.stderr)
125+
return 100.0
126+
else:
127+
raise RuntimeError(message)
128+
125129
with open(report, encoding="utf-8") as r:
126130
data = json.load(r)
127131
total: float = data["totals"]["percent_covered"]

0 commit comments

Comments
 (0)