Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example project #25

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
dbddb98
add example for deprecated locations and new projects and add new lin…
anikaweinmann Dec 9, 2024
e0c3e6c
start linting
anikaweinmann Dec 9, 2024
f268951
further linting
anikaweinmann Dec 9, 2024
6eb5a69
further linting
anikaweinmann Dec 9, 2024
8bd4496
pylint
anikaweinmann Dec 9, 2024
3558b09
Docker and bash linting
anikaweinmann Dec 9, 2024
8598fc0
further linting
anikaweinmann Dec 9, 2024
601eedf
further ruff
anikaweinmann Dec 12, 2024
d916e13
merge main
anikaweinmann Dec 12, 2024
78a78d9
merge main
anikaweinmann Dec 12, 2024
51841b8
merge
anikaweinmann Dec 12, 2024
fd5994e
changes
anikaweinmann Dec 12, 2024
446e487
Apply suggestions from code review
anikaweinmann Dec 12, 2024
2f4e08c
Apply suggestions from code review
anikaweinmann Dec 12, 2024
bf29a0e
docker lint
anikaweinmann Dec 12, 2024
fca6939
exclude VALIDATE_BASH_EXEC
anikaweinmann Dec 12, 2024
9c5ef63
fixes
anikaweinmann Dec 12, 2024
61b786d
further ruff
anikaweinmann Dec 12, 2024
5f61b84
try fix ruff
anikaweinmann Dec 12, 2024
45c96fa
ruff
anikaweinmann Dec 12, 2024
647a6d3
black
anikaweinmann Dec 12, 2024
4f9af57
changed
anikaweinmann Dec 12, 2024
97342a6
further ruff
anikaweinmann Dec 12, 2024
404a42f
other linting
anikaweinmann Dec 12, 2024
fde77ac
Apply suggestions from code review
anikaweinmann Dec 12, 2024
5f16651
VALIDATE_BASH_EXEC
anikaweinmann Dec 13, 2024
682e050
ruff --fix
mmacata Dec 13, 2024
3e6d204
make script executable
mmacata Dec 13, 2024
1efaf43
enhance workflows
mmacata Dec 13, 2024
72ecfb7
ruff ANN001 + D104
anikaweinmann Dec 19, 2024
093ab14
ruff: RUF012
anikaweinmann Dec 19, 2024
31ea4ea
ruff: RUF012 + I001
anikaweinmann Dec 19, 2024
8506a78
ruff: N816
anikaweinmann Dec 19, 2024
61c2494
ruff: PLR2004
anikaweinmann Dec 19, 2024
a68b194
ruff: PLW0603
anikaweinmann Dec 19, 2024
af521c3
ruff
anikaweinmann Dec 19, 2024
f1628b9
ruff
anikaweinmann Dec 19, 2024
bff7231
linting
anikaweinmann Dec 19, 2024
09a65ea
linting
anikaweinmann Dec 19, 2024
dddbcba
flake8 config
anikaweinmann Dec 19, 2024
734f781
add projects endpoint tests
anikaweinmann Dec 19, 2024
4126828
fix setup files
anikaweinmann Dec 19, 2024
696058e
working with actinia-docker setup
anikaweinmann Dec 20, 2024
1bc57bc
add deprecation decorator
anikaweinmann Dec 20, 2024
4d9dfd4
setup.cfg
anikaweinmann Dec 20, 2024
893d5ee
ruff
anikaweinmann Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@
# E501 line too long (83 > 79 characters)

exclude = .git,.pycache,build,.eggs

per-file-ignores =
./src/actinia_example_plugin/wsgi.py: F401
./tests/test_resource_base.py: F401
25 changes: 0 additions & 25 deletions .github/workflows/black.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/flake8.yml

This file was deleted.

16 changes: 6 additions & 10 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
---
name: Linting and code quality check

on: [push, pull_request]
on:
push:
branches:
- main
- develop
pull_request:

