Metadata-Version: 2.1
Name: autosubmit_api
Version: 4.0.0
Summary: An extension to the Autosubmit package that serves its information as an API
Home-page: https://earth.bsc.es/gitlab/es/autosubmit_api
Author: Luiggi Tenorio, Bruno P. Kinoshita, Cristian Gutiérrez, Julian Berlin, Wilmer Uruchi
Author-email: support-autosubmit@bsc.es
License: GNU GPL
Keywords: autosubmit,API
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Flask~=2.2.5
Requires-Dist: pyjwt~=2.8.0
Requires-Dist: requests~=2.28.1
Requires-Dist: flask_cors~=3.0.10
Requires-Dist: bscearth.utils~=0.5.2
Requires-Dist: pydotplus~=2.0.2
Requires-Dist: portalocker~=2.6.0
Requires-Dist: networkx<=2.6.3
Requires-Dist: scipy~=1.11.4
Requires-Dist: python-dotenv~=1.0.1
Requires-Dist: autosubmitconfigparser>=1.0.65
Requires-Dist: autosubmit>=3.13
Requires-Dist: Flask-APScheduler~=1.13.1
Requires-Dist: gunicorn~=22.0.0
Requires-Dist: pydantic~=2.5.2
Requires-Dist: SQLAlchemy~=2.0.23
Requires-Dist: python-cas~=1.6.0
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Provides-Extra: all
Requires-Dist: Flask~=2.2.5; extra == "all"
Requires-Dist: pyjwt~=2.8.0; extra == "all"
Requires-Dist: requests~=2.28.1; extra == "all"
Requires-Dist: flask_cors~=3.0.10; extra == "all"
Requires-Dist: bscearth.utils~=0.5.2; extra == "all"
Requires-Dist: pydotplus~=2.0.2; extra == "all"
Requires-Dist: portalocker~=2.6.0; extra == "all"
Requires-Dist: networkx<=2.6.3; extra == "all"
Requires-Dist: scipy~=1.11.4; extra == "all"
Requires-Dist: python-dotenv~=1.0.1; extra == "all"
Requires-Dist: autosubmitconfigparser>=1.0.65; extra == "all"
Requires-Dist: autosubmit>=3.13; extra == "all"
Requires-Dist: Flask-APScheduler~=1.13.1; extra == "all"
Requires-Dist: gunicorn~=22.0.0; extra == "all"
Requires-Dist: pydantic~=2.5.2; extra == "all"
Requires-Dist: SQLAlchemy~=2.0.23; extra == "all"
Requires-Dist: python-cas~=1.6.0; extra == "all"
Requires-Dist: pytest; extra == "all"
Requires-Dist: pytest-cov; extra == "all"

# Autosubmit API

# Table of Contents

1. [Overview](#overview)
2. [Installation](#installation)
3. [Configuration options](#configuration-options)
4. [How to run tests](#how-to-run-tests)

## Overview

Autosubmit API is a package that consumes the information generated by Autosubmit and serves it as an API.

Distribution: https://pypi.org/project/autosubmit-api/

See the `openapi.json` specification and the repository wiki for more information.

## Installation

Autosubmit API can be easily installed via pip

```sh
pip install autosubmit-api # >=4.0 (recommended)

# Check installation and serving options
autosubmit_api start -h
```

Start the server:

```sh
autosubmit_api start
```

## Configuration options

The Autosubmit API have some configuration options that can be modified by setting their specific environment variable before starting the server:

- **`PROTECTION_LEVEL`**: Default `ALL`. Possible values `ALL`, `WRITEONLY`, `NONE`.
  - If set to `ALL`, all the endpoints will be protected by needing a valid token inside the `Authorization` header of the request.
  - If set to `WRITEONLY`, only a subset of the endpoints will be protected.
  - If set to `NONE`, none of the endpoints will be protected.
- **`SECRET_KEY`**: The secret key to encode the JWT tokens from the Authorization Module. **Important to be set up on production.**
- **`CAS_SERVER_URL`**: CAS Protocol server base URL to request a ticket and verify it. Used for `/v4` endpoints. `CAS_LOGIN_URL` and `CAS_VERIFY_URL` can be empty if this variable is set (the API will append the protocol URL subpaths).
- **`CAS_LOGIN_URL`**: CAS Protocol URL to request a ticket. Used for `/v3` endpoints.
- **`CAS_VERIFY_URL`**: CAS Protocol URL to verify a given ticket. Used for `/v3` endpoints.
- **`GITHUB_OAUTH_CLIENT_ID`**: Client ID of the Github Oauth app.
- **`GITHUB_OAUTH_CLIENT_SECRET`**: Secret key of the Github Oauth app.
- **`GITHUB_OAUTH_WHITELIST_ORGANIZATION`**: Used to use authorization based on the membership of a Github organization.
- **`GITHUB_OAUTH_WHITELIST_TEAM`**: Used to use authorization based on the membership of a Github team in an organization. `GITHUB_OAUTH_WHITELIST_ORGANIZATION` is required

## How to run tests

### Install pytest

```bash
pip install -e .[test]
```

### Run tests:

```bash
pytest
```

### Run tests with coverage HTML report:

```bash
pytest --cov=autosubmit_api --cov-config=.coveragerc --cov-report=html tests/
```

You will find the report in `htmlcov/index.html`
