Skip to content

Commit

Permalink
Add pre-commit (#15)
Browse files Browse the repository at this point in the history
* Add pre-commit

* Update to Python 3.12

* Update pre-commit
  • Loading branch information
giswqs authored Oct 25, 2024
1 parent 3f3c383 commit a0d283a
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 124 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ on:
- master
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build-and-deploy-book:
build-and-deploy:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/maxar_data_catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
- name: setup python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"
- name: Install GDAL
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
python -m pip install --upgrade pip
pip install --no-cache-dir Cython
pip install --find-links=https://girder.github.io/large_image_wheels --no-cache GDAL
- name: Test GDAL installation
run: |
python -c "from osgeo import gdal"
gdalinfo --version
python -c "from osgeo import gdal"
gdalinfo --version
- name: install dependencies
run: |
pip install -r requirements.txt
Expand Down
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
types: [python]
- id: requirements-txt-fixer
- id: check-added-large-files
args: ["--maxkb=500"]

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black-jupyter

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args:
[
"--ignore-words-list=aci,acount,acounts,fallow,ges,hart,hist,nd,ned,ois,wqs,watermask,tre",
"--skip=*.csv,*.geojson,*.json,*.yml*.js,*.html,*cff,*.pdf",
]

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
hooks:
- id: nbstripout
28 changes: 14 additions & 14 deletions examples/maxar_open_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"attachments": {},
"cell_type": "markdown",
"id": "aa6cb20e",
"id": "0",
"metadata": {},
"source": [
"[![image](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/opengeos/maxar-open-data/blob/master/examples/maxar_open_data.ipynb)\n",
Expand All @@ -26,7 +26,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d0c79e4c",
"id": "1",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,7 +36,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "3a64fb57",
"id": "2",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -48,59 +48,59 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5e4c4039",
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"repo = 'https://raw.githubusercontent.com/opengeos/maxar-open-data/master/'"
"repo = \"https://raw.githubusercontent.com/opengeos/maxar-open-data/master/\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "96a0534d",
"id": "4",
"metadata": {},
"outputs": [],
"source": [
"datasets = pd.read_csv(f'{repo}datasets.csv')\n",
"datasets = pd.read_csv(f\"{repo}datasets.csv\")\n",
"datasets"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2795e43b",
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"dataset = 'Kahramanmaras-turkey-earthquake-23'"
"dataset = \"Kahramanmaras-turkey-earthquake-23\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "82615421",
"id": "6",
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(f'{repo}datasets/{dataset}.tsv', sep='\\t')\n",
"df = pd.read_csv(f\"{repo}datasets/{dataset}.tsv\", sep=\"\\t\")\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18f7ffc7",
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"geojson = f'{repo}datasets/{dataset}.geojson'"
"geojson = f\"{repo}datasets/{dataset}.geojson\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c9d39bdb",
"id": "8",
"metadata": {},
"outputs": [],
"source": [
Expand Down
Loading

0 comments on commit a0d283a

Please sign in to comment.