IDKit 1.0.2__tar.gz → 1.0.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IDKit
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: A typed, dot-notation identifier system for Python 3.12+.
5
5
  Author: Ryan Kohl
6
6
  License-Expression: MIT
@@ -13,6 +13,7 @@ idkit/protocols.py
13
13
  idkit/py.typed
14
14
  idkit/namespaces/__init__.py
15
15
  idkit/namespaces/group.py
16
+ idkit/namespaces/namespace.py
16
17
  idkit/namespaces/operation.py
17
18
  idkit/namespaces/role.py
18
19
  idkit/namespaces/source.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IDKit
3
- Version: 1.0.2
3
+ Version: 1.0.3
4
4
  Summary: A typed, dot-notation identifier system for Python 3.12+.
5
5
  Author: Ryan Kohl
6
6
  License-Expression: MIT
@@ -12,9 +12,10 @@ from .namespaces import (
12
12
  SourceNamespace,
13
13
  )
14
14
 
15
-
16
15
  type Identifier = Identity[GroupNamespace, SourceNamespace, RoleNamespace]
17
16
 
17
+ IDSpace = IdentityNamespace[GroupNamespace, SourceNamespace, RoleNamespace]
18
+
18
19
  type OperationIdentifier = Identity[GroupNamespace, SourceNamespace, OperationNamespace]
19
20
 
20
21
  type IDLike = IDKitIdentityLike[GroupNamespace, SourceNamespace, RoleNamespace]
@@ -40,11 +41,7 @@ and can be used as dictionary keys, registry identifiers,
40
41
  event topics, metric names, cache keys, and logging
41
42
  namespaces.
42
43
  """
43
- ID: Identifier = IdentityNamespace(
44
- group=GroupNamespace,
45
- source=SourceNamespace,
46
- role=RoleNamespace,
47
- )
44
+ ID = IDSpace(group=GroupNamespace, source=SourceNamespace, role=RoleNamespace)
48
45
 
49
46
 
50
47
  __all__ = [
@@ -4,7 +4,7 @@ from dataclasses import dataclass, field
4
4
  from enum import StrEnum
5
5
  from typing import Any, Iterator, Self
6
6
 
7
- from .namespaces import Namespace
7
+ from .namespaces.namespace import Namespace
8
8
 
9
9
 
10
10
  @dataclass(frozen=True)
@@ -215,9 +215,7 @@ class Identity[GN: Namespace, SN: Namespace, RN: Namespace]:
215
215
 
216
216
  def unique(self, unique_id: str) -> Self:
217
217
  if self.role is None:
218
- raise IdentifierValidationError(
219
- "Cannot set unique id before role."
220
- )
218
+ raise IdentifierValidationError("Cannot set unique id before role.")
221
219
 
222
220
  if self.unique_id is not None:
223
221
  raise IdentifierValidationError("Identifier already has a unique id.")
@@ -579,7 +577,7 @@ class Identity[GN: Namespace, SN: Namespace, RN: Namespace]:
579
577
  )
580
578
 
581
579
 
582
- class IdentityNamespace[G: Namespace, S: Namespace, R: Namespace]:
580
+ class IdentityNamespace[GN: Namespace, SN: Namespace, RN: Namespace]:
583
581
  """
584
582
  Entry point for constructing strongly typed identities.
585
583
 
@@ -638,15 +636,15 @@ class IdentityNamespace[G: Namespace, S: Namespace, R: Namespace]:
638
636
  def __init__(
639
637
  self,
640
638
  *,
641
- group: type[G],
642
- source: type[S],
643
- role: type[R],
639
+ group: type[GN],
640
+ source: type[SN],
641
+ role: type[RN],
644
642
  ):
645
643
  self.group = group
646
644
  self.source = source
647
645
  self.role = role
648
646
 
649
- def __getattr__(self, name: str) -> Identity[G, S, R]:
647
+ def __getattr__(self, name: str) -> Identity[GN, SN, RN]:
650
648
  if name in self.group.__members__:
