# 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`
Raw data
{
"_id": null,
"home_page": "https://earth.bsc.es/gitlab/es/autosubmit_api",
"name": "autosubmit-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "autosubmit, API",
"author": "Luiggi Tenorio, Bruno P. Kinoshita, Cristian Guti\u00e9rrez, Julian Berlin, Wilmer Uruchi",
"author_email": "support-autosubmit@bsc.es",
"download_url": "https://files.pythonhosted.org/packages/9f/21/f574a8270207cb760ac6e1aa653269c8c1b7371e579f299500a9b4e5c825/autosubmit_api-4.0.0.tar.gz",
"platform": null,
"description": "# Autosubmit API\n\n# Table of Contents\n\n1. [Overview](#overview)\n2. [Installation](#installation)\n3. [Configuration options](#configuration-options)\n4. [How to run tests](#how-to-run-tests)\n\n## Overview\n\nAutosubmit API is a package that consumes the information generated by Autosubmit and serves it as an API.\n\nDistribution: https://pypi.org/project/autosubmit-api/\n\nSee the `openapi.json` specification and the repository wiki for more information.\n\n## Installation\n\nAutosubmit API can be easily installed via pip\n\n```sh\npip install autosubmit-api # >=4.0 (recommended)\n\n# Check installation and serving options\nautosubmit_api start -h\n```\n\nStart the server:\n\n```sh\nautosubmit_api start\n```\n\n## Configuration options\n\nThe Autosubmit API have some configuration options that can be modified by setting their specific environment variable before starting the server:\n\n- **`PROTECTION_LEVEL`**: Default `ALL`. Possible values `ALL`, `WRITEONLY`, `NONE`.\n - If set to `ALL`, all the endpoints will be protected by needing a valid token inside the `Authorization` header of the request.\n - If set to `WRITEONLY`, only a subset of the endpoints will be protected.\n - If set to `NONE`, none of the endpoints will be protected.\n- **`SECRET_KEY`**: The secret key to encode the JWT tokens from the Authorization Module. **Important to be set up on production.**\n- **`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).\n- **`CAS_LOGIN_URL`**: CAS Protocol URL to request a ticket. Used for `/v3` endpoints.\n- **`CAS_VERIFY_URL`**: CAS Protocol URL to verify a given ticket. Used for `/v3` endpoints.\n- **`GITHUB_OAUTH_CLIENT_ID`**: Client ID of the Github Oauth app.\n- **`GITHUB_OAUTH_CLIENT_SECRET`**: Secret key of the Github Oauth app.\n- **`GITHUB_OAUTH_WHITELIST_ORGANIZATION`**: Used to use authorization based on the membership of a Github organization.\n- **`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\n\n## How to run tests\n\n### Install pytest\n\n```bash\npip install -e .[test]\n```\n\n### Run tests:\n\n```bash\npytest\n```\n\n### Run tests with coverage HTML report:\n\n```bash\npytest --cov=autosubmit_api --cov-config=.coveragerc --cov-report=html tests/\n```\n\nYou will find the report in `htmlcov/index.html`\n",
"bugtrack_url": null,
"license": "GNU GPL",
"summary": "An extension to the Autosubmit package that serves its information as an API",
"version": "4.0.0",
"project_urls": {
"Homepage": "https://earth.bsc.es/gitlab/es/autosubmit_api"
},
"split_keywords": [
"autosubmit",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6af3509ab9a69899886c7435c55dd9a30608867237ec7d5fc09c2e362658a0f9",
"md5": "d96d87a28acd68f903d193bc3a7ccead",
"sha256": "80264956f3c89fa4b43a83ea2da85737dcb77ce3ed72a78ce46736861ac93255"
},
"downloads": -1,
"filename": "autosubmit_api-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d96d87a28acd68f903d193bc3a7ccead",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 189440,
"upload_time": "2024-07-11T11:21:15",
"upload_time_iso_8601": "2024-07-11T11:21:15.761992Z",
"url": "https://files.pythonhosted.org/packages/6a/f3/509ab9a69899886c7435c55dd9a30608867237ec7d5fc09c2e362658a0f9/autosubmit_api-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f21f574a8270207cb760ac6e1aa653269c8c1b7371e579f299500a9b4e5c825",
"md5": "251e14310edf4beb6115998f9d3098f1",
"sha256": "b0c407e5c7538ea7b3c7f96a9ab8a587d7b4189a91252adccca7a1890d46c0a7"
},
"downloads": -1,
"filename": "autosubmit_api-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "251e14310edf4beb6115998f9d3098f1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 147883,
"upload_time": "2024-07-11T11:21:19",
"upload_time_iso_8601": "2024-07-11T11:21:19.899039Z",
"url": "https://files.pythonhosted.org/packages/9f/21/f574a8270207cb760ac6e1aa653269c8c1b7371e579f299500a9b4e5c825/autosubmit_api-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-11 11:21:19",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "autosubmit-api"
}