|
1 | | -# TODO: Typer did not work in Docker container, meaning passed arguments were ignored. Switch to Click for now. Decide later if we want to switch back to Typer. |
2 | | -# # !/usr/bin/env python3 |
3 | | -# import typer |
4 | | -# from typing import List |
5 | | -# from databusclient import client |
6 | | - |
7 | | -# app = typer.Typer() |
8 | | - |
9 | | - |
10 | | -# @app.command() |
11 | | -# def deploy( |
12 | | -# version_id: str = typer.Option( |
13 | | -# ..., |
14 | | -# help="target databus version/dataset identifier of the form " |
15 | | -# "<https://databus.dbpedia.org/$ACCOUNT/$GROUP/$ARTIFACT/$VERSION>", |
16 | | -# ), |
17 | | -# title: str = typer.Option(..., help="dataset title"), |
18 | | -# abstract: str = typer.Option(..., help="dataset abstract max 200 chars"), |
19 | | -# description: str = typer.Option(..., help="dataset description"), |
20 | | -# license_uri: str = typer.Option(..., help="license (see dalicc.net)"), |
21 | | -# apikey: str = typer.Option(..., help="apikey"), |
22 | | -# distributions: List[str] = typer.Argument( |
23 | | -# ..., |
24 | | -# help="distributions in the form of List[URL|CV|fileext|compression|sha256sum:contentlength] where URL is the " |
25 | | -# "download URL and CV the " |
26 | | -# "key=value pairs (_ separated) content variants of a distribution. filext and compression are optional " |
27 | | -# "and if left out inferred from the path. If the sha256sum:contentlength part is left out it will be " |
28 | | -# "calcuted by downloading the file.", |
29 | | -# ), |
30 | | -# ): |
31 | | -# typer.echo(version_id) |
32 | | -# dataid = client.create_dataset( |
33 | | -# version_id, title, abstract, description, license_uri, distributions |
34 | | -# ) |
35 | | -# client.deploy(dataid=dataid, api_key=apikey) |
36 | | - |
37 | | - |
38 | | -# @app.command() |
39 | | -# def download( |
40 | | -# databusuris: List[str] = typer.Argument(..., help="any kind of these: databus identifier, databus collection identifier, query file"), |
41 | | -# localDir: str = typer.Option(None , help="local databus folder"), # if not given, databus folder structure is created in current working directory |
42 | | -# databus: str = typer.Option(None, help="databus URL"), # if not given, inferred on databusuri (e.g. https://databus.dbpedia.org/sparql) |
43 | | -# token: str = typer.Option(None, help="Path to Vault refresh token file"), |
44 | | -# authUrl: str = typer.Option("https://auth.dbpedia.org/realms/dbpedia/protocol/openid-connect/token", help="Keycloak token endpoint URL"), |
45 | | -# clientId: str = typer.Option("vault-token-exchange", help="Client ID for token exchange") |
46 | | -# ): |
47 | | -# """ |
48 | | -# Download datasets from databus, optionally using vault access if vault options are provided. |
49 | | -# """ |
50 | | -# client.download(localDir=localDir, endpoint=databus, databusURIs=databusuris, vault_token_file=vaultTokenFile, auth_url=authUrl, client_id=clientId) |
51 | | - |
52 | 1 | #!/usr/bin/env python3 |
53 | 2 | import click |
54 | 3 | from typing import List |
|
0 commit comments