651
649
  return Identity(
652
650
  group=self.group[name],
@@ -656,7 +654,7 @@ class IdentityNamespace[G: Namespace, S: Namespace, R: Namespace]:
656
654
 
657
655
  raise AttributeError(name)
658
656
 
659
- def parse(self, value: str) -> Identity[G, S, R]:
657
+ def parse(self, value: str) -> Identity[GN, SN, RN]:
660
658
  return Identity.parse(
661
659
  value,
662
660
  group_enum=self.group,
@@ -665,9 +663,6 @@ class IdentityNamespace[G: Namespace, S: Namespace, R: Namespace]:
665
663
  )
666
664
 
667
665
 
668
- IDSpace = IdentityNamespace
669
-
670
-
671
666
  class IdentifierError(Exception):
672
667
  """Base identifier exception."""
673
668
 
@@ -0,0 +1,12 @@
1
+ from .group import GroupNamespace
2
+ from .source import SourceNamespace
3
+ from .role import RoleNamespace
4
+ from .operation import OperationNamespace
5
+
6
+
7
+ __all__ = [
8
+ "GroupNamespace",
9
+ "SourceNamespace",
10
+ "RoleNamespace",
11
+ "OperationNamespace",
12
+ ]
@@ -1,7 +1,9 @@
1
- from enum import StrEnum, auto
1
+ from enum import auto
2
2
 
3
+ from .namespace import Namespace
3
4
 
4
- class GroupNamespace(StrEnum):
5
+
6
+ class GroupNamespace(Namespace):
5
7
  """
6
8
  The `Group` defines the primary classification or architectural domain of the `identifier` in the first segment. It represents the highest level of organization (e.g., `system`, `service`, `manage`).
7
9
 
@@ -13,6 +15,8 @@ class GroupNamespace(StrEnum):
13
15
  Action — What does it do?
14
16
  """
15
17
 
18
+ # value: str
19
+
16
20
  system = auto()
17
21
  service = auto()
18
22
  core = auto()
@@ -76,7 +80,7 @@ class GroupNamespace(StrEnum):
76
80
  script = auto()
77
81
 
78
82
 
79
- class Architecture(StrEnum):
83
+ class Architecture(Namespace):
80
84
  system = auto()
81
85
  service = auto()
82
86
  core = auto()
@@ -90,7 +94,7 @@ class Architecture(StrEnum):
90
94
  runtime = auto()
91
95
 
92
96
 
93
- class Infrastructure(StrEnum):
97
+ class Infrastructure(Namespace):
94
98
  database = auto()
95
99
  storage = auto()
96
100
  cache = auto()
@@ -104,7 +108,7 @@ class Infrastructure(StrEnum):
104
108
  container = auto()
105
109
 
106
110
 
107
- class Data(StrEnum):
111
+ class Data(Namespace):
108
112
  source = auto()
109
113
  stream = auto()
110
114
  pipeline = auto()
@@ -113,7 +117,7 @@ class Data(StrEnum):
113
117
  reporting = auto()
114
118
 
115
119
 
116
- class Interface(StrEnum):
120
+ class Interface(Namespace):
117
121
  api = auto()
118
122
  web = auto()
119
123
  cli = auto()
@@ -123,7 +127,7 @@ class Interface(StrEnum):
123
127
  ui = auto()
124
128
 
125
129
 
126
- class Business(StrEnum):
130
+ class Business(Namespace):
127
131
  domain = auto()
128
132
  business = auto()
129
133
  user = auto()
@@ -134,7 +138,7 @@ class Business(StrEnum):
134
138
  workspace = auto()
135
139
 
136
140
 
137
- class Automation(StrEnum):
141
+ class Automation(Namespace):
138
142
  workflow = auto()
139
143
  scheduler = auto()
140
144
  worker = auto()
@@ -147,7 +151,7 @@ class Automation(StrEnum):
147
151
  ai = auto()
148
152
 
149
153
 
150
- class Development(StrEnum):
154
+ class Development(Namespace):
151
155
  testing = auto()
152
156
  development = auto()
153
157
  staging = auto()
@@ -0,0 +1,13 @@
1
+ from enum import StrEnum
2
+
3
+ """
4
+ The Namespace is a declarative value that provides a scope for the Identifier by organizing into logical segments.
5
+
6
+ If subclasses `StrEnum` to provide a typed safe approach.
7
+
8
+ Group — Where does it belong?
9
+ Source — What is it?
10
+ Component — Which part of it?
11
+ Action — What does it do?
12
+ """
13
+ Namespace = StrEnum
@@ -1,7 +1,9 @@
1
- from enum import StrEnum, auto
1
+ from enum import auto
2
2
 
3
+ from .namespace import Namespace
3
4
 
4
- class OperationNamespace(StrEnum):
5
+
6
+ class OperationNamespace(Namespace):
5
7
  """
6
8
  An operation describes what is being performed.
7
9
 
@@ -50,7 +52,6 @@ class OperationNamespace(StrEnum):
50
52
  track = auto()
51
53
  scan = auto()
52
54
  search = auto()
53
- index = auto()
54
55
  discover = auto()
55
56
  authenticate = auto()
56
57
  authorize = auto()
@@ -67,14 +68,14 @@ class OperationNamespace(StrEnum):
67
68
  route = auto()
68
69
 
69
70
 
70
- class Lifecycle(StrEnum):
71
+ class Lifecycle(Namespace):
71
72
  create = auto()
72
73
  delete = auto()
73
74
  initialize = auto()
74
75
  destroy = auto()
75
76
 
76
77
 
77
- class CURD(StrEnum):
78
+ class CURD(Namespace):
78
79
  read = auto()
79
80
  write = auto()
80
81
  update = auto()
@@ -83,7 +84,7 @@ class CURD(StrEnum):
83
84
  delete = auto()
84
85
 
85
86
 
86
- class Process(StrEnum):
87
+ class Process(Namespace):
87
88
  analyze = auto()
88
89
  process = auto()
89
90
  transform = auto()
@@ -94,7 +95,7 @@ class Process(StrEnum):
94
95
  deserialize = auto()
95
96
 
96
97
 
97
- class Validation(StrEnum):
98
+ class Validation(Namespace):
98
99
  validate = auto()
99
100
  verify = auto()
100
101
  authorize = auto()
@@ -102,7 +103,7 @@ class Validation(StrEnum):
102
103
  confirm = auto()
103
104
 
104
105
 
105
- class Communication(StrEnum):
106
+ class Communication(Namespace):
106
107
  send = auto()
107
108
  receive = auto()
108
109
  publish = auto()
@@ -112,22 +113,20 @@ class Communication(StrEnum):
112
113
  post = auto()
113
114
 
114
115
 
115
- class Discovery(StrEnum):
116
+ class Discovery(Namespace):
116
117
  discover = auto()
117
118
  scan = auto()
118
119
  search = auto()
119
- index = auto()
120
- find = auto()
121
120
 
122
121
 
123
- class Monitoring(StrEnum):
122
+ class Monitoring(Namespace):
124
123
  monitor = auto()
125
124
  observe = auto()
126
125
  track = auto()
127
126
  watch = auto()
128
127
 
129
128
 
130
- class Execution(StrEnum):
129
+ class Execution(Namespace):
131
130
  execute = auto()
132
131
  run = auto()
133
132
  invoke = auto()
@@ -1,7 +1,9 @@
1
- from enum import StrEnum, auto
1
+ from enum import auto
2
2
 
3
+ from .namespace import Namespace
3
4
 
4
- class RoleNamespace(StrEnum):
5
+
6
+ class RoleNamespace(Namespace):
5
7
  """
6
8
  A role describes what an identifier represents as a stable responsibility.
7
9
 
@@ -1,7 +1,9 @@
1
- from enum import StrEnum, auto
1
+ from enum import auto
2
2
 
3
+ from .namespace import Namespace
3
4
 
4
- class SourceNamespace(StrEnum):
5
+
6
+ class SourceNamespace(Namespace):
5
7
  """
6
8
  The `Source` identifies the primary object, resource, or subsystem that the `identifier` represents (e.g., `runtime`, `data`, `workflow`).
7
9
 
@@ -128,7 +130,7 @@ class SourceNamespace(StrEnum):
128
130
  template = auto()
129
131
 
130
132
 
131
- class CoreObjects(StrEnum):
133
+ class CoreObjects(Namespace):
132
134
  resource = auto()
133
135
  manager = auto()
134
136
  service = auto()
@@ -143,7 +145,7 @@ class CoreObjects(StrEnum):
143
145
  server = auto()
144
146
 
145
147
 
146
- class Data(StrEnum):
148
+ class Data(Namespace):
147
149
  data = auto()
148
150
  dataset = auto()
149
151
  record = auto()
@@ -158,7 +160,7 @@ class Data(StrEnum):
158
160
  snapshot = auto()
159
161
 
160
162
 
161
- class Runtime(StrEnum):
163
+ class Runtime(Namespace):
162
164
  runtime = auto()
163
165
  engine = auto()
164
166
  process = auto()
@@ -173,7 +175,7 @@ class Runtime(StrEnum):
173
175
  session = auto()
174
176
 
175
177
 
176
- class Configuration(StrEnum):
178
+ class Configuration(Namespace):
177
179
  config = auto()
178
180
  setting = auto()
179
181
  option = auto()
@@ -184,7 +186,7 @@ class Configuration(StrEnum):
184
186
  environment = auto()
185
187
 
186
188
 
187
- class Integration(StrEnum):
189
+ class Integration(Namespace):
188
190
  connector = auto()
189
191
  gateway = auto()
190
192
  bridge = auto()
@@ -195,7 +197,7 @@ class Integration(StrEnum):
195
197
  stream = auto()
196
198
 
197
199
 
198
- class AI(StrEnum):
200
+ class AI(Namespace):
199
201
  agent = auto()
200
202
  tool = auto()
201
203
  prompt = auto()
@@ -207,7 +209,7 @@ class AI(StrEnum):
207
209
  conversation = auto()
208
210
 
209
211
 
210
- class Security(StrEnum):
212
+ class Security(Namespace):
211
213
  identity = auto()
212
214
  credential = auto()
213
215
  token = auto()
@@ -219,7 +221,7 @@ class Security(StrEnum):
219
221
  secret = auto()
220
222
 
221
223
 
222
- class Web(StrEnum):
224
+ class Web(Namespace):
223
225
  request = auto()
224
226
  response = auto()
225
227
  route = auto()
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from .namespaces import Namespace
3
+ from .namespaces.namespace import Namespace
4
4
  from typing import Any, Protocol, Self
5
5
  import uuid
6
6
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "IDKit"
7
- version = "1.0.2"
7
+ version = "1.0.3"
8
8
  description = "A typed, dot-notation identifier system for Python 3.12+."
9
9
  requires-python = ">=3.12"
10
10
  readme = "README.md"
@@ -1,29 +0,0 @@
1
- from .group import GroupNamespace
2
- from .source import SourceNamespace
3
- from .role import RoleNamespace
4
- from .operation import OperationNamespace
5
- from typing import Protocol
6
-
7
-
8
- class Namespace(Protocol):
9
- """
10
- The Namespace is a declarative value that provides a scope for the Identifier by organizing into logical segments.
11
-
12
- If subclasses `StrEnum` to provide a typed safe approach.
13
-
14
- Group — Where does it belong?
15
- Source — What is it?
16
- Component — Which part of it?
17
- Action — What does it do?
18
- """
19
-
20
- value: str
21
-
22
-
23
- __all__ = [
24
- "GroupNamespace",
25
- "SourceNamespace",
26
- "RoleNamespace",
27
- "OperationNamespace",
28
- "Namespace",
29
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes