diracx-cli 0.0.1a43__tar.gz → 0.0.1a45__tar.gz

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.
Files changed (30) hide show
  1. diracx_cli-0.0.1a45/.gitignore +98 -0
  2. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/PKG-INFO +4 -5
  3. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/pyproject.toml +9 -6
  4. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/auth.py +6 -1
  5. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/internal/config.py +23 -23
  6. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/internal/legacy.py +1 -1
  7. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/utils.py +5 -0
  8. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/test_login.py +5 -2
  9. diracx_cli-0.0.1a43/setup.cfg +0 -4
  10. diracx_cli-0.0.1a43/src/diracx_cli.egg-info/PKG-INFO +0 -25
  11. diracx_cli-0.0.1a43/src/diracx_cli.egg-info/SOURCES.txt +0 -27
  12. diracx_cli-0.0.1a43/src/diracx_cli.egg-info/dependency_links.txt +0 -1
  13. diracx_cli-0.0.1a43/src/diracx_cli.egg-info/entry_points.txt +0 -9
  14. diracx_cli-0.0.1a43/src/diracx_cli.egg-info/requires.txt +0 -15
  15. diracx_cli-0.0.1a43/src/diracx_cli.egg-info/top_level.txt +0 -1
  16. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/README.md +0 -0
  17. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/__init__.py +0 -0
  18. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/__main__.py +0 -0
  19. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/config.py +0 -0
  20. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/internal/__init__.py +0 -0
  21. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/jobs.py +0 -0
  22. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/src/diracx/cli/py.typed +0 -0
  23. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/legacy/cs_sync/integration_test.cfg +0 -0
  24. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/legacy/cs_sync/integration_test.yaml +0 -0
  25. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/legacy/cs_sync/integration_test_buggy.cfg +0 -0
  26. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/legacy/cs_sync/integration_test_secret.cfg +0 -0
  27. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/legacy/cs_sync/test_cssync.py +0 -0
  28. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/legacy/test_legacy.py +0 -0
  29. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/test_internal.py +0 -0
  30. {diracx_cli-0.0.1a43 → diracx_cli-0.0.1a45}/tests/test_jobs.py +0 -0
