diracx-client 0.0.1a17__tar.gz → 0.0.1a19__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/PKG-INFO +2 -2
  2. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/pyproject.toml +12 -15
  3. diracx_client-0.0.1a19/src/diracx/client/__init__.py +7 -0
  4. diracx_client-0.0.1a19/src/diracx/client/aio.py +1 -0
  5. diracx_client-0.0.1a19/src/diracx/client/extensions.py +90 -0
  6. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/__init__.py +2 -2
  7. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/_client.py +7 -6
  8. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/_configuration.py +1 -1
  9. diracx_client-0.0.1a19/src/diracx/client/generated/_patch.py +47 -0
  10. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/_serialization.py +301 -151
  11. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/_vendor.py +1 -1
  12. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/aio/__init__.py +2 -2
  13. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/aio/_client.py +7 -6
  14. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/aio/_configuration.py +1 -1
  15. diracx_client-0.0.1a19/src/diracx/client/generated/aio/_patch.py +23 -0
  16. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/aio/_vendor.py +1 -1
  17. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated/aio}/operations/__init__.py +1 -1
  18. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/aio/operations/_operations.py +402 -385
  19. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/models/__init__.py +3 -1
  20. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/models/_enums.py +2 -2
  21. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/models/_models.py +84 -43
  22. {diracx_client-0.0.1a17/src/diracx/client/aio → diracx_client-0.0.1a19/src/diracx/client/generated}/operations/__init__.py +1 -1
  23. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/operations/_operations.py +402 -385
  24. diracx_client-0.0.1a19/src/diracx/client/models.py +5 -0
  25. diracx_client-0.0.1a19/src/diracx/client/patches/__init__.py +19 -0
  26. diracx_client-0.0.1a19/src/diracx/client/patches/aio/__init__.py +18 -0
  27. diracx_client-0.0.1a17/src/diracx/client/aio/_patch.py → diracx_client-0.0.1a19/src/diracx/client/patches/aio/utils.py +10 -19
  28. diracx_client-0.0.1a17/src/diracx/client/_patch.py → diracx_client-0.0.1a19/src/diracx/client/patches/utils.py +98 -121
  29. diracx_client-0.0.1a19/src/diracx/client/py.typed +1 -0
  30. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/src/diracx_client.egg-info/PKG-INFO +2 -2
  31. diracx_client-0.0.1a19/src/diracx_client.egg-info/SOURCES.txt +40 -0
  32. diracx_client-0.0.1a19/src/diracx_client.egg-info/entry_points.txt +3 -0
  33. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/tests/test_regenerate.py +8 -9
  34. diracx_client-0.0.1a17/src/diracx_client.egg-info/SOURCES.txt +0 -30
  35. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/README.md +0 -0
  36. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/setup.cfg +0 -0
  37. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/aio/operations/_patch.py +0 -0
  38. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/models/_patch.py +0 -0
  39. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/operations/_patch.py +0 -0
  40. {diracx_client-0.0.1a17/src/diracx/client → diracx_client-0.0.1a19/src/diracx/client/generated}/py.typed +0 -0
  41. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/src/diracx_client.egg-info/dependency_links.txt +0 -0
  42. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/src/diracx_client.egg-info/requires.txt +0 -0
  43. {diracx_client-0.0.1a17 → diracx_client-0.0.1a19}/src/diracx_client.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: diracx-client
3
- Version: 0.0.1a17
3
+ Version: 0.0.1a19
4
4
  Summary: TODO
5
5
  License: GPL-3.0-only
6
6
  Classifier: Intended Audience :: Science/Research
@@ -8,7 +8,7 @@ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Topic :: Scientific/Engineering
10
10
  Classifier: Topic :: System :: Distributed Computing
11
- Requires-Python: >=3.10
11
+ Requires-Python: >=3.11
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: azure-core
14
14
  Requires-Dist: diracx-core
@@ -2,9 +2,9 @@
2
2
  name = "diracx-client"
3
3
  description = "TODO"
4
4
  readme = "README.md"
5
- requires-python = ">=3.10"
5
+ requires-python = ">=3.11"
6
6
  keywords = []
