diracx-cli 0.0.1a19__py3-none-any.whl → 0.0.1a21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
diracx/cli/__init__.py CHANGED
@@ -10,7 +10,7 @@ from diracx.client.aio import DiracClient
10
10
  from diracx.client.models import DeviceFlowErrorResponse
11
11
  from diracx.core.extensions import select_from_extension
12
12
  from diracx.core.preferences import get_diracx_preferences
13
- from diracx.core.utils import write_credentials
13
+ from diracx.core.utils import read_credentials, write_credentials
14
14
 
15
15
  from .utils import AsyncTyper
16
16
 
@@ -38,12 +38,34 @@ def vo_callback(vo: str | None) -> str:
38
38
 
39
39
  @app.async_command()
40
40
  async def login(
41
- vo: Annotated[Optional[str], typer.Argument(callback=vo_callback)] = None,
42
- group: Optional[str] = None,
41
+ vo: Annotated[
42
+ Optional[str],
43
+ typer.Argument(callback=vo_callback, help="Virtual Organization name"),
44
+ ] = None,
45
+ group: Optional[str] = typer.Option(
46
+ None,
47
+ help="Group name within the VO. If not provided, the default group for the VO will be used.",
48
+ ),
43
49
  property: Optional[list[str]] = typer.Option(
44
- None, help="Override the default(s) with one or more properties"
50
+ None,
51
+ help=(
52
+ "List of properties to add to the default properties of the group. "
53
+ "If not provided, default properties of the group will be used."
54
+ ),
45
55
  ),
46
56
  ):
57
+ """Login to the DIRAC system using the device flow.
58
+
59
+ - If only VO is provided: Uses the default group and its properties for the VO.
60
+
61
+ - If VO and group are provided: Uses the specified group and its properties for the VO.
62
+
63
+ - If VO and properties are provided: Uses the default group and combines its properties with the
64
+ provided properties.
65
+
66
+ - If VO, group, and properties are provided: Uses the specified group and combines its properties with the
67
+ provided properties.
68
+ """
47
69
  scopes = [f"vo:{vo}"]
48
70
  if group:
49
71
  scopes.append(f"group:{group}")
@@ -94,11 +116,11 @@ async def logout():
94
116
  async with DiracClient() as api:
95
117
  credentials_path = get_diracx_preferences().credentials_path
96
118
  if credentials_path.exists():
97
- credentials = json.loads(credentials_path.read_text())
119
+ credentials = read_credentials(credentials_path)
98
120
 
99
121
  # Revoke refresh token
100
122
  try:
101
- await api.auth.revoke_refresh_token(credentials["refresh_token"])
123
+ await api.auth.revoke_refresh_token(credentials.refresh_token)
102
124
  except Exception as e:
103
125
  print(f"Error revoking the refresh token {e!r}")
104
126
  pass
diracx/cli/jobs.py CHANGED
@@ -152,7 +152,7 @@ def display_rich(data, content_range: ContentRange) -> None:
152
152
  async def submit(jdl: list[FileText]):
153
153
  async with DiracClient() as api:
154
154
  # api.valid(enforce_https=False)
155
- jobs = await api.jobs.submit_bulk_jobs([x.read() for x in jdl])
155
+ jobs = await api.jobs.submit_bulk_jdl_jobs([x.read() for x in jdl])
156
156
  print(
157
157
  f"Inserted {len(jobs)} jobs with ids: {','.join(map(str, (job.job_id for job in jobs)))}"
158
158
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-cli
3
- Version: 0.0.1a19
3
+ Version: 0.0.1a21
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -15,7 +15,7 @@ Requires-Dist: diracx-api
15
15
  Requires-Dist: diracx-client
16
16
  Requires-Dist: diracx-core
17
17
  Requires-Dist: gitpython
18
- Requires-Dist: pydantic
18
+ Requires-Dist: pydantic>=2.10
19
19
  Requires-Dist: rich
20
20
  Requires-Dist: typer
21
21
  Requires-Dist: pyyaml
@@ -23,4 +23,3 @@ Provides-Extra: testing
23
23
  Requires-Dist: diracx-testing; extra == "testing"
24
24
  Provides-Extra: types
25
25
  Requires-Dist: types-PyYAML; extra == "types"
26
-
@@ -1,13 +1,13 @@
1
- diracx/cli/__init__.py,sha256=KO7W7cBEF7vkkJ7uf4lPkWEDJsM7VTwSOsBv3WmQWd4,4575
1
+ diracx/cli/__init__.py,sha256=eenV2ezX845cIvDV2mTKqd23TLwXQBwD6Ho252h8WwA,5407
2
2
  diracx/cli/__main__.py,sha256=SM9tEc-fiW7cDHTKQRwgKobe5FfijHLYiAWfWaIM_zg,56
3
3
  diracx/cli/config.py,sha256=r5Lq_SN-1t3IzGAeS57ZzS-ukLhP6PMnmTXNld2pZXU,818
4
- diracx/cli/jobs.py,sha256=rv3sa6Cz32y2wvKR7yV7mT719VOMm8qZ1nZFviNF98E,4721
4
+ diracx/cli/jobs.py,sha256=wV7-YMI_jUIflj87cBM4yuI2EF9K5mu2WsCG_eakWrg,4725
5
5
  diracx/cli/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  diracx/cli/utils.py,sha256=NwhMMHwveKOdW2aoSqpnLnfOKhPnjmPPLpX69naPAzc,855
7
7
  diracx/cli/internal/__init__.py,sha256=DCKzknHUEvo7PYiatZis15-gkxhga5WU4cyVZ6LCkmA,6578
8
8
  diracx/cli/internal/legacy.py,sha256=bhq8vfHoL0fZGhtye0EqMsucwepOYpQkj3UGe-rHNhY,10882
9
- diracx_cli-0.0.1a19.dist-info/METADATA,sha256=bZRRlePyXNw6yQV4IA4Omx9Rr9ckQcYwRjE49_Ylx3s,790
10
- diracx_cli-0.0.1a19.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
- diracx_cli-0.0.1a19.dist-info/entry_points.txt,sha256=b1909GHVOkFUiHVglNlpwia4Ug-7Ncrg-8D5xtYVAlw,169
12
- diracx_cli-0.0.1a19.dist-info/top_level.txt,sha256=vJx10tdRlBX3rF2Psgk5jlwVGZNcL3m_7iQWwgPXt-U,7
13
- diracx_cli-0.0.1a19.dist-info/RECORD,,
9
+ diracx_cli-0.0.1a21.dist-info/METADATA,sha256=FIGewmFFEy_xHTmXoJQ9WodWOQx2ViJyWK07rcnmBps,795
10
+ diracx_cli-0.0.1a21.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
11
+ diracx_cli-0.0.1a21.dist-info/entry_points.txt,sha256=b1909GHVOkFUiHVglNlpwia4Ug-7Ncrg-8D5xtYVAlw,169
12
+ diracx_cli-0.0.1a21.dist-info/top_level.txt,sha256=vJx10tdRlBX3rF2Psgk5jlwVGZNcL3m_7iQWwgPXt-U,7
13
+ diracx_cli-0.0.1a21.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5