@@ -0,0 +1,98 @@
1
+ # Python
2
+ *.py[cod]
3
+
4
+ # Conda
5
+ .conda
6
+
7
+ # C extensions
8
+ *.so
9
+ var
10
+ sdist
11
+ lib
12
+ lib64
13
+
14
+ # Packages
15
+ *.egg
16
+ *.egg-info
17
+ dist
18
+ build
19
+ eggs
20
+ parts
21
+ bin
22
+ develop-eggs
23
+ .installed.cfg
24
+ *.whl
25
+
26
+ # Translations
27
+ *.mo
28
+
29
+ # Mr Developer
30
+ .mr.developer.cfg
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+
35
+ # Unit test / coverage reports
36
+ .coverage
37
+ .tox
38
+ .ruff_cache
39
+ .mypy_cache
40
+
41
+ # Eclipse
42
+ .project
43
+ .pydevproject
44
+ .pyproject
45
+ .settings
46
+ .metadata
47
+
48
+ #VSCode
49
+ .vscode
50
+ .env
51
+
52
+ # Vim
53
+ .*.sw[a-z]
54
+ *.un~
55
+ Session.vim
56
+ *~
57
+
58
+ # Intellij
59
+ .idea/
60
+ LHCbDIRAC.iml
61
+
62
+ # MaxOSX files
63
+ .DS_Store
64
+
65
+ # test stuff
66
+ .pytest_cache
67
+ .cache
68
+ __pycache__
69
+ pytests.xml
70
+ nosetests.xml
71
+ coverage.xml
72
+ Local_*
73
+ .hypothesis
74
+ *.gz
75
+ htmlcov/
76
+ *.xml.temp
77
+
78
+ #remove in case we want a specific LHCb one
79
+ .pylintrc
80
+
81
+ # docs
82
+ # this is auto generated
83
+ docs/source/CodeDocumentation/
84
+ docs/source/AdministratorGuide/Configuration/ExampleConfig.rst
85
+ docs/source/AdministratorGuide/CommandReference
86
+ docs/source/UserGuide/CommandReference
87
+ docs/_build
88
+ docs/source/_build
89
+
90
+
91
+ # CMT junk
92
+ /*/*/x86_64-*-*-*/
93
+ */*/cmt/Makefile
94
+
95
+ # pixi environments
96
+ .pixi
97
+ pixi.lock
98
+ *.egg-info
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diracx-cli
3
- Version: 0.0.1a43
3
+ Version: 0.0.1a45
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -9,17 +9,16 @@ Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Topic :: Scientific/Engineering
10
10
  Classifier: Topic :: System :: Distributed Computing
11
11
  Requires-Python: >=3.11
12
- Description-Content-Type: text/markdown
13
12
  Requires-Dist: diraccfg
14
13
  Requires-Dist: diracx-api
15
14
  Requires-Dist: diracx-client
16
15
  Requires-Dist: diracx-core
17
16
  Requires-Dist: gitpython
18
17
  Requires-Dist: pydantic>=2.10
18
+ Requires-Dist: pyyaml
19
19
  Requires-Dist: rich
20
20
  Requires-Dist: typer>=0.12.4
21
- Requires-Dist: pyyaml
22
21
  Provides-Extra: testing
23
- Requires-Dist: diracx-testing; extra == "testing"
22
+ Requires-Dist: diracx-testing; extra == 'testing'
24
23
  Provides-Extra: types
25
- Requires-Dist: types-PyYAML; extra == "types"
24
+ Requires-Dist: types-pyyaml; extra == 'types'
@@ -45,16 +45,19 @@ internal = "diracx.cli.internal:app"
45
45
 
46
46
 
47
47
 
48
- [tool.setuptools.packages.find]
49
- where = ["src"]
50
-
51
48
  [build-system]
52
- requires = ["setuptools>=61", "wheel", "setuptools_scm>=8"]
53
- build-backend = "setuptools.build_meta"
49
+ requires = ["hatchling", "hatch-vcs"]
50
+ build-backend = "hatchling.build"
51
+
52
+ [tool.hatch.version]
53
+ source = "vcs"
54
54
 
55
- [tool.setuptools_scm]
55
+ [tool.hatch.version.raw-options]
56
56
  root = ".."
57
57
 
58
+ [tool.hatch.build.targets.wheel]
59
+ packages = ["src/diracx"]
60
+
58
61
  [tool.pytest.ini_options]
59
62
  testpaths = ["tests"]
60
63
  addopts = [
@@ -124,7 +124,9 @@ async def logout():
124
124
 
125
125
  # Revoke refresh token
126
126
  try:
127
- await api.auth.revoke_refresh_token(credentials.refresh_token)
127
+ await api.auth.revoke_refresh_token_by_refresh_token(
128
+ client_id=api.client_id, refresh_token=credentials.refresh_token
129
+ )
128
130
  except Exception as e:
129
131
  print(f"Error revoking the refresh token {e!r}")
130
132
  pass
@@ -132,6 +134,9 @@ async def logout():
132
134
  # Remove credentials
133
135
  credentials_path.unlink(missing_ok=True)
134
136
  print(f"Removed credentials from {credentials_path}")
137
+ else:
138
+ print("You are not connected to DiracX, or your credentials are missing.")
139
+ return
135
140
  print("\nLogout successful!")
136
141
 
137
142
 
@@ -24,14 +24,27 @@ from ..utils import AsyncTyper
24
24
  app = AsyncTyper()
25
25
 
26
26
 
27
+ def get_repo_path(config_repo_str: str) -> Path:
28
+ config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo_str)
29
+ if config_repo.scheme != "git+file" or config_repo.path is None:
30
+ raise NotImplementedError("Only git+file:// URLs are supported")
31
+
32
+ repo_path = Path(config_repo.path)
33
+
34
+ return repo_path
35
+
36
+
37
+ def get_config_from_repo_path(repo_path: Path) -> Config:
38
+ return ConfigSource.create_from_url(backend_url=repo_path).read_config()
39
+
40
+
27
41
  @app.command()
28
42
  def generate_cs(config_repo: str):
29
43
  """Generate a minimal DiracX configuration repository."""
30
44
  # TODO: The use of TypeAdapter should be moved in to typer itself
31
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
32
- if config_repo.scheme != "git+file" or config_repo.path is None:
33
- raise NotImplementedError("Only git+file:// URLs are supported")
34
- repo_path = Path(config_repo.path)
45
+
46
+ repo_path = get_repo_path(config_repo)
47
+
35
48
  if repo_path.exists() and list(repo_path.iterdir()):
36
49
  typer.echo(f"ERROR: Directory {repo_path} already exists", err=True)
37
50
  raise typer.Exit(1)
@@ -60,10 +73,8 @@ def add_vo(
60
73
  ):
61
74
  """Add a registry entry (vo) to an existing configuration repository."""
62
75
  # TODO: The use of TypeAdapter should be moved in to typer itself
63
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
64
- if config_repo.scheme != "git+file" or config_repo.path is None:
65
- raise NotImplementedError("Only git+file:// URLs are supported")
66
- repo_path = Path(config_repo.path)
76
+ repo_path = get_repo_path(config_repo)
77
+ config = get_config_from_repo_path(repo_path)
67
78
 
68
79
  # A VO should at least contain a default group
69
80
  new_registry = RegistryConfig(
@@ -77,8 +88,6 @@ def add_vo(
77
88
  },
78
89
  )
79
90
 
80
- config = ConfigSource.create_from_url(backend_url=repo_path).read_config()
81
-
82
91
  if vo in config.Registry:
83
92
  typer.echo(f"ERROR: VO {vo} already exists", err=True)
84
93
  raise typer.Exit(1)
@@ -103,15 +112,11 @@ def add_group(
103
112
  ):
104
113
  """Add a group to an existing vo in the configuration repository."""
105
114
  # TODO: The use of TypeAdapter should be moved in to typer itself
106
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
107
- if config_repo.scheme != "git+file" or config_repo.path is None:
108
- raise NotImplementedError("Only git+file:// URLs are supported")
109
- repo_path = Path(config_repo.path)
115
+ repo_path = get_repo_path(config_repo)
116
+ config = get_config_from_repo_path(repo_path)
110
117
 
111
118
  new_group = GroupConfig(Properties=set(properties), Quota=None, Users=set())
112
119
 
113
- config = ConfigSource.create_from_url(backend_url=repo_path).read_config()
114
-
115
120
  if vo not in config.Registry:
116
121
  typer.echo(f"ERROR: Virtual Organization {vo} does not exist", err=True)
117
122
  raise typer.Exit(1)
@@ -139,16 +144,11 @@ def add_user(
139
144
  ):
140
145
  """Add a user to an existing vo and group."""
141
146
  # TODO: The use of TypeAdapter should be moved in to typer itself
142
- config_repo = TypeAdapter(ConfigSourceUrl).validate_python(config_repo)
143
- if config_repo.scheme != "git+file" or config_repo.path is None:
144
- raise NotImplementedError("Only git+file:// URLs are supported")
145
-
146
- repo_path = Path(config_repo.path)
147
+ repo_path = get_repo_path(config_repo)
148
+ config = get_config_from_repo_path(repo_path)
147
149
 
148
150
  new_user = UserConfig(PreferedUsername=preferred_username)
149
151
 
150
- config = ConfigSource.create_from_url(backend_url=repo_path).read_config()
151
-
152
152
  if vo not in config.Registry:
153
153
  typer.echo(f"ERROR: Virtual Organization {vo} does not exist", err=True)
154
154
  raise typer.Exit(1)
@@ -96,7 +96,7 @@ def _apply_fixes(raw):
96
96
  raw["DIRAC"].pop("Framework", None)
97
97
  raw["DIRAC"].pop("Security", None)
98
98
 
99
- # This is VOMS specific and no longer reqired
99
+ # This is VOMS specific and no longer required
100
100
  raw["DIRAC"].pop("ConnConf", None)
101
101
 
102
102
  # Setups are no longer supported
@@ -7,6 +7,7 @@ from functools import wraps
7
7
 
8
8
  import typer
9
9
  from azure.core.exceptions import ClientAuthenticationError
10
+ from httpx import ConnectError
10
11
  from rich import print
11
12
 
12
13
 
@@ -22,6 +23,10 @@ class AsyncTyper(typer.Typer):
22
23
  ":x: [bold red]You are not authenticated. Log in with:[/bold red] "
23
24
  "[bold] dirac login [OPTIONS] [VO] [/bold]"
24
25
  )
26
+ except ConnectError:
27
+ print(
28
+ ":x: [bold red]Please configure a valid DiracX server.[/bold red]"
29
+ )
25
30
 
26
31
  self.command(*args, **kwargs)(sync_func)
27
32
  return async_func
@@ -31,8 +31,11 @@ async def test_logout(monkeypatch, capfd, cli_env, with_cli_login):
31
31
  # Rerun the logout command, it should not fail
32
32
  await cli.auth.logout()
33
33
  captured = capfd.readouterr()
34
- assert "Removed credentials from" not in captured.out
35
- assert "Logout successful!" in captured.out
34
+ assert (
35
+ "You are not connected to DiracX, or your credentials are missing."
36
+ in captured.out
37
+ )
38
+ assert "Login successful!" not in captured.out
36
39
  assert captured.err == ""
37
40
 
38
41
  # Ensure the credentials file still does not exist
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
@@ -1,25 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: diracx-cli
3
- Version: 0.0.1a43
4
- Summary: TODO
5
- License: GPL-3.0-only
6
- Classifier: Intended Audience :: Science/Research
7
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Topic :: Scientific/Engineering
10
- Classifier: Topic :: System :: Distributed Computing
11
- Requires-Python: >=3.11
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: diraccfg
14
- Requires-Dist: diracx-api
15
- Requires-Dist: diracx-client
16
- Requires-Dist: diracx-core
17
- Requires-Dist: gitpython
18
- Requires-Dist: pydantic>=2.10
19
- Requires-Dist: rich
20
- Requires-Dist: typer>=0.12.4
21
- Requires-Dist: pyyaml
22
- Provides-Extra: testing
23
- Requires-Dist: diracx-testing; extra == "testing"
24
- Provides-Extra: types
25
- Requires-Dist: types-PyYAML; extra == "types"
@@ -1,27 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- src/diracx/cli/__init__.py
4
- src/diracx/cli/__main__.py
5
- src/diracx/cli/auth.py
6
- src/diracx/cli/config.py
7
- src/diracx/cli/jobs.py
8
- src/diracx/cli/py.typed
9
- src/diracx/cli/utils.py
10
- src/diracx/cli/internal/__init__.py
11
- src/diracx/cli/internal/config.py
12
- src/diracx/cli/internal/legacy.py
13
- src/diracx_cli.egg-info/PKG-INFO
14
- src/diracx_cli.egg-info/SOURCES.txt
15
- src/diracx_cli.egg-info/dependency_links.txt
16
- src/diracx_cli.egg-info/entry_points.txt
17
- src/diracx_cli.egg-info/requires.txt
18
- src/diracx_cli.egg-info/top_level.txt
19
- tests/test_internal.py
20
- tests/test_jobs.py
21
- tests/test_login.py
22
- tests/legacy/test_legacy.py
23
- tests/legacy/cs_sync/integration_test.cfg
24
- tests/legacy/cs_sync/integration_test.yaml
25
- tests/legacy/cs_sync/integration_test_buggy.cfg
26
- tests/legacy/cs_sync/integration_test_secret.cfg
27
- tests/legacy/cs_sync/test_cssync.py
@@ -1,9 +0,0 @@
1
- [console_scripts]
2
- dirac = diracx.cli:app
3
-
4
- [diracx.cli]
5
- config = diracx.cli.config:app
6
- jobs = diracx.cli.jobs:app
7
-
8
- [diracx.cli.hidden]
9
- internal = diracx.cli.internal:app
@@ -1,15 +0,0 @@
1
- diraccfg
2
- diracx-api
3
- diracx-client
4
- diracx-core
5
- gitpython
6
- pydantic>=2.10
7
- rich
8
- typer>=0.12.4
9
- pyyaml
10
-
11
- [testing]
12
- diracx-testing
13
-
14
- [types]
15
- types-PyYAML
File without changes