Skip to content

Commit ae97f79

Browse files
authored
Add pre-commit hooks (#8)
1 parent bfb392c commit ae97f79

14 files changed

+161
-54
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# - package-ecosystem: pip
4+
# directory: "/"
5+
# schedule:
6+
# interval: daily
7+
- package-ecosystem: 'github-actions'
8+
directory: '/'
9+
schedule:
10+
# Check for updates once a week
11+
interval: 'weekly'

.github/workflows/deploy.yaml

+20-20
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: deploy-book
44
on:
55
push:
66
branches:
7-
- main
7+
- main
88
# If your git repository has the Jupyter Book within some-subfolder next to
99
# unrelated files, you can make this run only if a file within that specific
1010
# folder has been modified.
@@ -17,26 +17,26 @@ jobs:
1717
deploy-book:
1818
runs-on: ubuntu-latest
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v2
2121

22-
# Install dependencies
23-
- name: Set up Python 3.7
24-
uses: actions/setup-python@v1
25-
with:
26-
python-version: 3.7
22+
# Install dependencies
23+
- name: Set up Python 3.7
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: 3.7
2727

28-
- name: Install dependencies
29-
run: |
30-
pip install -r requirements.txt
28+
- name: Install dependencies
29+
run: |
30+
pip install -r requirements.txt
3131
32-
# Build the book
33-
- name: Build the book
34-
run: |
35-
jupyter-book build .
32+
# Build the book
33+
- name: Build the book
34+
run: |
35+
jupyter-book build .
3636
37-
# Push the book's HTML to github-pages
38-
- name: GitHub Pages action
39-
uses: peaceiris/[email protected]
40-
with:
41-
github_token: ${{ secrets.GITHUB_TOKEN }}
42-
publish_dir: ./_build/html
37+
# Push the book's HTML to github-pages
38+
- name: GitHub Pages action
39+
uses: peaceiris/[email protected]
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
publish_dir: ./_build/html

.github/workflows/linting.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: linting
2+
3+
on:
4+
push:
5+
branches: '*'
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
linting:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
- uses: pre-commit/[email protected]

.github/workflows/preview-book.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
workflow_run:
44
workflows:
55
- deploy-book
6-
types:
6+
types:
77
- completed
88
jobs:
99
deploy:
@@ -28,7 +28,7 @@ jobs:
2828
rm -f book.zip
2929
- name: Deploy to Netlify
3030
id: netlify
31-
uses: nwtgck/[email protected].5
31+
uses: nwtgck/[email protected].13
3232
with:
3333
publish-dir: ./_build/html
3434
production-deploy: false
@@ -37,10 +37,9 @@ jobs:
3737
env:
3838
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
3939
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
40+
timeout-minutes: 5
4041
- name: Jupyter Book Preview
4142
uses: ProjectPythia/actions/comment-netlify-preview-in-pr@main
4243
with:
4344
github-token: ${{ secrets.GITHUB_TOKEN }}
44-
deploy_url: "${{ steps.netlify.outputs.deploy-url }}"
45-
46-
45+
deploy_url: '${{ steps.netlify.outputs.deploy-url }}'

.pre-commit-config.yaml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-docstring-first
8+
- id: check-json
9+
- id: check-yaml
10+
- id: double-quote-string-fixer
11+
12+
- repo: https://github.com/ambv/black
13+
rev: 20.8b1
14+
hooks:
15+
- id: black
16+
17+
- repo: https://github.com/keewis/blackdoc
18+
rev: v0.3.3
19+
hooks:
20+
- id: blackdoc
21+
22+
- repo: https://gitlab.com/pycqa/flake8
23+
rev: 3.8.4
24+
hooks:
25+
- id: flake8
26+
27+
- repo: https://github.com/asottile/seed-isort-config
28+
rev: v2.2.0
29+
hooks:
30+
- id: seed-isort-config
31+
- repo: https://github.com/pre-commit/mirrors-isort
32+
rev: v5.7.0
33+
hooks:
34+
- id: isort
35+
36+
- repo: https://github.com/pre-commit/mirrors-prettier
37+
rev: v2.2.1
38+
hooks:
39+
- id: prettier
40+
41+
- repo: https://github.com/nbQA-dev/nbQA
42+
rev: 0.5.7
43+
hooks:
44+
- id: nbqa-black
45+
additional_dependencies: [black==20.8b1]
46+
- id: nbqa-pyupgrade
47+
additional_dependencies: [pyupgrade==2.7.3]
48+
- id: nbqa-isort
49+
additional_dependencies: [isort==5.6.4]

.prettierrc.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tabWidth = 2
2+
semi = false
3+
singleQuote = true

_config.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ bibtex_bibfiles:
2121

2222
# Information about where the book exists on the web
2323
repository:
24-
url: https://github.com/ProjectPythia/pythia-foundations # Online location of your book
24+
url: https://github.com/ProjectPythia/pythia-foundations # Online location of your book
2525
#path_to_book: docs # Optional path to your book, relative to the repository root
26-
branch: main # Which branch of the repository should be used when creating links (optional)
26+
branch: main # Which branch of the repository should be used when creating links (optional)
2727
# Configure your Binder links, such as the URL of the BinderHub.
2828
launch_buttons:
29-
binderhub_url : https://mybinder.org
29+
binderhub_url: https://mybinder.org
3030

3131
# Add GitHub buttons to your book
3232
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository

_toc.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55

66
- part: Preamble
77
chapters:
8-
- file: preamble/how-to-use
9-
- file: preamble/how-to-contribute
8+
- file: preamble/how-to-use
9+
- file: preamble/how-to-contribute
1010

1111
- part: Foundational skills
1212
chapters:
13-
- file: foundations/overview
14-
- file: foundations/basic-python
15-
sections:
16-
- file: foundations/Hello
17-
- file: foundations/jupyter
18-
- file: foundations/markdown
19-
- file: foundations/conda
20-
- file: foundations/version-control
21-
sections:
22-
- file: foundations/git
23-
- file: foundations/github
13+
- file: foundations/overview
14+
- file: foundations/basic-python
15+
sections:
16+
- file: foundations/Hello
17+
- file: foundations/jupyter
18+
- file: foundations/markdown
19+
- file: foundations/conda
20+
- file: foundations/version-control
21+
sections:
22+
- file: foundations/git
23+
- file: foundations/github
2424

2525
- part: Core Scientific Python packages
2626
chapters:
27-
- file: core/overview
28-
- file: core/numpy
29-
- file: core/matplotlib
30-
- file: core/cartopy
31-
- file: core/datetime
32-
- file: core/pandas
33-
- file: core/data-formats
34-
- file: core/xarray
27+
- file: core/overview
28+
- file: core/numpy
29+
- file: core/matplotlib
30+
- file: core/cartopy
31+
- file: core/datetime
32+
- file: core/pandas
33+
- file: core/data-formats
34+
- file: core/xarray

core/pandas.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
This content is under construction!
55
```
66

7-
This section will contain tutorials on using [pandas](https://pandas.pydata.org) for labeled tabular data.
7+
This section will contain tutorials on using [pandas](https://pandas.pydata.org) for labeled tabular data.

images/ProjectPythia_Logo_Final-01-Blue-NoText.svg

+1-1
Loading

0 commit comments

Comments
 (0)