Skip to content

Commit

Permalink
Merge pull request #22 from WorldCereal/openeo-refactor
Browse files Browse the repository at this point in the history
#17 Setup Github actions
  • Loading branch information
kvantricht authored Jan 23, 2024
2 parents 699b1d9 + 3b9c048 commit 5c8ed49
Show file tree
Hide file tree
Showing 16 changed files with 510 additions and 774 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint:
name: "Lint: code quality and formatting checks"
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install isort black ruff
- name: isort
run: python -m isort . --check --diff
# - name: black
# run: python -m black --check --diff .
- name: ruff
run: ruff check .
31 changes: 31 additions & 0 deletions .github/workflows/pytest-collect.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Pytest-collect

on:
push:
branches: [ main ]
paths:
- 'tests/**'
pull_request:
branches: [ main ]
paths:
- 'tests/**'

jobs:
pytest-collect:
name: "Pytest: check test collection"
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install .[dev]
- name: "pytest: check test collection"
run: pytest --collect-only
71 changes: 71 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# https://pre-commit.com
default_language_version:
python: python3.10
default_stages: [commit, manual]
fail_fast: true
exclude: "(received/|.*_depr)"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
# - id: check-added-large-files
# args: ['--maxkb=65536']
- id: check-ast
- id: check-builtin-literals
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- id: debug-statements
- id: detect-private-key
- id: mixed-line-ending
- id: trailing-whitespace
types: [python]
- id: end-of-file-fixer
types: [python]
- repo: local
hooks:
- id: shellcheck
name: shellcheck
entry: shellcheck --check-sourced --shell=bash --exclude=SC1087
language: system
types: [shell]
# - id: pydocstyle
# name: pydocstyle
# entry: pydocstyle
# language: system
# types: [python]
# exclude: "(^experiments/|.*_depr)"
# - id: flake8
# name: flake8
# entry: flake8
# language: system
# types: [python]
# exclude: "(^tasks/|.*_depr)"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: no-commit-to-branch
args: [ '--branch', 'main' ]
- repo: https://github.com/radix-ai/auto-smart-commit
rev: v1.0.3
hooks:
- id: auto-smart-commit
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
language_version: python3.9
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: ["--profile", "black"]
8 changes: 3 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
@Library('lib')_

pythonPipeline {
package_name = 'worldcereal'
package_name = 'worldcereal-classification'
wipeout_workspace = true
python_version = ["3.8"]
upload_dev_wheels = true
hadoop = true
python_version = ["3.10"]
upload_dev_wheels = false
pipeline_triggers = [cron('H H(0-6) * * *')]
wheel_repo = 'python-packages-public'
wheel_repo_dev = 'python-packages-public-snapshot'
system_site_packages = 'nope'
pep440 = true
venv_rpm_deps = ['gcc', 'gcc-c++']
extra_env_variables = [
Expand Down
71 changes: 71 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.sdist]
exclude = [
"/dist",
"/notebooks",
"/scripts",
"/bin",
"/tests",
]

[project]
name = "worldcereal"
version = "2.0.1"
authors = [
{ name="Kristof Van Tricht" },
{ name="Jeroen Degerickx" },
{ name="Darius Couchard" },
{ name="Christina Butsko" },
]
description = "WorldCereal classification module"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
dependencies = [
"openeo>=0.22.0",
"xarray>=2022.3.0",
"rioxarray>=0.13.0",
"loguru>=0.7.2",
"h5netcdf>=1.2.0",
"openeo[localprocessing]",
"cftime",
"pytest-depends",
"pyarrow",
"pandas"]

[project.urls]
"Homepage" = "https://github.com/WorldCereal/worldcereal-classification"
"Bug Tracker" = "https://github.com/WorldCereal/worldcereal-classification/issues"

[project.optional-dependencies]
dev = [
"pytest>=7.4.0",
"matplotlib>=3.3.0"
]

[tool.pytest.ini_options]
testpaths = [
"tests",
]
addopts = [
"--import-mode=prepend",
]

[tool.isort]
profile = "black"


[tool.ruff]
# line-length = 100

[tool.ruff.lint]
select = ["E", "F"]
ignore = [
"E501", # Ignore "line-too-long" issues, let black handle that.
]
12 changes: 0 additions & 12 deletions setup.cfg

This file was deleted.

79 changes: 0 additions & 79 deletions setup.py

This file was deleted.

Loading

0 comments on commit 5c8ed49

Please sign in to comment.