7
- license = {text = "GPL-3.0-only"}
7
+ license = { text = "GPL-3.0-only" }
8
8
  classifiers = [
9
9
  "Intended Audience :: Science/Research",
10
10
  "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
@@ -12,21 +12,12 @@ classifiers = [
12
12
  "Topic :: Scientific/Engineering",
13
13
  "Topic :: System :: Distributed Computing",
14
14
  ]
15
- dependencies = [
16
- "azure-core",
17
- "diracx-core",
18
- "isodate",
19
- "requests",
20
- ]
15
+ dependencies = ["azure-core", "diracx-core", "isodate", "requests"]
21
16
  dynamic = ["version"]
22
17
 
23
18
  [project.optional-dependencies]
24
- testing = [
25
- "diracx-testing",
26
- ]
27
- types = [
28
- "types-requests",
29
- ]
19
+ testing = ["diracx-testing"]
20
+ types = ["types-requests"]
30
21
 
31
22
  [tool.setuptools.packages.find]
32
23
  where = ["src"]
@@ -35,6 +26,11 @@ where = ["src"]
35
26
  requires = ["setuptools>=61", "wheel", "setuptools_scm>=8"]
36
27
  build-backend = "setuptools.build_meta"
37
28
 
29
+ [project.entry-points."diracx"]
30
+ client_class = "diracx.client.generated._client:Dirac"
31
+ aio_client_class = "diracx.client.generated.aio._client:Dirac"
32
+
33
+
38
34
  [tool.setuptools_scm]
39
35
  root = ".."
40
36
 
@@ -42,7 +38,8 @@ root = ".."
42
38
  testpaths = ["tests"]
43
39
  addopts = [
44
40
  "-v",
45
- "--cov=diracx.client", "--cov-report=term-missing",
41
+ "--cov=diracx.client",
42
+ "--cov-report=term-missing",
46
43
  "-pdiracx.testing",
47
44
  "--import-mode=importlib",
48
45
  ]
@@ -0,0 +1,7 @@
1
+ from .extensions import initialize_client
2
+
3
+ initialize_client()
4
+
5
+
6
+ from .generated import * # pylint: disable=unused-wildcard-import
7
+ from .patches import DiracClient
@@ -0,0 +1 @@
1
+ from .patches.aio import DiracClient
@@ -0,0 +1,90 @@
1
+ import os
2
+ import sys
3
+ import importlib
4
+
5
+ from importlib.abc import MetaPathFinder
6
+ from importlib.machinery import SourceFileLoader, ModuleSpec
7
+
8
+
9
+ class DiracxLoader(SourceFileLoader):
10
+
11
+ def create_module(self, spec):
12
+ if spec.name in sys.modules:
13
+ return sys.modules[spec.name]
14
+
15
+ def exec_module(self, module): ...
16
+
17
+
18
+ class DiracxPathFinder(MetaPathFinder):
19
+ """
20
+ This MetaPathFinder modifies the import such that the patches
21
+ from vanila diracx are looked at first.
22
+ """
23
+
24
+ diracx_extensions = os.environ.get("DIRACX_EXTENSIONS", "diracx").split(",")
25
+
26
+ @classmethod
27
+ def find_spec(cls, fullname, path, target=None):
28
+ for i, extension in enumerate(cls.diracx_extensions, start=1):
29
+ # If we are trying to load the patch from an extension
30
+ # make sure it does not exist in the lower levels first
31
+ if any(
32
+ [
33
+ fullname.startswith(prefix)
34
+ for prefix in [
35
+ f"{extension}.client.generated.operations._patch",
36
+ f"{extension}.client.generated.models._patch",
37
+ f"{extension}.client.generated.aio.operations._patch",
38
+ ]
39
+ ]
40
+ ):
41
+ for lower_extension in cls.diracx_extensions[i:][::-1]:
42
+ try:
43
+ patched_name = fullname.replace(extension, lower_extension)
44
+ overwritten = importlib.util.find_spec(patched_name)
45
+
46
+ spec = ModuleSpec(
47
+ patched_name, DiracxLoader(patched_name, path)
48
+ )
49
+ return spec
50
+ if patched_name in sys.modules:
51
+ return sys.modules[patched_name].__spec__
52
+
53
+ overwritten = importlib.util.find_spec(patched_name)
54
+
55
+ # overwritten = spec_from_loader(patched_name, DiracxLoader(filepath))
56
+ return overwritten
57
+ except Exception as e:
58
+ pass
59
+
60
+ return None
61
+
62
+
63
+ def initialize_client():
64
+
65
+ # insert a DiracxPathFinder instance at the start of the meta_path list
66
+ if not isinstance(sys.meta_path[0], DiracxPathFinder):
67
+
68
+ sys.meta_path.insert(0, DiracxPathFinder())
69
+
70
+ # Reload all the client module that could potentially have been
71
+ # already loaded
72
+ # This was needed when the generated code was at the top
73
+ # level of the module.
74
+ # In principle, this is not needed anymore so I comment it out,
75
+ # but in case it ends up being needed, I keep it there, as it is rather
76
+ # tricky
77
+ # importlib.invalidate_caches()
78
+ # diracx_extensions = os.environ.get("DIRACX_EXTENSIONS", "diracx").split(",")
79
+ # for top_module in diracx_extensions:
80
+ # for module_name, module in sys.modules.copy().items():
81
+ # if (
82
+ # (f"{top_module}.client" in module_name)
83
+ # and module_name
84
+ # not in (
85
+ # f"{top_module}.client.generated",
86
+ # f"{top_module}.client.generated._patch",
87
+ # )
88
+ # and "_patch" in module_name
89
+ # ):
90
+ # importlib.reload(module)
@@ -1,6 +1,6 @@
1
1
  # coding=utf-8
2
2
  # --------------------------------------------------------------------------
3
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.19)
3
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.0, generator: @autorest/python@6.23.0)
4
4
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
5
5
  # --------------------------------------------------------------------------
