Metadata-Version: 2.4
Name: actinia-grassdata-management-plugin
Version: 1.0.0
Summary: An actinia-core plugin which adds vector- raster and STRDS enpoints to actinia-core
Author: Carmen Tawalika, Anika Weinmann, Guido Riembauer, Marc Jansen, Sören Gebbert, Markus Neteler, and more
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/mundialis/actinia-grassdata-management-plugin
Project-URL: Tutorial, https://actinia-org.github.io/actinia-core
Project-URL: API_Docs, https://redocly.github.io/redoc/?url=https://actinia.mundialis.de/latest/swagger.json
Keywords: processing,earth observation,cloud-based processing,rest api,gis,grass gis,osgeo,data management
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: actinia-api>=3.7.0
Requires-Dist: actinia-core>=6.0.1
Requires-Dist: actinia-rest-lib>=1.0.0
Requires-Dist: actinia-processing-lib>=1.1.0
Requires-Dist: Flask>=3.0.0
Requires-Dist: pwgen
Requires-Dist: setuptools==80.9.0
Requires-Dist: werkzeug>=3.1.3
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Dynamic: license-file

# actinia-grassdata-management-plugin

This is an example plugin for [actinia-core](https://github.com/mundialis/actinia_core) which adds a "Hello World" endpoint to actinia-core.

You can run actinia-grassdata-management-plugin as an actinia-core plugin.

## Installation
Use docker-compose for installation:
```bash
docker compose -f docker/docker-compose.yml build
docker compose -f docker/docker-compose.yml up -d
```

### Installation hints
* If you get an error like: `ERROR: for docker_kvdb_1  Cannot start service valkey: network xxx not found` you can try the following:
```bash
docker compose -f docker/docker-compose.yml down
# remove all custom networks not used by a container
docker network prune
docker compose -f docker/docker-compose.yml up -d
```

### Requesting helloworld endpoint
You can test the plugin and request the `/helloworld` endpoint, e.g. with:
```bash
curl -u actinia-gdi:actinia-gdi -X GET http://localhost:8088/api/v3/helloworld | jq

curl -u actinia-gdi:actinia-gdi -H 'accept: application/json' -H 'Content-Type: application/json' -X POST http://localhost:8088/api/v3/helloworld -d '{"name": "test"}' | jq
```

## DEV setup
For a DEV setup you can use the docker/docker-compose.yml:
```bash
docker compose -f docker/docker-compose.yml build
docker compose -f docker/docker-compose.yml run --rm --service-ports --entrypoint sh actinia

# install the plugin
(cd /src/actinia-grassdata-management-plugin && python3 setup.py install)
# start actinia-core with your plugin
sh /src/start.sh
# gunicorn -b 0.0.0.0:8088 -w 1 --access-logfile=- -k gthread actinia_core.main:flask_app
```

### Hints

* If you have no `.git` folder in the plugin folder, you need to set the
`SETUPTOOLS_SCM_PRETEND_VERSION` before installing the plugin:
```bash
export SETUPTOOLS_SCM_PRETEND_VERSION=0.0
```
Otherwise you will get an error like this
`LookupError: setuptools-scm was unable to detect version for '/src/actinia-grassdata-management-plugin'.`.

* If you make changes in code and nothing changes you can try to uninstall the plugin:
```bash
pip3 uninstall actinia-grassdata-management-plugin.wsgi -y
rm -rf /usr/lib/python3.8/site-packages/actinia_grassdata_management_plugin.wsgi-*.egg
```

### Running tests
You can run the tests in the actinia test docker:

```bash
docker build -f docker/actinia-grassdata-management-plugin-test/Dockerfile -t actinia-grassdata-management-plugin-test .
docker run -it -w /src/actinia-grassdata-management-plugin/ actinia-grassdata-management-plugin-test -i

# run all tests
make test

# run only unittests
make unittest
# run only integrationtests
make integrationtest

# run only tests which are marked for development with the decorator '@pytest.mark.dev'
make devtest
```

## Starting steps for own plugin
If you want to have your own plugin you can use this repo to create it by
executing the `scripts/create_own_plugin.sh`.

If you want the repo in git then you first have to create an empty git repository
and then run the script. Then follow the last instructions from the script
to upload the initial code to your git repository.

```bash
bash create_own_plugin.sh actinia-ex2-plugin git
```

If you only want your own plugin in a folder and not in git you can execute the
script like this:

```bash
bash create_own_plugin.sh actinia-ex2-plugin
```

## Hint for the development of actinia plugins

### skip permission check
The parameter [`skip_permission_check`](https://github.com/mundialis/actinia_core/blob/main/src/actinia_core/processing/actinia_processing/ephemeral_processing.py#L1420-L1422) (see [example in actinia-statistic plugin](https://github.com/mundialis/actinia_statistic_plugin/blob/master/src/actinia_statistic_plugin/vector_sampling.py#L207))
should only be set to `True` if you are sure that you really don't want to check the permissions.

The skip of the permission check leads to a skipping of:
* [the module check](https://github.com/mundialis/actinia_core/blob/main/src/actinia_core/processing/actinia_processing/ephemeral_processing.py#L579-L589)
* [the limit of the number of processes](https://github.com/mundialis/actinia_core/blob/main/src/actinia_core/processing/actinia_processing/ephemeral_processing.py#L566-L570)
* the limit of the processing time

Not skipped are:
* the limit of the cells
* the mapset/project limitations of the user