jobs:
lint:
uses: mundialis/github-workflows/.github/workflows/linting.yml@main
# with:
# # set pylint-version to empty string to skip the pylint workflow
# pylint-version: ''
# BASH_SEVERITY: 'warning'
# VALIDATE_DOCKERFILE_HADOLINT: false
# VALIDATE_JSON: false
# VALIDATE_HTML: false
# VALIDATE_CSS: false
# VALIDATE_BASH_EXEC: false
43 changes: 7 additions & 36 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,13 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Upload Python Package to test PyPI

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python3 -m build --outdir build .
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: build/*.whl

# - name: Publish package
# uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
publish-python:
uses: mundialis/github-workflows/.github/workflows/python-publish.yml@main
with:
test_pypi: true
secrets:
PYPI_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
37 changes: 0 additions & 37 deletions .github/workflows/super-linter.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---

name: actinia tests

on:
Expand All @@ -14,8 +16,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
# with:
# path: "."
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Replace run only unittest command
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ sdist/*
# docker
docker/redis_data/dump.rdb
!docker/actinia-example-plugin-test/actinia-example-plugin-test.cfg

# linting with shared config file
.pylintrc
.pylintrc_allowed_to_fail
ruff-github-workflows.toml
ruff-merged.toml
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: |
(?x)^(
.*\.ref$|
.*\.svg$|
build/|
dist/|
src/actinia_core.egg-info/
)
- id: end-of-file-fixer
exclude: |
(?x)^(
.*\.ref$|
.*\.svg$|
build/|
dist/|
src/actinia_core.egg-info/
)
- repo: https://github.com/mundialis/github-workflows
rev: 1.4.0
hooks:
- id: linting
14 changes: 9 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
FROM mundialis/actinia-core:latest
FROM mundialis/actinia-core:5.0.0

# pwgen is needed for the tests
RUN pip3 install pwgen
RUN pip3 install --no-cache-dir pwgen==0.8.2.post0

COPY docker/actinia.cfg /etc/default/actinia
COPY src /src/actinia-example-plugin/src/
COPY setup.cfg /src/actinia-example-plugin/
COPY setup.py /src/actinia-example-plugin/
COPY requirements.txt /src/actinia-example-plugin/

RUN pip3 install -r /src/actinia-example-plugin/requirements.txt
RUN pip3 uninstall actinia-example-plugin.wsgi -y
RUN pip3 install --no-cache-dir -r /src/actinia-example-plugin/requirements.txt && \
pip3 uninstall actinia-example-plugin.wsgi -y
# SETUPTOOLS_SCM_PRETEND_VERSION is only needed if in the plugin folder is no
# .git folder
ENV SETUPTOOLS_SCM_PRETEND_VERSION=0.0
RUN (cd /src/actinia-example-plugin && python3 setup.py install)

WORKDIR /src/actinia-example-plugin
RUN python3 setup.py install

WORKDIR /src/actinia_core
13 changes: 6 additions & 7 deletions docker/actinia-example-plugin-test/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM mundialis/actinia-core:latest as actinia_test
FROM mundialis/actinia-core:5.0.0 as actinia_test

LABEL authors="Carmen Tawalika,Anika Weinmann"
LABEL maintainer="[email protected],[email protected]"

ENV ACTINIA_CUSTOM_TEST_CFG /etc/default/actinia-example-plugin-test
ENV ACTINIA_CUSTOM_TEST_CFG=/etc/default/actinia-example-plugin-test

# TODO do not set DEFAULT_CONFIG_PATH if this is fixed
ENV DEFAULT_CONFIG_PATH /etc/default/actinia-example-plugin-test
ENV DEFAULT_CONFIG_PATH=/etc/default/actinia-example-plugin-test

# install things only for tests
RUN apk add redis
RUN pip3 install iniconfig colorlog pwgen
RUN apk add --no-cache redis==7.0.15-r1 && \
pip3 install --no-cache-dir iniconfig==2.0.0 colorlog==6.8.2 pwgen==0.8.2.post0

# COPY docker/actinia-example-plugin-test/start.sh /src/start.sh

Expand All @@ -31,7 +31,6 @@ COPY . /src/actinia-example-plugin/

WORKDIR /src/actinia-example-plugin/

RUN chmod a+x tests_with_redis.sh
RUN make install
RUN chmod a+x tests_with_redis.sh && make install

# RUN make test
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "actinia-example-plugin"
version = "1.0.0"
description = "An actinia-core plugin which adds example endpoints to actinia-core"
readme = "README.md"
authors = [
{ name = "Carmen Tawalika"},
{ name = "Anika Weinmann"},
]
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
]
requires-python = ">=3.8"
keywords = [
"processing",
"earth observation",
"cloud-based processing",
"rest api",
"gis",
"grass gis",
"osgeo",
"example",
]
dependencies = [
"colorlog>=4.2.1",
"xmltodict",
]

[project.optional-dependencies]
test = [
"pytest",
"pytest-cov",
]

[project.urls]
Homepage = "https://github.com/mundialis/actinia-example-plugin"
Tutorial = "https://mundialis.github.io/actinia_core"
API_Docs = "https://redocly.github.io/redoc/?url=https://actinia.mundialis.de/latest/swagger.json"

[tool.flake8]
max-line-length = 79

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--cov actinia_module_plugin --cov-report term-missing --verbose --tb=line -x -s"
testpaths = [
"tests",
]
markers = [
"dev: test current in development",
"unittest: completely independent test",
"integrationtest: integration test",
]
7 changes: 5 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
"config:recommended"
],
"pre-commit": {
"enabled": true
}
}
4 changes: 4 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lint.ignore = ["PLR0913", "PLR0917", "PLW0603", "S107", "S606"]

[lint.per-file-ignores]
"tests/testsuite.py" = [ "PLC0415",]
Loading
Loading