Skip to content

Commit 8739d18

Browse files
committed
Merge branch 'release/v0.7.0'
2 parents 0e929ae + 058c892 commit 8739d18

File tree

150 files changed

+10890
-7446
lines changed

Some content is hidden

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

150 files changed

+10890
-7446
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.6.1
2+
current_version = 0.7.0
33
commit = False
44
tag = False
55
allow_dirty = False

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
Thanks for making a contribution!
33
Please make sure you have read the contributing guide:
4-
https://github.com/appliedAI-Initiative/pyDVL/blob/develop/CONTRIBUTING.md
4+
https://github.com/aai-institute/pyDVL/blob/develop/CONTRIBUTING.md
55
-->
66

77
### Description
@@ -17,4 +17,4 @@ This PR closes #XXX
1717
- [ ] Wrote Unit tests (if necessary)
1818
- [ ] Updated Documentation (if necessary)
1919
- [ ] Updated Changelog
20-
- [ ] If notebooks were added/changed, added boilerplate cells are tagged with `"nbsphinx":"hidden"`
20+
- [ ] If notebooks were added/changed, added boilerplate cells are tagged with `"tags": ["hide"]` or `"tags": ["hide-input"]`
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy Docs
2+
description: Deploy documentation from develop or master branch
3+
inputs:
4+
version:
5+
description: Version number to use
6+
required: true
7+
alias:
8+
description: Alias to use (latest or stable)
9+
required: true
10+
title:
11+
description: Alternative title to use
12+
required: false
13+
default: ''
14+
email:
15+
description: Email to use for git config
16+
required: true
17+
username:
18+
description: Username to use for git config
19+
required: true
20+
set-default:
21+
description: Set alias as the default version
22+
required: false
23+
default: 'false'
24+
runs:
25+
using: "composite"
26+
steps:
27+
- run: |
28+
# https://github.com/jimporter/mike#deploying-via-ci
29+
git fetch origin gh-pages --depth=1
30+
git config --local user.email ${{ inputs.email }}
31+
git config --local user.name ${{ inputs.username }}
32+
shell: bash
33+
- run: |
34+
if [ -z "${{ inputs.title }}" ]
35+
then
36+
mike deploy ${{ inputs.version }} ${{ inputs.alias }} --push --update-aliases
37+
else
38+
mike deploy ${{ inputs.version }} ${{ inputs.alias }} --title=${{ inputs.title }} --push --update-aliases
39+
fi
40+
shell: bash
41+
- if: ${{ inputs.set-default == 'true' }}
42+
run: mike set-default ${{ inputs.alias }}
43+
shell: bash

.github/actions/python/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Setup Python
2+
description: Setup Python on GitHub Actions and install dev and docs requirements.
3+
inputs:
4+
python_version:
5+
description: Python version to use
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Set up Python ${{ inputs.python_version }}
11+
uses: actions/setup-python@v4
12+
with:
13+
python-version: ${{ inputs.python_version }}
14+
cache: 'pip'
15+
cache-dependency-path: |
16+
requirements-dev.txt
17+
requirements-docs.txt
18+
- name: Install Dev & Docs Requirements
19+
run: pip install -r requirements-dev.txt -r requirements-docs.txt
20+
shell: bash

.github/workflows/publish.yaml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: Publish Python Package to PyPI
22

33
on:
4-
push:
5-
tags:
6-
- "v*"
4+
release:
5+
types:
6+
- published
77
workflow_dispatch:
88
inputs:
99
reason:
1010
description: Why did you trigger the pipeline?
1111
required: False
1212
default: Check if it runs again due to external changes
13-
tag:
14-
description: Tag for which a package should be published
13+
tag_name:
14+
description: The name of the tag for which a package should be published
1515
type: string
1616
required: false
1717

