Skip to content

Commit

Permalink
Change ruff and add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
charalamm committed Jun 10, 2024
1 parent e442fb2 commit 03d9797
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: ruff_push
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: |
python -m pip install --upgrade pip
pip install ruff
- run: ruff check --output-format=github .
- name: If needed, commit ruff changes to a new pull request
if: failure()
run: |
ruff check --output-format=github --fix .
git config --global user.name github-actions
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git commit -am "fixup! Format Python code with ruff push"
git push --force origin HEAD:$GITHUB_REF
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ See run_efast.py for an example using data located in test_data folder.

1. Clone the repository to your local machine.
2. Navigate to the root directory of the repository in your terminal.
3. [OPTIONAL but recommended] Create a virtual environment: `python3.<your python version> -m venv venv`
3. Install the package: `pip install -e ./`
3. [OPTIONAL but recommended] Create a virtual environment: `python3.<your python version> -m venv .venv`
3. Install the package: `pip install -e .`
4. Run the example: `python run_efast.py`

### Installation
Expand All @@ -67,3 +67,9 @@ pyefast.fusion(
...
)
```

### Develop
1. Clone the repository to your local machine.
2. Navigate to the root directory of the repository in your terminal.
3. [OPTIONAL but strongly recommended] Create a virtual environment: `python3.<your python version> -m venv .venv`
3. Install the package in dev mode: `pip install -e .[dev]`
1 change: 1 addition & 0 deletions pyefast/efast.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import rasterio
import rasterio.windows
import scipy.ndimage

from scipy.interpolate import interp1d
from tqdm import tqdm

Expand Down
2 changes: 2 additions & 0 deletions pyefast/s3_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@

import os
import re

from datetime import datetime

import astropy.convolution as ap
import numpy as np
import pandas as pd
import rasterio
import scipy as sp

from dateutil import rrule
from rasterio import shutil as rio_shutil
from rasterio.enums import Resampling
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ dependencies = [
]

[project.optional-dependencies]
dev = ["ruff"]
dev = [
"ruff",
]

[tool.setuptools.packages.find]
include = ["pyefast"]

[tool.ruff]
line-length = 88
indent-width = 4

[tool.ruff.lint]
select = ["I"]

[tool.ruff.lint.isort]
# Use a single line between direct and from import.
lines-between-types = 1
3 changes: 2 additions & 1 deletion run_efast.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"""

import argparse

from datetime import datetime, timedelta
from pathlib import Path

Expand Down Expand Up @@ -150,5 +151,5 @@ def main(
s2_bands=args.s2_bands,
step=args.step,
mosaic_days=args.mosaic_days,
snap_gpt_path=args.snap_gpt_path
snap_gpt_path=args.snap_gpt_path,
)

0 comments on commit 03d9797

Please sign in to comment.