Skip to content

Commit

Permalink
Merge branch 'develop' into 259-implement-class-wise-shapley
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	docs/30-data-valuation.rst
#	src/pydvl/value/shapley/montecarlo.py
  • Loading branch information
Markus Semmler committed Sep 1, 2023
2 parents 594e2a1 + 62295d4 commit 0bd79d0
Show file tree
Hide file tree
Showing 111 changed files with 5,793 additions and 4,974 deletions.
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
Thanks for making a contribution!
Please make sure you have read the contributing guide:
https://github.com/appliedAI-Initiative/pyDVL/blob/develop/CONTRIBUTING.md
https://github.com/aai-institute/pyDVL/blob/develop/CONTRIBUTING.md
-->

### Description
Expand All @@ -17,4 +17,4 @@ This PR closes #XXX
- [ ] Wrote Unit tests (if necessary)
- [ ] Updated Documentation (if necessary)
- [ ] Updated Changelog
- [ ] If notebooks were added/changed, added boilerplate cells are tagged with `"nbsphinx":"hidden"`
- [ ] If notebooks were added/changed, added boilerplate cells are tagged with `"tags": ["hide"]` or `"tags": ["hide-input"]`
43 changes: 43 additions & 0 deletions .github/actions/deploy-docs/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Docs
description: Deploy documentation from develop or master branch
inputs:
version:
description: Version number to use
required: true
alias:
description: Alias to use (latest or stable)
required: true
title:
description: Alternative title to use
required: false
default: ''
email:
description: Email to use for git config
required: true
username:
description: Username to use for git config
required: true
set-default:
description: Set alias as the default version
required: false
default: 'false'
runs:
using: "composite"
steps:
- run: |
# https://github.com/jimporter/mike#deploying-via-ci
git fetch origin gh-pages --depth=1
git config --local user.email ${{ inputs.email }}
git config --local user.name ${{ inputs.username }}
shell: bash
- run: |
if [ -z "${{ inputs.title }}" ]
then
mike deploy ${{ inputs.version }} ${{ inputs.alias }} --push --update-aliases
else
mike deploy ${{ inputs.version }} ${{ inputs.alias }} --title=${{ inputs.title }} --push --update-aliases
fi
shell: bash
- if: ${{ inputs.set-default == 'true' }}
run: mike set-default ${{ inputs.alias }}
shell: bash
20 changes: 20 additions & 0 deletions .github/actions/python/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Python
description: Setup Python on GitHub Actions and install dev and docs requirements.
inputs:
python_version:
description: Python version to use
required: true
runs:
using: "composite"
steps:
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
cache-dependency-path: |
requirements-dev.txt
requirements-docs.txt
- name: Install Dev & Docs Requirements
run: pip install -r requirements-dev.txt -r requirements-docs.txt
shell: bash
28 changes: 21 additions & 7 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,29 @@ jobs:
run: |
echo "Running action locally. Failing"
exit -1
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
python_version: 3.8
- name: Get Current Version
run: |
export CURRENT_VERSION=$(python setup.py --version --quiet | awk -F. '{print $1"."$2"."$3}')
# Make the version available as env variable for next steps
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
shell: bash
- name: Deploy Docs
uses: ./.github/actions/deploy-docs
with:
version: ${{ env.CURRENT_VERSION }}
alias: latest
title: Latest
email: ${{ env.GITHUB_BOT_EMAIL }}
username: ${{ env.GITHUB_BOT_USERNAME }}
set-default: 'true'
- name: Build and publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: tox -e publish-release-package
run: |
python setup.py sdist bdist_wheel
twine upload --verbose --non-interactive dist/*
9 changes: 3 additions & 6 deletions .github/workflows/run-tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ inputs.python_version }}
uses: actions/setup-python@v4
- name: Setup Python ${{ inputs.python_version }}
uses: ./.github/actions/python
with:
python-version: ${{ inputs.python_version }}
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
python_version: ${{ inputs.python_version }}
- name: Cache Tox Directory for Tests
uses: actions/cache@v3
with:
Expand Down
100 changes: 40 additions & 60 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,49 @@ env:
GITHUB_BOT_USERNAME: github-actions[bot]
GITHUB_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
PY_COLORS: 1
MYPY_FORCE_COLOR: 1
PANDOC_VERSION: '3.1.6.2'

jobs:
lint:
code-quality:
name: Lint code and check type hints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Cache Tox Directory for Linting
uses: actions/cache@v3
python_version: 3.8
- uses: actions/cache@v3
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
path: ~/.cache/pre-commit
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint Code
run: tox -e linting
run: |
pre-commit run --all --show-diff-on-failure
python build_scripts/run_pylint.py | (pylint-json2html -f jsonextended -o pylint.html)
shell: bash
- name: Check Type Hints
run: tox -e type-checking
run: mypy src/
docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
python_version: 3.8
- name: Install Pandoc
run: sudo apt-get install --no-install-recommends --yes pandoc
- name: Cache Tox Directory for Docs
uses: actions/cache@v3
uses: r-lib/actions/setup-pandoc@v2
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Build Docs
run: tox -e docs
- name: Save built docs
uses: actions/upload-artifact@v3
with:
name: docs
path: ./docs/_build
retention-days: 1
run: mkdocs build
base-tests:
strategy:
matrix:
Expand All @@ -79,7 +68,7 @@ jobs:
with:
tests_to_run: base
python_version: ${{ matrix.python_version }}
needs: [lint]
needs: [code-quality]
torch-tests:
strategy:
matrix:
Expand All @@ -89,7 +78,7 @@ jobs:
with:
tests_to_run: torch
python_version: ${{ matrix.python_version }}
needs: [lint]
needs: [code-quality]
notebook-tests:
strategy:
matrix:
Expand All @@ -99,50 +88,41 @@ jobs:
with:
tests_to_run: notebooks
python_version: ${{ matrix.python_version }}
needs: [lint]
needs: [code-quality]
push-docs-and-release-testpypi:
name: Push Docs and maybe release Package to TestPyPI
runs-on: ubuntu-latest
needs: [docs, base-tests, torch-tests, notebook-tests]
if: ${{ github.ref == 'refs/heads/develop' }}
concurrency:
group: push-docs-and-release-testpypi
group: publish
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
- name: Install Dev Requirements
run: pip install -r requirements-dev.txt
- name: Cache Tox Directory
uses: actions/cache@v3
- name: Setup Python 3.8
uses: ./.github/actions/python
with:
key: tox-${{ github.ref }}-${{ runner.os }}-${{ hashFiles('tox.ini') }}
path: .tox
- name: Download built docs
uses: actions/download-artifact@v3
python_version: 3.8
- name: Install Pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
name: docs
path: ./docs/_build
pandoc-version: ${{ env.PANDOC_VERSION }}
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/develop' }}
uses: ./.github/actions/deploy-docs
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
user_name: ${{ env.GITHUB_BOT_USERNAME }}
user_email: ${{ env.GITHUB_BOT_EMAIL }}
version: devel
alias: develop
title: Development
email: ${{ env.GITHUB_BOT_EMAIL }}
username: ${{ env.GITHUB_BOT_USERNAME }}
- name: Build and publish to TestPyPI
if: ${{ github.ref == 'refs/heads/develop' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
set -x
export CURRENT_VERSION=$(python setup.py --version)
export BUILD_NUMBER=$GITHUB_RUN_NUMBER
tox -e bump-dev-version
tox -e publish-test-package
bump2version --no-tag --no-commit --verbose --serialize '\{major\}.\{minor\}.\{patch\}.\{release\}\{$BUILD_NUMBER\}' boguspart
python setup.py sdist bdist_wheel
twine upload -r testpypi --verbose --non-interactive dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@ pylint.html
# Saved data
runs/
data/models/

# Docs
docs_build
Loading

0 comments on commit 0bd79d0

Please sign in to comment.