Skip to content

Commit

Permalink
Add pre-commit hooks (ProjectPythia#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersy005 authored Feb 19, 2021
1 parent bfb392c commit ae97f79
Show file tree
Hide file tree
Showing 14 changed files with 161 additions and 54 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
# - package-ecosystem: pip
# directory: "/"
# schedule:
# interval: daily
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
# Check for updates once a week
interval: 'weekly'
40 changes: 20 additions & 20 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: deploy-book
on:
push:
branches:
- main
- main
# If your git repository has the Jupyter Book within some-subfolder next to
# unrelated files, you can make this run only if a file within that specific
# folder has been modified.
Expand All @@ -17,26 +17,26 @@ jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

# Install dependencies
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
# Install dependencies
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install dependencies
run: |
pip install -r requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
15 changes: 15 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: linting

on:
push:
branches: '*'
pull_request:
branches: '*'

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
9 changes: 4 additions & 5 deletions .github/workflows/preview-book.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_run:
workflows:
- deploy-book
types:
types:
- completed
jobs:
deploy:
Expand All @@ -28,7 +28,7 @@ jobs:
rm -f book.zip
- name: Deploy to Netlify
id: netlify
uses: nwtgck/[email protected].5
uses: nwtgck/[email protected].13
with:
publish-dir: ./_build/html
production-deploy: false
Expand All @@ -37,10 +37,9 @@ jobs:
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
- name: Jupyter Book Preview
uses: ProjectPythia/actions/comment-netlify-preview-in-pr@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy_url: "${{ steps.netlify.outputs.deploy-url }}"


deploy_url: '${{ steps.netlify.outputs.deploy-url }}'
49 changes: 49 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-json
- id: check-yaml
- id: double-quote-string-fixer

- repo: https://github.com/ambv/black
rev: 20.8b1
hooks:
- id: black

- repo: https://github.com/keewis/blackdoc
rev: v0.3.3
hooks:
- id: blackdoc

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
hooks:
- id: flake8

- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier

- repo: https://github.com/nbQA-dev/nbQA
rev: 0.5.7
hooks:
- id: nbqa-black
additional_dependencies: [black==20.8b1]
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.7.3]
- id: nbqa-isort
additional_dependencies: [isort==5.6.4]
3 changes: 3 additions & 0 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tabWidth = 2
semi = false
singleQuote = true
6 changes: 3 additions & 3 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ bibtex_bibfiles:

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

# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
Expand Down
42 changes: 21 additions & 21 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@

- part: Preamble
chapters:
- file: preamble/how-to-use
- file: preamble/how-to-contribute
- file: preamble/how-to-use
- file: preamble/how-to-contribute

- part: Foundational skills
chapters:
- file: foundations/overview
- file: foundations/basic-python
sections:
- file: foundations/Hello
- file: foundations/jupyter
- file: foundations/markdown
- file: foundations/conda
- file: foundations/version-control
sections:
- file: foundations/git
- file: foundations/github
- file: foundations/overview
- file: foundations/basic-python
sections:
- file: foundations/Hello
- file: foundations/jupyter
- file: foundations/markdown
- file: foundations/conda
- file: foundations/version-control
sections:
- file: foundations/git
- file: foundations/github

- part: Core Scientific Python packages
chapters:
- file: core/overview
- file: core/numpy
- file: core/matplotlib
- file: core/cartopy
- file: core/datetime
- file: core/pandas
- file: core/data-formats
- file: core/xarray
- file: core/overview
- file: core/numpy
- file: core/matplotlib
- file: core/cartopy
- file: core/datetime
- file: core/pandas
- file: core/data-formats
- file: core/xarray
2 changes: 1 addition & 1 deletion core/pandas.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
This content is under construction!
```

This section will contain tutorials on using [pandas](https://pandas.pydata.org) for labeled tabular data.
This section will contain tutorials on using [pandas](https://pandas.pydata.org) for labeled tabular data.
2 changes: 1 addition & 1 deletion images/ProjectPythia_Logo_Final-01-Blue-NoText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ae97f79

Please sign in to comment.