Skip to content

Commit

Permalink
feat: Migrate to Jupyter Book (#19)
Browse files Browse the repository at this point in the history
* Use Jupyter Book and deploy book to webpage
   - Remove output from notebooks
* Add dev-requirements.txt
* Add pre-commit hooks for black, pyupgrade, and nbdq
* Update tests of notebooks and update to papermill v2.X API
  • Loading branch information
matthewfeickert authored Nov 6, 2020
1 parent 9399bca commit a87c217
Show file tree
Hide file tree
Showing 27 changed files with 2,744 additions and 2,625 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ jobs:
test:

strategy:
max-parallel: 4
matrix:
platform: [ubuntu-latest, windows-latest]
python-version: [3.6, 3.7]
platform: [ubuntu-latest, macos-latest]
python-version: [3.8]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install --upgrade -q -r binder/requirements.txt
pip list
python -m pip install --upgrade -q -r binder/requirements.txt
python -m pip install --upgrade -q -r dev-requirements.txt
python -m pip list
- name: Lint with flake8
run: |
pip install flake8
python -m pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/deploy-jupyter-book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Jupyter Book

on:
push:
pull_request:

jobs:

deploy-book:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --no-cache-dir -r binder/requirements.txt
python -m pip install --no-cache-dir -r book/requirements.txt
- name: Build the book
run: |
python -c "import matplotlib.pyplot as plt; plt" # Generate fonts
jupyter-book build book/
- name: Deploy Jupyter book to GitHub pages
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: book/_build/html
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
commit_message: Deploy to GitHub pages
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
language_version: python3
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.3
hooks:
- id: pyupgrade
- repo: https://github.com/nbQA-dev/nbQA
rev: 0.4.0
hooks:
- id: nbqa-black
- id: nbqa-pyupgrade
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
all: build

defualt: build

build:
jupyter-book build book/

clean: book/_build
rm -rf book/_build
439 changes: 0 additions & 439 deletions Notebooks/Introductory/Chi-Squared-Distribution.ipynb

This file was deleted.

Loading

0 comments on commit a87c217

Please sign in to comment.