diracx-cli 0.0.1a44__tar.gz → 0.0.1a46__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.1a46/.gitignore +98 -0
  2. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/PKG-INFO +5 -6
  3. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/pyproject.toml +10 -7
  4. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/auth.py +6 -2
  5. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/internal/config.py +23 -23
  6. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/internal/legacy.py +5 -5
  7. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/legacy/cs_sync/integration_test.cfg +1 -0
  8. diracx_cli-0.0.1a44/setup.cfg +0 -4
  9. diracx_cli-0.0.1a44/src/diracx_cli.egg-info/PKG-INFO +0 -25
  10. diracx_cli-0.0.1a44/src/diracx_cli.egg-info/SOURCES.txt +0 -27
  11. diracx_cli-0.0.1a44/src/diracx_cli.egg-info/dependency_links.txt +0 -1
  12. diracx_cli-0.0.1a44/src/diracx_cli.egg-info/entry_points.txt +0 -9
  13. diracx_cli-0.0.1a44/src/diracx_cli.egg-info/requires.txt +0 -15
  14. diracx_cli-0.0.1a44/src/diracx_cli.egg-info/top_level.txt +0 -1
  15. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/README.md +0 -0
  16. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/__init__.py +0 -0
  17. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/__main__.py +0 -0
  18. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/config.py +0 -0
  19. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/internal/__init__.py +0 -0
  20. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/jobs.py +0 -0
  21. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/py.typed +0 -0
  22. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/src/diracx/cli/utils.py +0 -0
  23. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/legacy/cs_sync/integration_test.yaml +0 -0
  24. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/legacy/cs_sync/integration_test_buggy.cfg +0 -0
  25. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/legacy/cs_sync/integration_test_secret.cfg +0 -0
  26. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/legacy/cs_sync/test_cssync.py +0 -0
  27. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/legacy/test_legacy.py +0 -0
  28. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/test_internal.py +0 -0
  29. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/test_jobs.py +0 -0
  30. {diracx_cli-0.0.1a44 → diracx_cli-0.0.1a46}/tests/test_login.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.1a44
3
+ Version: 0.0.1a46
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
19
- Requires-Dist: rich
20
- Requires-Dist: typer>=0.12.4
21
18
  Requires-Dist: pyyaml
19
+ Requires-Dist: rich
20
+ Requires-Dist: typer>=0.15.4
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'
@@ -20,7 +20,7 @@ dependencies = [
20
20
  "gitpython",
21
21
  "pydantic>=2.10",
22
22
  "rich",
23
- "typer>=0.12.4",
23
+ "typer>=0.15.4",
24
24
  "pyyaml",
25
25
  ]
26
26
  dynamic = ["version"]
@@ -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 = [
@@ -12,7 +12,9 @@ from typing import Annotated, Optional
12
12
  import typer
13
13
 
14
14
  from diracx.client.aio import AsyncDiracClient
15
- from diracx.client.models import DeviceFlowErrorResponse
15
+
16
+ # See https://github.com/DIRACGrid/diracx/issues/578
17
+ from diracx.client.models import DeviceFlowErrorResponse # type: ignore [attr-defined]
16
18
  from diracx.core.preferences import get_diracx_preferences
17
19
  from diracx.core.utils import read_credentials, write_credentials
18
20
 
@@ -88,7 +90,9 @@ async def login(
88
90
  )
89
91
  while expires > datetime.now(tz=timezone.utc):
90
92
  print(".", end="", flush=True)
91
- response = await api.auth.get_oidc_token(device_code=data.device_code, client_id=api.client_id) # type: ignore
93
+ response = await api.auth.get_oidc_token(
94
+ device_code=data.device_code, client_id=api.client_id
95
+ ) # type: ignore
92
96
  if isinstance(response, DeviceFlowErrorResponse):
93
97
  if response.error == "authorization_pending":
94
98
  # TODO: Setting more than 5 seconds results in an error
@@ -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)
@@ -95,8 +95,9 @@ def _apply_fixes(raw):
95
95
  raw["DIRAC"].pop("Extensions", None)
96
96
  raw["DIRAC"].pop("Framework", None)
97
97
  raw["DIRAC"].pop("Security", None)
98
+ raw["DIRAC"].pop("PreferredURLPatterns", None)
98
99
 
99
- # This is VOMS specific and no longer reqired
100
+ # This is VOMS specific and no longer required
100
101
  raw["DIRAC"].pop("ConnConf", None)
101
102
 
102
103
  # Setups are no longer supported
@@ -265,7 +266,6 @@ def generate_helm_values(
265
266
  from diracx.core.extensions import select_from_extension
266
267
 
267
268
  for entry_point in select_from_extension(group="diracx.db.sql"):
268
-
269
269
  db_name = entry_point.name
270
270
  db_config = all_db_configs.get(db_name, {})
271
271
 
@@ -284,9 +284,9 @@ def generate_helm_values(
284
284
  if "Password" in db_config:
285
285
  sql_dbs["dbs"][db_name]["password"] = db_config.get("Password")
286
286
  if "Host" in db_config or "Port" in db_config:
287
- sql_dbs["dbs"][db_name][
288
- "host"
289
- ] = f"{db_config.get('Host', default_db_host)}:{db_config.get('Port', default_db_port)}"
287
+ sql_dbs["dbs"][db_name]["host"] = (
288
+ f"{db_config.get('Host', default_db_host)}:{db_config.get('Port', default_db_port)}"
289
+ )
290
290
  if not sql_dbs["dbs"][db_name]:
291
291
  sql_dbs["dbs"][db_name] = None
292
292
 
@@ -1,6 +1,7 @@
1
1
  DIRAC
2
2
  {
3
3
  VirtualOrganization = vo
4
+ PreferredURLPatterns = .*\.main\.invalid/.*
4
5
  Configuration
5
6
  {
6
7
  Name = Production
@@ -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.1a44
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