6
6
 
@@ -9,7 +9,7 @@ from ._client import Dirac
9
9
  try:
10
10
  from ._patch import __all__ as _patch_all
11
11
  from ._patch import * # pylint: disable=unused-wildcard-import
12
- except ImportError:
12
+ except ValueError:
13
13
  _patch_all = []
14
14
  from ._patch import patch_sdk as _patch_sdk
15
15
 
@@ -1,11 +1,12 @@
1
1
  # coding=utf-8
2
2
  # --------------------------------------------------------------------------
3
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.19)
3
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.0, generator: @autorest/python@6.23.0)
4
4
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
5
5
  # --------------------------------------------------------------------------
6
6
 
7
7
  from copy import deepcopy
8
8
  from typing import Any
9
+ from typing_extensions import Self
9
10
 
10
11
  from azure.core import PipelineClient
11
12
  from azure.core.pipeline import policies
@@ -26,13 +27,13 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
26
27
  """Dirac.
27
28
 
28
29
  :ivar well_known: WellKnownOperations operations
29
- :vartype well_known: client.operations.WellKnownOperations
30
+ :vartype well_known: generated.operations.WellKnownOperations
30
31
  :ivar auth: AuthOperations operations
31
- :vartype auth: client.operations.AuthOperations
32
+ :vartype auth: generated.operations.AuthOperations
32
33
  :ivar config: ConfigOperations operations
33
- :vartype config: client.operations.ConfigOperations
34
+ :vartype config: generated.operations.ConfigOperations
34
35
  :ivar jobs: JobsOperations operations
35
- :vartype jobs: client.operations.JobsOperations
36
+ :vartype jobs: generated.operations.JobsOperations
36
37
  :keyword endpoint: Service URL. Required. Default value is "".
37
38
  :paramtype endpoint: str
38
39
  """
@@ -112,7 +113,7 @@ class Dirac: # pylint: disable=client-accepts-api-version-keyword
112
113
  def close(self) -> None:
113
114
  self._client.close()
114
115
 
115
- def __enter__(self) -> "Dirac":
116
+ def __enter__(self) -> Self:
116
117
  self._client.__enter__()
117
118
  return self
118
119
 
@@ -1,6 +1,6 @@
1
1
  # coding=utf-8
2
2
  # --------------------------------------------------------------------------
3
- # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/python@6.13.19)
3
+ # Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.0, generator: @autorest/python@6.23.0)
4
4
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
5
5
  # --------------------------------------------------------------------------
6
6
 
@@ -0,0 +1,47 @@
1
+ # ------------------------------------
2
+ # Copyright (c) Microsoft Corporation.
3
+ # Licensed under the MIT License.
4
+ # ------------------------------------
5
+ """Customize generated code here.
6
+
7
+ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ from datetime import datetime, timezone
13
+ import importlib.util
14
+ import json
15
+ import jwt
16
+ import requests
17
+
18
+ from pathlib import Path
19
+ from typing import Any, Dict, List, Optional, cast
20
+ from urllib import parse
21
+ from azure.core.credentials import AccessToken
22
+ from azure.core.credentials import TokenCredential
23
+ from azure.core.pipeline import PipelineRequest
24
+ from azure.core.pipeline.policies import BearerTokenCredentialPolicy
25
+
26
+ from diracx.core.preferences import DiracxPreferences, get_diracx_preferences
27
+
28
+
29
+ import sys
30
+ import importlib
31
+ from importlib.abc import MetaPathFinder, Loader
32
+
33
+ __all__: List[str] = [
34
+ "DiracClient",
35
+ ] # Add all objects you want publicly available to users at this package level
36
+
37
+
38
+ def patch_sdk():
39
+ """Do not remove from this file.
40
+
41
+ `patch_sdk` is a last resort escape hatch that allows you to do customizations
42
+ you can't accomplish using the techniques described in
43
+ https://aka.ms/azsdk/python/dpcodegen/python/customize
44
+ """
45
+
46
+
47
+ from ..patches import DiracClient