targetprocess-py 0.1.0__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.
Files changed (58) hide show
  1. targetprocess/__init__.py +231 -0
  2. targetprocess/_assignables.py +162 -0
  3. targetprocess/_base.py +318 -0
  4. targetprocess/_content.py +287 -0
  5. targetprocess/_dates.py +70 -0
  6. targetprocess/_entity_types.py +33 -0
  7. targetprocess/_generals.py +324 -0
  8. targetprocess/_joins.py +217 -0
  9. targetprocess/_lookups.py +477 -0
  10. targetprocess/_nested.py +223 -0
  11. targetprocess/_observability.py +368 -0
  12. targetprocess/client.py +430 -0
  13. targetprocess/exceptions.py +147 -0
  14. targetprocess/models.py +121 -0
  15. targetprocess/py.typed +1 -0
  16. targetprocess/request_handler.py +724 -0
  17. targetprocess/resources/__init__.py +76 -0
  18. targetprocess/resources/assignments.py +29 -0
  19. targetprocess/resources/attachments.py +164 -0
  20. targetprocess/resources/base.py +563 -0
  21. targetprocess/resources/bugs.py +20 -0
  22. targetprocess/resources/comments.py +23 -0
  23. targetprocess/resources/custom_activities.py +56 -0
  24. targetprocess/resources/custom_fields.py +27 -0
  25. targetprocess/resources/custom_rules.py +28 -0
  26. targetprocess/resources/entities.py +433 -0
  27. targetprocess/resources/entity_states.py +20 -0
  28. targetprocess/resources/entity_types.py +61 -0
  29. targetprocess/resources/epics.py +20 -0
  30. targetprocess/resources/features.py +20 -0
  31. targetprocess/resources/iterations.py +20 -0
  32. targetprocess/resources/priorities.py +85 -0
  33. targetprocess/resources/processes.py +65 -0
  34. targetprocess/resources/projects.py +20 -0
  35. targetprocess/resources/relation_types.py +59 -0
  36. targetprocess/resources/relations.py +34 -0
  37. targetprocess/resources/releases.py +20 -0
  38. targetprocess/resources/requests.py +20 -0
  39. targetprocess/resources/role_efforts.py +21 -0
  40. targetprocess/resources/roles.py +52 -0
  41. targetprocess/resources/severities.py +53 -0
  42. targetprocess/resources/tasks.py +20 -0
  43. targetprocess/resources/team_assignments.py +21 -0
  44. targetprocess/resources/team_iterations.py +24 -0
  45. targetprocess/resources/teams.py +20 -0
  46. targetprocess/resources/terms.py +28 -0
  47. targetprocess/resources/test_cases.py +20 -0
  48. targetprocess/resources/times.py +392 -0
  49. targetprocess/resources/user_stories.py +20 -0
  50. targetprocess/resources/users.py +20 -0
  51. targetprocess/resources/workflows.py +27 -0
  52. targetprocess/response_parser.py +113 -0
  53. targetprocess/transport.py +116 -0
  54. targetprocess/types.py +56 -0
  55. targetprocess_py-0.1.0.dist-info/METADATA +476 -0
  56. targetprocess_py-0.1.0.dist-info/RECORD +58 -0
  57. targetprocess_py-0.1.0.dist-info/WHEEL +4 -0
  58. targetprocess_py-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,231 @@
