Metadata-Version: 2.4
Name: marinerg_test_access
Version: 9.1.0
Summary: A web app for project access applications.
Author-email: Irish Centre for High End Computing <james.grogan@ichec.ie>
License: MIT
Project-URL: Repository, https://git.ichec.ie/marinerg-i/test-access-service
Project-URL: Homepage, https://git.ichec.ie/marinerg-i/test-access-service
Keywords: Web Application,Django
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Requires-Python: >=3.14
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: marinerg_facility==5.0.3
Requires-Dist: ichec_django_core[workflows]==8.3.0
Requires-Dist: django>=6.0
Requires-Dist: djangorestframework>=3.17
Requires-Dist: drf-spectacular
Requires-Dist: pydantic>=2
Requires-Dist: pyyaml
Requires-Dist: requests
Requires-Dist: pypdf
Requires-Dist: python-keycloak
Requires-Dist: django-fsm-2
Requires-Dist: django-simple-history
Provides-Extra: container
Requires-Dist: psycopg2-binary; extra == "container"
Requires-Dist: gunicorn; extra == "container"
Provides-Extra: types
Requires-Dist: types-requests; extra == "types"
Requires-Dist: types-PyYAML; extra == "types"
Provides-Extra: async
Requires-Dist: celery>=5.3; extra == "async"
Requires-Dist: redis>=5.0; extra == "async"
Provides-Extra: keycloak
Requires-Dist: ichec_django_core[keycloak]; extra == "keycloak"
Dynamic: license-file

# Marinerg-i Test Access Service

This is the backend for the Marinerg-i Test Access Portal. Researchers apply
for time at marine renewable energy test facilities. A review board evaluates
each application, the board chair decides, and accepted applications lead to a
facility test report.

It is a Django app with a REST API, built for the
[Marinerg-i project](https://www.marinerg-i.eu). The Angular frontend is in
[`marinerg-i/frontend`](https://git.ichec.ie/marinerg-i/frontend). Run it
separately and point it at this backend.

## Try it locally

Read `infra/quick_start.sh`, then run it:

```sh
./infra/quick_start.sh
```

It creates a virtual environment, installs the dependencies, sets up a local
database with an admin user, and starts the server. Browse to
[localhost:8000/api](http://localhost:8000/api).

## Develop

The app reads its settings from the environment. `infra/dev.txt` has working
values for local development. Keep real deployment settings out of the repo.

```sh
uv sync --group dev
source infra/set_dev_environment.sh
uv run python manage.py migrate
uv run python manage.py sync_roles
uv run python manage.py runserver
```

If the server says the secret key is missing, the settings didn't load into
your shell.

`uv run tox` runs every check CI runs: format, lint, types, the tests, the
Celery tests, the schema check and the e2e collection. After you change a model
or serializer, regenerate the schema and client, and commit them:

```sh
uv run python manage.py generate_client marinerg_test_access.client
```

After you change an access policy, rewrite the deployed sweep's declaration:

```sh
WRITE_DECLARATION=1 uv run pytest tests/test_policies.py
```

To see the portal in every state, load the demo data, locally or on a local
or dev stack, as [docs/demo-data.md](docs/demo-data.md) explains. It loads only
where `DJANGO_DEMO_DATA` is true. Set it only in the local and dev inventories,
so staging and prod refuse.

`infra/dev.txt` sets `DJANGO_FRONTEND_URL` to the frontend's dev server, so
signing in returns you to the frontend, not to this server's port.

## PDF summaries

Each submitted application gets a PDF summary, built by
[Gotenberg](https://gotenberg.dev). Without it the summary is a zip of the
HTML and attachments, so you need it only for the PDF itself and the tests in
`tests/integration/`:

```sh
podman run -d --rm -p 3000:3000 gotenberg/gotenberg:8.34.0
GOTENBERG_URL=http://localhost:3000 uv run python runtests.py
```

[utils/gotenberg.py](src/marinerg_test_access/utils/gotenberg.py) lists its
timeout and retry settings.

## How an application is reviewed

Each call runs its applications through a review flow: facility review,
board review, the chair's decision, then the facility's test report.
[docs/review-flow.md](docs/review-flow.md) explains the flow, what is left to
people, and who sees whom.

## Release

Each pipeline on `main` has `release patch`, `release minor` and
`release major` buttons. Press one to publish that release. Then pin the new
version in `marinerg-deploy` and release its image. The deployment runs
`migrate` and `sync_roles`.

## Licence

Copyright of the Irish Centre for High End Computing (ICHEC), released under the
MIT Licence. See [`LICENSE`](LICENSE).