@@ -27,22 +27,24 @@ jobs:
2727
- uses: actions/checkout@v3
2828
with:
2929
fetch-depth: 0
30-
- name: Fail if manually triggered workflow does not have 'tag' input
31-
if: github.event_name == 'workflow_dispatch' && inputs.tag == ''
30+
- name: Fail if manually triggered workflow does not have 'tag_name' input
31+
if: github.event_name == 'workflow_dispatch' && inputs.tag_name == ''
3232
run: |
33-
echo "Input 'tag' should not be empty"
33+
echo "Input 'tag_name' should not be empty"
3434
exit -1
3535
- name: Extract branch name from input
3636
id: get_branch_name_input
3737
if: github.event_name == 'workflow_dispatch'
3838
run: |
39-
export BRANCH_NAME=$(git log -1 --format='%D' ${{ inputs.tag }} | sed -e 's/.*origin\/\(.*\).*/\1/')
39+
export BRANCH_NAME=$(git log -1 --format='%D' ${{ inputs.tag_name }} | sed -e 's/.*origin\/\(.*\).*/\1/')
40+
echo "$BRANCH_NAME"
4041
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
4142
- name: Extract branch name from tag
4243
id: get_branch_name_tag
43-
if: github.ref_type == 'tag'
44+
if: github.release.tag_name != ''
4445
run: |
45-
export BRANCH_NAME=$(git log -1 --format='%D' $GITHUB_REF | sed -e 's/.*origin\/\(.*\).*/\1/')
46+
export BRANCH_NAME=$(git log -1 --format='%D' ${{ github.release.tag_name }} | sed -e 's/.*origin\/\(.*\).*/\1/')
47+
echo "$BRANCH_NAME"
4648
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
4749
shell: bash
4850
- name: Fail if tag is not on 'master' branch
@@ -52,19 +54,33 @@ jobs:
5254
echo "Should be on Master branch instead"
5355
exit -1
5456
- name: Fail if running locally
55-
if: ${{ !github.event.act }} # skip during local actions testing
57+
if: ${{ env.ACT }} # skip during local actions testing
5658
run: |
5759
echo "Running action locally. Failing"
5860
exit -1
59-
- name: Set up Python 3.8
60-
uses: actions/setup-python@v4
61+
- name: Setup Python 3.8
62+
uses: ./.github/actions/python
6163
with:
62-
python-version: 3.8
63-
cache: 'pip'
64-
- name: Install Dev Requirements
65-
run: pip install -r requirements-dev.txt
64+
python_version: 3.8
65+
- name: Get Current Version
66+
run: |
67+
export CURRENT_VERSION=$(python setup.py --version --quiet | awk -F. '{print $1"."$2"."$3}')
68+
# Make the version available as env variable for next steps
69+
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
70+
shell: bash
71+
- name: Deploy Docs
72+
uses: ./.github/actions/deploy-docs
73+
with:
74+
version: ${{ env.CURRENT_VERSION }}
75+
alias: latest
76+
title: Latest
77+
email: ${{ env.GITHUB_BOT_EMAIL }}
78+
username: ${{ env.GITHUB_BOT_USERNAME }}
79+
set-default: 'true'
6680
- name: Build and publish to PyPI
6781
env:
6882
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
6983
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
70-
run: tox -e publish-release-package
84+
run: |
85+
python setup.py sdist bdist_wheel
86+
twine upload --verbose --non-interactive dist/*

.github/workflows/run-tests-workflow.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ jobs:
2222
- uses: actions/checkout@v3
2323
with:
2424
fetch-depth: 0
25-
- name: Set up Python ${{ inputs.python_version }}
26-
uses: actions/setup-python@v4
25+
- name: Setup Python ${{ inputs.python_version }}
26+
uses: ./.github/actions/python
2727
with:
28-
python-version: ${{ inputs.python_version }}
29-
cache: 'pip'
30-
- name: Install Dev Requirements
31-
run: pip install -r requirements-dev.txt
28+
python_version: ${{ inputs.python_version }}
3229
- name: Cache Tox Directory for Tests
3330
uses: actions/cache@v3
3431
with:

.github/workflows/tox.yaml

Lines changed: 40 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,60 +16,49 @@ env:
1616
GITHUB_BOT_USERNAME: github-actions[bot]
1717
GITHUB_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
1818
PY_COLORS: 1
19+
MYPY_FORCE_COLOR: 1
20+
PANDOC_VERSION: '3.1.6.2'
1921

2022
jobs:
21-
lint:
23+
code-quality:
2224
name: Lint code and check type hints
2325
runs-on: ubuntu-latest
2426
steps:
2527
- uses: actions/checkout@v3
2628
with:
2729
fetch-depth: 0
28-
- name: Set up Python 3.8
29-
uses: actions/setup-python@v4
30+
- name: Setup Python 3.8
31+
uses: ./.github/actions/python
3032
with:
31-
python-version: 3.8
32-
cache: 'pip'
33-
- name: Install Dev Requirements
34-
run: pip install -r requirements-dev.txt
35-
- name: Cache Tox Directory for Linting
36-
uses: actions/cache@v3
33+
python_version: 3.8
34+
- uses: actions/cache@v3
3735
with:
38-
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
39-
path: .tox
36+
path: ~/.cache/pre-commit
37+
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
4038
- name: Lint Code
41-
run: tox -e linting
39+
run: |
40+
pre-commit run --all --show-diff-on-failure
41+
python build_scripts/run_pylint.py | (pylint-json2html -f jsonextended -o pylint.html)
42+
shell: bash
4243
- name: Check Type Hints
43-
run: tox -e type-checking
44+
run: mypy src/
4445
docs:
4546
name: Build Docs
4647
runs-on: ubuntu-latest
4748
steps:
4849
- uses: actions/checkout@v3
4950
with:
5051
fetch-depth: 0
51-
- name: Set up Python 3.8
52-
uses: actions/setup-python@v4
52+
- name: Setup Python 3.8
53+
uses: ./.github/actions/python
5354
with:
54-
python-version: 3.8
55-
cache: 'pip'
56-
- name: Install Dev Requirements
57-
run: pip install -r requirements-dev.txt
55+
python_version: 3.8
5856
- name: Install Pandoc
59-
run: sudo apt-get install --no-install-recommends --yes pandoc
60-
- name: Cache Tox Directory for Docs
61-
uses: actions/cache@v3
57+
uses: r-lib/actions/setup-pandoc@v2
6258
with:
63-
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
64-
path: .tox
59+
pandoc-version: ${{ env.PANDOC_VERSION }}
6560
- name: Build Docs
66-
run: tox -e docs
67-
- name: Save built docs
68-
uses: actions/upload-artifact@v3
69-
with:
70-
name: docs
71-
path: ./docs/_build
72-
retention-days: 1
61+
run: mkdocs build
7362
base-tests:
7463
strategy:
7564
matrix:
@@ -79,7 +68,7 @@ jobs:
7968
with:
8069
tests_to_run: base
8170
python_version: ${{ matrix.python_version }}
82-
needs: [lint]
71+
needs: [code-quality]
8372
torch-tests:
8473
strategy:
8574
matrix:
@@ -89,7 +78,7 @@ jobs:
8978
with:
9079
tests_to_run: torch
9180
python_version: ${{ matrix.python_version }}
92-
needs: [lint]
81+
needs: [code-quality]
9382
notebook-tests:
9483
strategy:
9584
matrix:
@@ -99,50 +88,41 @@ jobs:
9988
with:
10089
tests_to_run: notebooks
10190
python_version: ${{ matrix.python_version }}
102-
needs: [lint]
91+
needs: [code-quality]
10392
push-docs-and-release-testpypi:
10493
name: Push Docs and maybe release Package to TestPyPI
10594
runs-on: ubuntu-latest
10695
needs: [docs, base-tests, torch-tests, notebook-tests]
96+
if: ${{ github.ref == 'refs/heads/develop' }}
10797
concurrency:
108-
group: push-docs-and-release-testpypi
98+
group: publish
10999
steps:
110100
- uses: actions/checkout@v3
111101
with:
112102
fetch-depth: 0
113-
- name: Set up Python 3.8
114-
uses: actions/setup-python@v4
115-
with:
116-
python-version: 3.8
117-
cache: 'pip'
118-
- name: Install Dev Requirements
119-
run: pip install -r requirements-dev.txt
120-
- name: Cache Tox Directory
121-
uses: actions/cache@v3
103+
- name: Setup Python 3.8
104+
uses: ./.github/actions/python
122105
with:
123-
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
124-
path: .tox
125-
- name: Download built docs
126-
uses: actions/download-artifact@v3
106+
python_version: 3.8
107+
- name: Install Pandoc
108+
uses: r-lib/actions/setup-pandoc@v2
127109
with:
128-
name: docs
129-
path: ./docs/_build
110+
pandoc-version: ${{ env.PANDOC_VERSION }}
130111
- name: Deploy Docs
131-
uses: peaceiris/actions-gh-pages@v3
132-
if: ${{ github.ref == 'refs/heads/develop' }}
112+
uses: ./.github/actions/deploy-docs
133113
with:
134-
github_token: ${{ secrets.GITHUB_TOKEN }}
135-
publish_dir: ./docs/_build/html
136-
user_name: ${{ env.GITHUB_BOT_USERNAME }}
137-
user_email: ${{ env.GITHUB_BOT_EMAIL }}
114+
version: devel
115+
alias: develop
116+
title: Development
117+
email: ${{ env.GITHUB_BOT_EMAIL }}
118+
username: ${{ env.GITHUB_BOT_USERNAME }}
138119
- name: Build and publish to TestPyPI
139-
if: ${{ github.ref == 'refs/heads/develop' }}
140120
env:
141121
TWINE_USERNAME: __token__
142122
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
143123
run: |
144124
set -x
145-
export CURRENT_VERSION=$(python setup.py --version)
146125
export BUILD_NUMBER=$GITHUB_RUN_NUMBER
147-
tox -e bump-dev-version
148-
tox -e publish-test-package
126+
bump2version --no-tag --no-commit --verbose --serialize '\{major\}.\{minor\}.\{patch\}.\{release\}\{$BUILD_NUMBER\}' boguspart
127+
python setup.py sdist bdist_wheel
128+
twine upload -r testpypi --verbose --non-interactive dist/*

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,6 @@ pylint.html
139139
# Saved data
140140
runs/
141141
data/models/
142+
143+
# Docs
144+
docs_build

0 commit comments

Comments
 (0)