1
+ """A Python library for the TargetProcess v1 REST API."""
2
+
3
+ from targetprocess._observability import (
4
+ REQUEST_ID_HEADER,
5
+ ScrubbingFilter,
6
+ StructuredJsonFormatter,
7
+ current_request_id,
8
+ get_logger,
9
+ new_request_id,
10
+ request_id_context,
11
+ )
12
+ from targetprocess.client import TargetProcessClient
13
+ from targetprocess.exceptions import (
14
+ AmbiguousMatchError,
15
+ APIError,
16
+ AuthenticationError,
17
+ ForbiddenError,
18
+ NetworkError,
19
+ NotFoundError,
20
+ ParseError,
21
+ RateLimitError,
22
+ ReadOnlyViolation,
23
+ RequestValidationError,
24
+ TargetProcessError,
25
+ )
26
+ from targetprocess.models import (
27
+ AssignableEntity,
28
+ Assignment,
29
+ Attachment,
30
+ Bug,
31
+ Comment,
32
+ CustomActivity,
33
+ CustomField,
34
+ CustomFieldConfig,
35
+ CustomFieldValue,
36
+ CustomRule,
37
+ Entity,
38
+ EntityRef,
39
+ EntityState,
40
+ EntityType,
41
+ EntityTypeRef,
42
+ Epic,
43
+ Feature,
44
+ GeneralEntity,
45
+ Iteration,
46
+ NamedEntity,
47
+ Priority,
48
+ Process,
49
+ Project,
50
+ RefWithImportance,
51
+ Relation,
52
+ RelationType,
53
+ Release,
54
+ Request,
55
+ Role,
56
+ RoleEffort,
57
+ Severity,
58
+ Task,
59
+ Team,
60
+ TeamAssignment,
61
+ TeamIteration,
62
+ Term,
63
+ TestCase,
64
+ Time,
65
+ UploadedAttachment,
66
+ UploadedFileRef,
67
+ User,
68
+ UserRef,
69
+ UserStory,
70
+ Workflow,
71
+ )
72
+ from targetprocess.request_handler import RequestHandler
73
+ from targetprocess.resources import (
74
+ AssignmentsResource,
75
+ AttachmentsResource,
76
+ BaseResource,
77
+ BugsResource,
78
+ CommentsResource,
79
+ CustomActivitiesResource,
80
+ CustomFieldsResource,
81
+ CustomRulesResource,
82
+ EntitiesResource,
83
+ EntityStatesResource,
84
+ EntityTypesResource,
85
+ EpicsResource,
86
+ FeaturesResource,
87
+ IterationsResource,
88
+ PrioritiesResource,
89
+ ProcessesResource,
90
+ ProjectsResource,
91
+ RelationsResource,
92
+ RelationTypesResource,
93
+ ReleasesResource,
94
+ RequestsResource,
95
+ RoleEffortsResource,
96
+ RolesResource,
97
+ SeveritiesResource,
98
+ TasksResource,
99
+ TeamAssignmentsResource,
100
+ TeamIterationsResource,
101
+ TeamsResource,
102
+ TermsResource,
103
+ TestCasesResource,
104
+ TimesResource,
105
+ UsersResource,
106
+ UserStoriesResource,
107
+ WorkflowsResource,
108
+ )
109
+ from targetprocess.response_parser import ResponseParser
110
+ from targetprocess.types import ClientMode, UpsertAction, UpsertResult
111
+
112
+ __version__ = "0.1.0"
113
+
114
+ __all__ = [
115
+ # Exceptions
116
+ "AmbiguousMatchError",
117
+ "APIError",
118
+ "AuthenticationError",
119
+ "ForbiddenError",
120
+ "NetworkError",
121
+ "NotFoundError",
122
+ "ParseError",
123
+ "RateLimitError",
124
+ "ReadOnlyViolation",
125
+ "RequestValidationError",
126
+ "TargetProcessError",
127
+ # Models - Base
128
+ "Entity",
129
+ "NamedEntity",
130
+ "GeneralEntity",
131
+ "AssignableEntity",
132
+ "EntityRef",
133
+ "EntityTypeRef",
134
+ "UserRef",
135
+ "RefWithImportance",
136
+ # Models - Assignable
137
+ "Bug",
138
+ "Epic",
139
+ "Feature",
140
+ "Request",
141
+ "Task",
142
+ "TestCase",
143
+ "UserStory",
144
+ # Models - Planning
145
+ "Iteration",
146
+ "Release",
147
+ # Models - Organizational
148
+ "Project",
149
+ "Team",
150
+ "User",
151
+ # Models - Workflow and configuration
152
+ "EntityState",
153
+ "Priority",
154
+ "RelationType",
155
+ "Role",
156
+ "Severity",
157
+ "Process",
158
+ "Workflow",
159
+ "EntityType",
160
+ "Term",
161
+ "CustomActivity",
162
+ "CustomRule",
163
+ # Models - Join
164
+ "TeamIteration",
165
+ "Assignment",
166
+ "TeamAssignment",
167
+ "Relation",
168
+ "RoleEffort",
169
+ "Time",
170
+ # Models - Supporting
171
+ "Comment",
172
+ "Attachment",
173
+ "UploadedAttachment",
174
+ "UploadedFileRef",
175
+ # Models - Custom fields
176
+ "CustomField",
177
+ "CustomFieldConfig",
178
+ "CustomFieldValue",
179
+ # Observability - structured logging, log scrubbing, request-ID propagation
180
+ "REQUEST_ID_HEADER",
181
+ "ScrubbingFilter",
182
+ "StructuredJsonFormatter",
183
+ "current_request_id",
184
+ "get_logger",
185
+ "new_request_id",
186
+ "request_id_context",
187
+ # Core Components
188
+ "ClientMode",
189
+ "RequestHandler",
190
+ "ResponseParser",
191
+ "TargetProcessClient",
192
+ "UpsertAction",
193
+ "UpsertResult",
194
+ # Resource Managers - Base
195
+ "BaseResource",
196
+ # Resource Managers - Typed
197
+ "AssignmentsResource",
198
+ "AttachmentsResource",
199
+ "BugsResource",
200
+ "CommentsResource",
201
+ "CustomActivitiesResource",
202
+ "CustomFieldsResource",
203
+ "CustomRulesResource",
204
+ "EntityStatesResource",
205
+ "EntityTypesResource",
206
+ "EpicsResource",
207
+ "FeaturesResource",
208
+ "IterationsResource",
209
+ "PrioritiesResource",
210
+ "ProcessesResource",
211
+ "ProjectsResource",
212
+ "RelationTypesResource",
213
+ "RelationsResource",
214
+ "ReleasesResource",
215
+ "RequestsResource",
216
+ "RoleEffortsResource",
217
+ "RolesResource",
218
+ "SeveritiesResource",
219
+ "TasksResource",
220
+ "TeamAssignmentsResource",
221
+ "TeamIterationsResource",
222
+ "TeamsResource",
223
+ "TermsResource",
224
+ "TestCasesResource",
225
+ "TimesResource",
226
+ "UserStoriesResource",
227
+ "UsersResource",
228
+ "WorkflowsResource",
229
+ # Resource Managers - Generic
230
+ "EntitiesResource",
231
+ ]
@@ -0,0 +1,162 @@
1
+ """The six ``Assignable`` work-item types.
2
+
3
+ Everything these share - effort, flow metrics, planning references, workflow
4
+ state, assigned users - is declared once on
5
+ :class:`targetprocess._base.AssignableEntity`. Each class below adds only what
6
+ TP's ``/meta`` declares beyond that base for its own type. ``InitialEstimate``
7
+ and ``Build`` recur but are deliberately not on the base: TP gives Task and Bug
8
+ no ``InitialEstimate``, and Task no ``Build``.
9
+
10
+ Re-exported by :mod:`targetprocess.models`, which stays the import surface
11
+ callers use.
12
+ """
13
+
14
+ from pydantic import Field
15
+
16
+ from targetprocess._base import AssignableEntity
17
+ from targetprocess._nested import EntityRef, RefWithImportance
18
+
19
+
20
+ class UserStory(AssignableEntity):
21
+ """User story entity in agile workflows.
22
+
23
+ The central work item: a requirement sized in effort, placed in a release
24
+ and iteration, and worked by an assigned team. Adds a ``Feature`` parent to
25
+ the assignable base.
26
+
27
+ Attributes:
28
+ initial_estimate: Effort at the point the story was first estimated
29
+ feature: Parent feature reference
30
+ build: Build reference
31
+ """
32
+
33
+ initial_estimate: float | None = Field(
34
+ default=None, alias="InitialEstimate", description="Initial effort"
35
+ )
36
+ feature: EntityRef | None = Field(default=None, alias="Feature", description="Parent feature")
37
+ build: EntityRef | None = Field(default=None, alias="Build", description="Build")
38
+
39
+
40
+ class Bug(AssignableEntity):
41
+ """Bug/defect entity.
42
+
43
+ Adds a ``Severity`` alongside the inherited ``Priority`` - TP ranks a bug
44
+ on both axes, each an ``{Id, Name, Importance}`` reference - and the
45
+ ``UserStory``/``Feature`` the defect was found against.
46
+
47
+ Attributes:
48
+ severity: Severity reference (e.g. {Name: "Blocking", Importance: 1})
49
+ user_story: Parent user story reference
50
+ feature: Parent feature reference
51
+ build: Build reference
52
+ """
53
+
54
+ severity: RefWithImportance | None = Field(
55
+ default=None, alias="Severity", description="Severity"
56
+ )
57
+ user_story: EntityRef | None = Field(
58
+ default=None, alias="UserStory", description="Parent user story"
59
+ )
60
+ feature: EntityRef | None = Field(default=None, alias="Feature", description="Parent feature")
61
+ build: EntityRef | None = Field(default=None, alias="Build", description="Build")
62
+
63
+
64
+ class Task(AssignableEntity):
65
+ """Task entity for work breakdown.
66
+
67
+ The finest-grained work item: a step under a ``UserStory``. Alone among the
68
+ assignables it carries neither an ``InitialEstimate`` nor a ``Build``.
69
+
70
+ ``parent`` is not declared in TP's ``/meta`` for Task but is queryable and
71
+ returns the owning ``Assignable``; ``user_story`` is the documented
72
+ reference and the one to prefer.
73
+
74
+ Attributes:
75
+ user_story: Parent user story reference
76
+ parent: Parent entity reference (undocumented; prefer user_story)
77
+ """
78
+
79
+ user_story: EntityRef | None = Field(
80
+ default=None, alias="UserStory", description="Parent user story"
81
+ )
82
+ parent: EntityRef | None = Field(default=None, alias="Parent", description="Parent entity")
83
+
84
+
85
+ class Feature(AssignableEntity):
86
+ """Feature entity for product capabilities.
87
+
88
+ A capability grouping user stories, itself rolled up under an ``Epic`` or
89
+ ``PortfolioEpic``.
90
+
91
+ Attributes:
92
+ initial_estimate: Effort at the point the feature was first estimated
93
+ business_value: Business value
94
+ epic: Parent epic reference
95
+ portfolio_epic: Parent portfolio epic reference
96
+ build: Build reference
97
+ """
98
+
99
+ initial_estimate: float | None = Field(
100
+ default=None, alias="InitialEstimate", description="Initial effort"
101
+ )
102
+ business_value: int | None = Field(
103
+ default=None, alias="BusinessValue", description="Business value"
104
+ )
105
+ epic: EntityRef | None = Field(default=None, alias="Epic", description="Parent epic")
106
+ portfolio_epic: EntityRef | None = Field(
107
+ default=None, alias="PortfolioEpic", description="Parent portfolio epic"
108
+ )
109
+ build: EntityRef | None = Field(default=None, alias="Build", description="Build")
110
+
111
+
112
+ class Epic(AssignableEntity):
113
+ """Epic entity for large initiatives.
114
+
115
+ Groups features under a single initiative, itself rolled up under a
116
+ ``PortfolioEpic``.
117
+
118
+ Attributes:
119
+ initial_estimate: Effort at the point the epic was first estimated
120
+ business_value: Business value
121
+ portfolio_epic: Parent portfolio epic reference
122
+ build: Build reference
123
+ """
124
+
125
+ initial_estimate: float | None = Field(
126
+ default=None, alias="InitialEstimate", description="Initial effort"
127
+ )
128
+ business_value: int | None = Field(
129
+ default=None, alias="BusinessValue", description="Business value"
130
+ )
131
+ portfolio_epic: EntityRef | None = Field(
132
+ default=None, alias="PortfolioEpic", description="Parent portfolio epic"
133
+ )
134
+ build: EntityRef | None = Field(default=None, alias="Build", description="Build")
135
+
136
+
137
+ class Request(AssignableEntity):
138
+ """Request entity for feature/change requests.
139
+
140
+ The inbound-facing assignable: raised by a requester rather than planned,
141
+ so it carries a source, a reply flag, a privacy flag and a vote count that
142
+ the other work-item types have no use for.
143
+
144
+ Attributes:
145
+ source_type: How the request arrived (e.g. "None", "Email", "Portal")
146
+ is_replied: Whether the requester has had a reply
147
+ is_private: Whether the request is hidden from the requester portal
148
+ votes_count: Number of votes the request has attracted
149
+ request_type: Request-type reference (e.g. "Enhancement")
150
+ build: Build reference
151
+ """
152
+
153
+ source_type: str | None = Field(default=None, alias="SourceType", description="Request source")
154
+ is_replied: bool | None = Field(
155
+ default=None, alias="IsReplied", description="Whether replied to"
156
+ )
157
+ is_private: bool | None = Field(default=None, alias="IsPrivate", description="Whether private")
158
+ votes_count: int | None = Field(default=None, alias="VotesCount", description="Vote count")
159
+ request_type: EntityRef | None = Field(
160
+ default=None, alias="RequestType", description="Request type"
161
+ )
162
+ build: EntityRef | None = Field(default=None, alias="Build", description="Build")