Skip to content

Commit 8a4a042

Browse files
authored
Add pre-commit (#2)
1 parent cc9c6bd commit 8a4a042

File tree

11 files changed

+55
-28
lines changed

11 files changed

+55
-28
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
codespell --skip=".*,.git/*,*.csv,*.geojson,*.json,*.js,*.html,*cff,*.pdf" --ignore-words-list="aci,acount,acounts,fallow,hart,hist,nd,ned,ois,wqs"
2323
- name: Install dependencies
2424
run: pip install mkdocs-material mkdocstrings mkdocs-git-revision-date-plugin mkdocs-jupyter mkdocs-pdf-export-plugin ipykernel
25-
- name: depoly
25+
- name: deploy
2626
run: mkdocs gh-deploy --force
2727
env:
2828
RUN_GITHUB_ACTION: ${{ secrets.RUN_GITHUB_ACTION }}

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-toml
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
types: [python]
9+
- id: trailing-whitespace
10+
- id: requirements-txt-fixer
11+
- id: check-added-large-files
12+
args: ["--maxkb=500"]
13+
14+
- repo: https://github.com/psf/black
15+
rev: 25.1.0
16+
hooks:
17+
- id: black-jupyter
18+
19+
- repo: https://github.com/codespell-project/codespell
20+
rev: v2.4.1
21+
hooks:
22+
- id: codespell
23+
args:
24+
[
25+
"--ignore-words-list=aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre,mape",
26+
"--skip=*.csv,*.geojson,*.json,*.yml*.js,*.html,*cff,*.pdf",
27+
]
28+
29+
- repo: https://github.com/kynan/nbstripout
30+
rev: 0.8.1
31+
hooks:
32+
- id: nbstripout

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Steps to use this template:
99
- Add/remove dependencies in `requirements.txt` if need.
1010
- Add folders (e.g., `chapter_01`) and files (e.g., `intro.ipynb`, `index.md`) to the `docs` folder.
1111
- Open `mkdocs.yml` and make several changes, including `site_name`, `site_url`, `repo_url`, and `nav`. If you don't want the notebooks to be executed when building the website, set `execute: False` under `plugins`.
12-
- Customize the issue template (`.github/ISSUE_TEMPLATE/config.yml`) if needed.
12+
- Customize the issue template (`.github/ISSUE_TEMPLATE/config.yml`) if needed.
1313
- Commit the changes using Git and push changes to GitHub.
14-
- Enable GitHub Pages through GitHub Settings - Pages.
15-
- Check out the website at https://username.github.io/repo-name.
14+
- Enable GitHub Pages through GitHub Settings - Pages.
15+
- Check out the website at https://username.github.io/repo-name.

docs/chapter_01/basemaps.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"outputs": [],
1717
"source": [
1818
"m = leafmap.Map()\n",
19-
"m.add_basemap('HYBRID')\n",
19+
"m.add_basemap(\"HYBRID\")\n",
2020
"m"
2121
]
2222
}
@@ -41,8 +41,7 @@
4141
"nbconvert_exporter": "python",
4242
"pygments_lexer": "ipython3",
4343
"version": "3.9.9"
44-
},
45-
"orig_nbformat": 4
44+
}
4645
},
4746
"nbformat": 4,
4847
"nbformat_minor": 2

docs/chapter_01/intro.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
"nbconvert_exporter": "python",
4141
"pygments_lexer": "ipython3",
4242
"version": "3.9.9"
43-
},
44-
"orig_nbformat": 4
43+
}
4544
},
4645
"nbformat": 4,
4746
"nbformat_minor": 2

docs/chapter_02/colorbar.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"metadata": {},
3434
"outputs": [],
3535
"source": [
36-
"colors = ['006633', 'E5FFCC', '662A00', 'D8D8D8', 'F5F5F5']\n",
36+
"colors = [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"]\n",
3737
"vmin = 0\n",
3838
"vmax = 4000\n",
3939
"\n",
@@ -63,8 +63,7 @@
6363
"nbconvert_exporter": "python",
6464
"pygments_lexer": "ipython3",
6565
"version": "3.9.9"
66-
},
67-
"orig_nbformat": 4
66+
}
6867
},
6968
"nbformat": 4,
7069
"nbformat_minor": 2

