From 768c70d10db4334c5c654028dab65152babd10d6 Mon Sep 17 00:00:00 2001 From: taniya-das Date: Mon, 11 Sep 2023 11:09:58 +0200 Subject: [PATCH 01/12] update readme with docker compose version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e78c6c06..5ca232ae 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ following figure: ## Prerequisites - Linux/MacOS/Windows (should all work) -- [Docker](https://docs.docker.com/get-docker/) +- [Docker](https://docs.docker.com/get-docker/) (latest docker-compose version v2.21.0 or higher) For development: - `Python3.11` with `python3.11-dev` (`sudo apt install python3.11-dev` on Debian) From e6c8bf07615bc99f2b538ed42a58a37333be9123 Mon Sep 17 00:00:00 2001 From: taniya-das Date: Mon, 11 Sep 2023 11:10:47 +0200 Subject: [PATCH 02/12] update readme with docker compose version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ca232ae..edc3a100 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ following figure: ## Prerequisites - Linux/MacOS/Windows (should all work) -- [Docker](https://docs.docker.com/get-docker/) (latest docker-compose version v2.21.0 or higher) +- [Docker](https://docs.docker.com/get-docker/) (latest docker-compose version 2.21.0 or higher) For development: - `Python3.11` with `python3.11-dev` (`sudo apt install python3.11-dev` on Debian) From 80d6597fbde627a7f70504ae7c2fe08d2bd084bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:23:04 +0000 Subject: [PATCH 03/12] Bump datasets from 2.14.4 to 2.14.5 Bumps [datasets](https://github.com/huggingface/datasets) from 2.14.4 to 2.14.5. - [Release notes](https://github.com/huggingface/datasets/releases) - [Commits](https://github.com/huggingface/datasets/compare/2.14.4...2.14.5) --- updated-dependencies: - dependency-name: datasets dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 38294ec7..2e9e604c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ authors = [ dependencies = [ "urllib3== 2.0.4", "bibtexparser==1.4.0", - "datasets==2.14.4", + "datasets==2.14.5", "fastapi==0.103.1", "uvicorn==0.23.2", "requests==2.31.0", From b6138d5c7f98cd5f4b3926a76accd9e39401d6f0 Mon Sep 17 00:00:00 2001 From: taniya-das Date: Mon, 11 Sep 2023 11:41:49 +0200 Subject: [PATCH 04/12] correct README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index edc3a100..9efd5fb3 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ following figure: ## Prerequisites - Linux/MacOS/Windows (should all work) -- [Docker](https://docs.docker.com/get-docker/) (latest docker-compose version 2.21.0 or higher) +- [Docker](https://docs.docker.com/get-docker/) +- [Docker Compose](https://docs.docker.com/compose/install/) version 2.21.0 or higher For development: - `Python3.11` with `python3.11-dev` (`sudo apt install python3.11-dev` on Debian) From d758ecbbd6e798816e07d3eb5a4615394b32bd94 Mon Sep 17 00:00:00 2001 From: Jos van der Velde Date: Mon, 11 Sep 2023 13:55:33 +0200 Subject: [PATCH 05/12] version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2e9e604c..bbab0044 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "ai4eu_server_demo" description = "A containerized demo application for AI on demand (previously AI4EU) " -version = "0.4.20230627" +version = "1.0.20230911" requires-python = ">=3.11" authors = [ From ce61062f26bfa5158dff63b48f80cc44cb8dda47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 14:58:34 +0000 Subject: [PATCH 06/12] Bump httpx from 0.24.1 to 0.25.0 Bumps [httpx](https://github.com/encode/httpx) from 0.24.1 to 0.25.0. - [Release notes](https://github.com/encode/httpx/releases) - [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/httpx/compare/0.24.1...0.25.0) --- updated-dependencies: - dependency-name: httpx dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bbab0044..b2a7d001 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ "pydantic_schemaorg==1.0.6", "python-dateutil==2.8.2", "sqlmodel==0.0.8", - "httpx==0.24.1", + "httpx==0.25.0", "sickle==0.7.0", "xmltodict==0.13.0", "python-multipart==0.0.6", From b35d23889b6b67cca9d2f6a756a192689059e7db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:18:21 +0000 Subject: [PATCH 07/12] Bump urllib3 from 2.0.4 to 2.0.5 Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.4 to 2.0.5. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/2.0.4...v2.0.5) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b2a7d001..066d65a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ {name = "Taniya Das", email = "t.das@tue.nl"} ] dependencies = [ - "urllib3== 2.0.4", + "urllib3== 2.0.5", "bibtexparser==1.4.0", "datasets==2.14.5", "fastapi==0.103.1", From a872ef75f4cce9fcab75641a569b55efa6abdf2d Mon Sep 17 00:00:00 2001 From: Jos van der Velde Date: Thu, 21 Sep 2023 16:00:13 +0200 Subject: [PATCH 08/12] Example scripts: how to authenticate as service account, and how to upload a dataset as service account? --- ...ample_authenticate_with_service_account.sh | 53 +++++++++++++ ...ple_upload_dataset_with_service_account.sh | 77 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100755 examples/authentication/example_authenticate_with_service_account.sh create mode 100755 examples/upload/example_upload_dataset_with_service_account.sh diff --git a/examples/authentication/example_authenticate_with_service_account.sh b/examples/authentication/example_authenticate_with_service_account.sh new file mode 100755 index 00000000..85c168ee --- /dev/null +++ b/examples/authentication/example_authenticate_with_service_account.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# This minimal example is for back-end services that want to authenticate as a server. +# Use this example if you want to upload data in the name of the service, not in the name +# of a user. +# Another option for back-end services would be to let users login / to impersonate users. + + + +# Ask admin of https://aiod-dev.i3a.es/aiod-auth keycloak, e.g. Rafael, for a secret +CLIENT_ID="PUT CLIENT ID HERE" +SECRET="PUT THE SECRET HERE" + + +if [ "${CLIENT_ID}" = "PUT CLIENT ID HERE" ]; then + echo "Error: put the correct client id in the script" + exit 1 +fi +if [ "${SECRET}" = "PUT THE SECRET HERE" ]; then + echo "Error: put the correct secret in the script" + exit 1 +fi + + +TOKEN_DICT=$(curl \ + -d "client_id=${CLIENT_ID}" \ + -d "client_secret=${SECRET}" \ + -d "grant_type=client_credentials" \ + -d "scope=openid profile roles" \ + "https://aiod-dev.i3a.es/aiod-auth/realms/aiod/protocol/openid-connect/token" \ + | python3 -m json.tool +) + +TOKEN=$( + echo $TOKEN_DICT \ + | jq .access_token \ + | tr -d '"' +) + +echo "TOKEN: " +echo $TOKEN +echo "(should not be null)" + +RESULT=$( + curl -X 'GET' \ + -H "Accept: application/json" \ + -H "Authorization: Bearer ${TOKEN}" \ + -H "Content-Type: application/json" \ + https://aiod-dev.i3a.es/authorization_test +) + + +echo "Result of auth test:" +echo $RESULT diff --git a/examples/upload/example_upload_dataset_with_service_account.sh b/examples/upload/example_upload_dataset_with_service_account.sh new file mode 100755 index 00000000..93aa9ba7 --- /dev/null +++ b/examples/upload/example_upload_dataset_with_service_account.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# This minimal example uses service authentication. + + + +# Ask admin of https://aiod-dev.i3a.es/aiod-auth keycloak, e.g. Rafael, for a secret +CLIENT_ID="PUT CLIENT ID HERE" +SECRET="PUT THE SECRET HERE" + + +if [ "${CLIENT_ID}" = "PUT CLIENT ID HERE" ]; then + echo "Error: put the correct client id in the script" + exit 1 +fi +if [ "${SECRET}" = "PUT THE SECRET HERE" ]; then + echo "Error: put the correct secret in the script" + exit 1 +fi + + +TOKEN_DICT=$(curl \ + -d "client_id=${CLIENT_ID}" \ + -d "client_secret=${SECRET}" \ + -d "grant_type=client_credentials" \ + -d "scope=openid profile roles" \ + "https://aiod-dev.i3a.es/aiod-auth/realms/aiod/protocol/openid-connect/token" \ + | python3 -m json.tool +) + +TOKEN=$( + echo $TOKEN_DICT \ + | jq .access_token \ + | tr -d '"' +) + + +echo "POSTING a new dataset..." + +# Only a name is added for this dataset. See https://aiod-dev.i3a.es/docs#/ for all possible fields. +RESULT=$( + curl -X 'POST' \ + -H "Accept: application/json" \ + -H "Authorization: Bearer ${TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{"name": "test"}' \ + https://aiod-dev.i3a.es/datasets/v1 +) + + + +IDENTIFIER=$( + echo $RESULT \ + | jq .identifier \ + | tr -d '"' +) +echo "Identifier of the new dataset (should not be null):" +echo $IDENTIFIER + + +echo "Trying to retrieve the just posted dataset of the platform..." +NEW_DATASET=$( + curl -X 'GET' \ + -H "Accept: application/json" \ + https://aiod-dev.i3a.es/datasets/v1/${IDENTIFIER} +) +echo "New dataset as found on the platform:" +echo $NEW_DATASET | jq . + + +echo "Deleting the dataset again, because it was just a test..." +DELETED=$( + curl -X 'DELETE' \ + -H "Authorization: Bearer ${TOKEN}" \ + -H "Accept: application/json" \ + https://aiod-dev.i3a.es/datasets/v1/${IDENTIFIER} +) +echo "Done." From 7ea433f8082c8227c5c15a0e35f9019fe44b3ed3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Sep 2023 11:12:48 +0000 Subject: [PATCH 09/12] Bump bibtexparser from 1.4.0 to 1.4.1 Bumps [bibtexparser](https://github.com/sciunto-org/python-bibtexparser) from 1.4.0 to 1.4.1. - [Release notes](https://github.com/sciunto-org/python-bibtexparser/releases) - [Changelog](https://github.com/sciunto-org/python-bibtexparser/blob/main/CHANGELOG) - [Commits](https://github.com/sciunto-org/python-bibtexparser/compare/v1.4.0...v1.4.1) --- updated-dependencies: - dependency-name: bibtexparser dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 066d65a7..b877cf27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ authors = [ ] dependencies = [ "urllib3== 2.0.5", - "bibtexparser==1.4.0", + "bibtexparser==1.4.1", "datasets==2.14.5", "fastapi==0.103.1", "uvicorn==0.23.2", From 14600293fbc832fd486334278bbebcfe69f497eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:36:53 +0000 Subject: [PATCH 10/12] Bump pre-commit from 3.4.0 to 3.5.0 Bumps [pre-commit](https://github.com/pre-commit/pre-commit) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.4.0...v3.5.0) --- updated-dependencies: - dependency-name: pre-commit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b877cf27..3da4ec75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ dev = [ "pytest==7.4.2", "pytest-dotenv==0.5.2", "pytest-xdist==3.3.1", - "pre-commit==3.4.0", + "pre-commit==3.5.0", "responses==0.23.3", "starlette==0.27.0" ] From 0e05af410a9615c968e7dbb87ce9a7752c262da8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:12:20 +0000 Subject: [PATCH 11/12] Bump urllib3 from 2.0.5 to 2.0.7 Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.0.5 to 2.0.7. - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/v2.0.5...2.0.7) --- updated-dependencies: - dependency-name: urllib3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3da4ec75..b204acf3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ authors = [ {name = "Taniya Das", email = "t.das@tue.nl"} ] dependencies = [ - "urllib3== 2.0.5", + "urllib3== 2.0.7", "bibtexparser==1.4.1", "datasets==2.14.5", "fastapi==0.103.1", From a16d7da33076184ca2043e3902cc007f531d5e94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:22:16 +0000 Subject: [PATCH 12/12] Bump fastapi from 0.103.1 to 0.104.0 Bumps [fastapi](https://github.com/tiangolo/fastapi) from 0.103.1 to 0.104.0. - [Release notes](https://github.com/tiangolo/fastapi/releases) - [Commits](https://github.com/tiangolo/fastapi/compare/0.103.1...0.104.0) --- updated-dependencies: - dependency-name: fastapi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3da4ec75..c1f02b9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ dependencies = [ "urllib3== 2.0.5", "bibtexparser==1.4.1", "datasets==2.14.5", - "fastapi==0.103.1", + "fastapi==0.104.0", "uvicorn==0.23.2", "requests==2.31.0", "mysqlclient==2.2.0",