docs/chapter_02/heatmap.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"m.add_heatmap(\n",
2929
" filepath,\n",
3030
" latitude=\"latitude\",\n",
31-
" longitude='longitude',\n",
31+
" longitude=\"longitude\",\n",
3232
" value=\"pop_max\",\n",
3333
" name=\"Heat map\",\n",
3434
" radius=20,\n",
@@ -57,8 +57,7 @@
5757
"nbconvert_exporter": "python",
5858
"pygments_lexer": "ipython3",
5959
"version": "3.9.9"
60-
},
61-
"orig_nbformat": 4
60+
}
6261
},
6362
"nbformat": 4,
6463
"nbformat_minor": 2

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Steps to use this template:
99
- Add/remove dependencies in `requirements.txt` if need.
1010
- Add folders (e.g., `chapter_01`) and files (e.g., `intro.ipynb`, `index.md`) to the `docs` folder.
1111
- Open `mkdocs.yml` and make several changes, including `site_name`, `site_url`, `repo_url`, and `nav`. If you don't want the notebooks to be executed when building the website, set `execute: False` under `plugins`.
12-
- Customize the issue template (`.github/ISSUE_TEMPLATE/config.yml`) if needed.
12+
- Customize the issue template (`.github/ISSUE_TEMPLATE/config.yml`) if needed.
1313
- Commit the changes using Git and push changes to GitHub.
14-
- Enable GitHub Pages through GitHub Settings - Pages.
15-
- Check out the website at https://username.github.io/repo-name.
14+
- Enable GitHub Pages through GitHub Settings - Pages.
15+
- Check out the website at https://username.github.io/repo-name.

docs/template.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{
44
"attachments": {},
55
"cell_type": "markdown",
6-
"id": "45382bbe",
6+
"id": "0",
77
"metadata": {},
88
"source": [
99
"[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/giswqs/mkdocs-template/blob/master/docs/template.ipynb)\n",
@@ -13,7 +13,7 @@
1313
{
1414
"cell_type": "code",
1515
"execution_count": null,
16-
"id": "31f7cf26-effb-48c2-a15c-dfa43e34c765",
16+
"id": "1",
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
@@ -23,7 +23,7 @@
2323
{
2424
"cell_type": "code",
2525
"execution_count": null,
26-
"id": "d8398916-b4f5-4c9d-a1db-f8abb800bfeb",
26+
"id": "2",
2727
"metadata": {},
2828
"outputs": [],
2929
"source": []

mkdocs.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ site_url: https://giswqs.github.io/mkdocs-template
55

66
repo_url: https://github.com/giswqs/mkdocs-template
77

8-
copyright: "Copyright © 2022 - 2023 Qiusheng Wu"
8+
copyright: "Copyright © 2022 - 2025 Qiusheng Wu"
99

1010
theme:
1111
palette:
@@ -49,10 +49,10 @@ markdown_extensions:
4949
- toc:
5050
permalink: true
5151

52-
extra:
53-
analytics:
54-
provider: google
55-
property: G-XXX
52+
# extra:
53+
# analytics:
54+
# provider: google
55+
# property: G-XXX
5656

5757
nav:
5858
- Home: index.md
@@ -64,6 +64,5 @@ nav:
6464
- Chapter 2:
6565
- chapter_02/colorbar.ipynb
6666
- chapter_02/heatmap.ipynb
67-
- Blog: https://blog.gishub.org
6867
- YouTube Channel: https://youtube.com/@giswqs
6968
- Report Issues: https://github.com/giswqs/mkdocs-template/issues

0 commit comments

Comments
 (0)