port-ocean 0.5.6__py3-none-any.whl → 0.5.8__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.

Potentially problematic release.


This version of port-ocean might be problematic. Click here for more details.

@@ -156,9 +156,9 @@ async def event_context(
156
156
  event_kind=event.event_type,
157
157
  event_id=event.id,
158
158
  event_parent_id=event.parent_id,
159
- event_resource_kind=event.resource_config.kind
160
- if event.resource_config
161
- else None,
159
+ event_resource_kind=(
160
+ event.resource_config.kind if event.resource_config else None
161
+ ),
162
162
  ):
163
163
  logger.info("Event started")
164
164
  try:
@@ -38,7 +38,9 @@ class KafkaEventListenerSettings(EventListenerSettings):
38
38
  """
39
39
 
40
40
  type: Literal["KAFKA"]
41
- brokers: str = "b-1-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196,b-2-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196,b-3-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196"
41
+ brokers: str = (
42
+ "b-1-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196,b-2-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196,b-3-public.publicclusterprod.t9rw6w.c1.kafka.eu-west-1.amazonaws.com:9196"
43
+ )
42
44
  security_protocol: str = "SASL_SSL"
43
45
  authentication_mechanism: str = "SCRAM-SHA-512"
44
46
  kafka_security_enabled: bool = True
@@ -2,6 +2,7 @@ import asyncio
2
2
  import functools
3
3
  from functools import lru_cache
4
4
  from typing import Any
5
+ from loguru import logger
5
6
 
6
7
  import pyjq as jq # type: ignore
7
8
 
@@ -67,25 +68,74 @@ class JQEntityProcessor(BaseEntityProcessor):
67
68
 
68
69
  return result
69
70
 
71
+ async def _get_entity_if_passed_selector(
72
+ self,
73
+ data: dict[str, Any],
74
+ raw_entity_mappings: dict[str, Any],
75
+ selector_query: str,
76
+ ) -> dict[str, Any]:
77
+ should_run = await self._search_as_bool(data, selector_query)
78
+ if should_run:
79
+ return await self._search_as_object(data, raw_entity_mappings)
80
+ return {}
81
+
82
+ async def _calculate_entity(
83
+ self,
84
+ data: dict[str, Any],
85
+ raw_entity_mappings: dict[str, Any],
86
+ items_to_parse: str | None,
87
+ selector_query: str,
88
+ ) -> list[dict[str, Any]]:
89
+ if items_to_parse:
90
+ items = await self._search(data, items_to_parse)
91
+ if isinstance(items, list):
92
+ return await asyncio.gather(
93
+ *[
94
+ self._get_entity_if_passed_selector(
95
+ {"item": item, **data},
96
+ raw_entity_mappings,
97
+ selector_query,
98
+ )
99
+ for item in items
100
+ ]
101
+ )
102
+ logger.warning(
103
+ f"Failed to parse items for JQ expression {items_to_parse}, Expected list but got {type(items)}."
104
+ f" Skipping..."
105
+ )
106
+ else:
107
+ return [
108
+ await self._get_entity_if_passed_selector(
109
+ data, raw_entity_mappings, selector_query
110
+ )
111
+ ]
112
+ return [{}]
113
+
70
114
  async def _calculate_entities(
71
115
  self, mapping: ResourceConfig, raw_data: list[dict[str, Any]]
72
116
  ) -> list[Entity]:
73
- async def calculate_raw(data: dict[str, Any]) -> dict[str, Any]:
74
- should_run = await self._search_as_bool(data, mapping.selector.query)
75
- if should_run and mapping.port.entity:
76
- return await self._search_as_object(
77
- data, mapping.port.entity.mappings.dict(exclude_unset=True)
117
+ raw_entity_mappings: dict[str, Any] = mapping.port.entity.mappings.dict(
118
+ exclude_unset=True
119
+ )
120
+ entities_tasks = [
121
+ asyncio.create_task(
122
+ self._calculate_entity(
123
+ data,
124
+ raw_entity_mappings,
125
+ mapping.port.items_to_parse,
126
+ mapping.selector.query,
78
127
  )
79
- return {}
80
-
81
- entities_tasks = [asyncio.create_task(calculate_raw(data)) for data in raw_data]
128
+ )
129
+ for data in raw_data
130
+ ]
82
131
  entities = await asyncio.gather(*entities_tasks)
83
132
 
84
133
  return [
85
134
  Entity.parse_obj(entity_data)
135
+ for flatten in entities
86
136
  for entity_data in filter(
87
137
  lambda entity: entity.get("identifier") and entity.get("blueprint"),
88
- entities,
138
+ flatten,
89
139
  )
90
140
  ]
91
141
 
@@ -19,6 +19,7 @@ class PortResourceConfig(BaseModel):
19
19
  mappings: EntityMapping
20
20
 
21
21
  entity: MappingsConfig
22
+ items_to_parse: str | None = Field(alias="itemsToParse")
22
23
 
23
24
 
24
25
  class Selector(BaseModel):
@@ -35,6 +35,7 @@ def _stdout_loguru_handler(level: LogLevelType) -> None:
35
35
  diagnose=False, # hide variable values in log backtrace
36
36
  filter=sensitive_log_filter.create_filter(),
37
37
  )
38
+ logger.configure(patcher=exception_deserializer)
38
39
 
39
40
 
40
41
  def _http_loguru_handler(level: LogLevelType) -> None:
@@ -50,6 +51,7 @@ def _http_loguru_handler(level: LogLevelType) -> None:
50
51
  enqueue=True, # process logs in background
51
52
  filter=sensitive_log_filter.create_filter(full_hide=True),
52
53
  )
54
+ logger.configure(patcher=exception_deserializer)
53
55
 
54
56
  queue_listener = QueueListener(queue, HTTPMemoryHandler())
55
57
  queue_listener.start()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: port-ocean
3
- Version: 0.5.6
3
+ Version: 0.5.8
4
4
  Summary: Port Ocean is a CLI tool for managing your Port projects.
5
5
  Home-page: https://app.getport.io
6
6
  Keywords: ocean,port-ocean,port
@@ -42,8 +42,7 @@ Requires-Dist: werkzeug (>=2.3.4,<4.0.0)
42
42
  Project-URL: Repository, https://github.com/port-labs/Port-Ocean
43
43
  Description-Content-Type: text/markdown
44
44
 
45
- <img src="./assets/Thumbnail.jpg" alt="Ocean">
46
-
45
+ <img src="./assets/Thumbnail.png" alt="Ocean">
47
46
 
48
47
  # Ocean <img src="./assets/OceanSymbol.svg" alt="Ocean" width="100" height="100" align="right">
49
48
 
@@ -56,9 +55,8 @@ empowering engineers to effortlessly prioritize key features and streamline the
56
55
 
57
56
  - Python 3.11
58
57
 
59
-
60
-
61
58
  ## Installation
59
+
62
60
  In order to install the Ocean Framework, run the following command:
63
61
 
64
62
  ```bash
@@ -73,7 +71,7 @@ poetry add port-ocean[cli]
73
71
 
74
72
  ## Run Integration
75
73
 
76
- 1. source the integration venv
74
+ 1. source the integration venv
77
75
 
78
76
  ```bash
79
77
  . .venv/bin/activate
@@ -91,14 +89,15 @@ poetry add port-ocean[cli]
91
89
  ![image](./assets/ExportArchitecture.svg)
92
90
 
93
91
  ## Real-Time updates Architecture
92
+
94
93
  ![image](./assets/RealTimeUpdatesArchitecture.svg)
95
94
 
96
95
  ## Integration Lifecycle
97
96
 
98
97
  ![image](./assets/LifecycleOfIntegration.svg)
99
98
 
100
-
101
99
  ## Folder Structure
100
+
102
101
  The Ocean Integration Framework follows a specific folder structure within this mono repository. This structure ensures proper organization and easy identification of integration modules. The suggested folder structure is as follows:
103
102
 
104
103
  ```
@@ -122,9 +121,11 @@ port-ocean/
122
121
  - The `pyproject.toml` file inside each integration folder lists the required dependencies for that integration.
123
122
 
124
123
  ## Configuration
124
+
125
125
  The Integration Framework utilizes a `config.yaml` file for its configuration. This file defines both the framework configuration and the integration configuration within it. Each integration is identified by its type and unique identifier, which are utilized during initialization to appropriately update Port.
126
126
 
127
127
  Example `config.yaml`:
128
+
128
129
  ```yaml
129
130
  # This is an example configuration file for the integration service.
130
131
  # Please copy this file to config.yaml file in the integration folder and edit it to your needs.
@@ -153,6 +154,7 @@ The reason Ocean is open source is that we aim for the Port integration library
153
154
  In order to learn how you can contribute to Ocean, read our [contributing guide](./CONTRIBUTING.md)
154
155
 
155
156
  ### Local Development (Framework)
157
+
156
158
  1. Clone the repository
157
159
 
158
160
  2. Install dependencies:
@@ -174,6 +176,7 @@ In order to learn how you can contribute to Ocean, read our [contributing guide]
174
176
  ```
175
177
 
176
178
  ### Local Development (Integration)
179
+
177
180
  1. Clone the repository
178
181
 
179
182
  2. For new integration run
@@ -209,7 +212,10 @@ In order to learn how you can contribute to Ocean, read our [contributing guide]
209
212
  ```
210
213
 
211
214
  ## License
215
+
212
216
  The Ocean Framework is open-source software licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). See the [LICENSE](./LICENSE) file for more information.
213
217
 
214
218
  ## Contact
219
+
215
220
  For any questions or inquiries, please reach out to our team at support@getport.io
221
+
@@ -53,7 +53,7 @@ port_ocean/config/settings.py,sha256=fjBwVdkydkCAoVDi4FPn-2huLfyVdMHfmWFaFKB5smA
53
53
  port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  port_ocean/consumers/kafka_consumer.py,sha256=N8KocjBi9aR0BOPG8hgKovg-ns_ggpEjrSxqSqF_BSo,4710
55
55
  port_ocean/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
- port_ocean/context/event.py,sha256=oMXCG0sx5cR2f1_i3cW8zG4ZUx9y3UbOhO0D2mRlDvI,5267
56
+ port_ocean/context/event.py,sha256=sa-BzqC6Z1kYgRVAZIl29z2bEYu4e_FodxVBgSJOB3g,5275
57
57
  port_ocean/context/ocean.py,sha256=2EreWOj-N2H7QUjEt5wGiv5KHP4pTZc70tn_wHcpF4w,4657
58
58
  port_ocean/context/resource.py,sha256=yDj63URzQelj8zJPh4BAzTtPhpKr9Gw9DRn7I_0mJ1s,1692
59
59
  port_ocean/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -65,7 +65,7 @@ port_ocean/core/event_listener/__init__.py,sha256=mzJ33wRq0kh60fpVdOHVmvMTUQIvz3
65
65
  port_ocean/core/event_listener/base.py,sha256=ntd41fGg_8X58hgnOrZaUVhDM1XbJSk5shf_MW3eAMQ,1327
66
66
  port_ocean/core/event_listener/factory.py,sha256=AYYfSHPAF7P5H-uQECXT0JVJjKDHrYkWJJBSL4mGkg8,3697
67
67
  port_ocean/core/event_listener/http.py,sha256=UjONC_OODHjpGjvsBPAvO6zGzosdmv5Hx96B4WFqpXs,2577
68
- port_ocean/core/event_listener/kafka.py,sha256=h8hNO1OdpA5G9XGrNjG74RYrnzIxeDmUscWYQXNuIqw,6859
68
+ port_ocean/core/event_listener/kafka.py,sha256=0U_TwmlmtS8N2lprkCmnyOmdqOAvghWxHhSfyu46kEs,6875
69
69
  port_ocean/core/event_listener/once.py,sha256=KdvUqjIcyp8XqhY1GfR_KYJfParFIRrjCtcMf3JMegk,2150
70
70
  port_ocean/core/event_listener/polling.py,sha256=GFb89aqC2PrqDkah6gdxjsX1s4q3B87w0dVlZlUbScU,3485
71
71
  port_ocean/core/handlers/__init__.py,sha256=R2HIRD8JTzupY4mXuXveMBQbuiPiiB3Oivmpc5C2jjI,610
@@ -79,11 +79,11 @@ port_ocean/core/handlers/entities_state_applier/port/order_by_entities_dependenc
79
79
  port_ocean/core/handlers/entities_state_applier/port/validate_entity_relations.py,sha256=nKuQ-RlalGG07olxm6l5NHeOuQT9dEZLoMpD-AN5nq0,1392
80
80
  port_ocean/core/handlers/entity_processor/__init__.py,sha256=FvFCunFg44wNQoqlybem9MthOs7p1Wawac87uSXz9U8,156
81
81
  port_ocean/core/handlers/entity_processor/base.py,sha256=3ucPc-esMI5M6gFl_l2j_ncEqOIe7m1bCH4rAXtGDzg,1710
82
- port_ocean/core/handlers/entity_processor/jq_entity_processor.py,sha256=R1oejEASXT9LWtJZ-HNKmd-vpPdyWt2HAq_GJTymO2o,3875
82
+ port_ocean/core/handlers/entity_processor/jq_entity_processor.py,sha256=Xn_BfsddY_NR2Ssbiw6TT6xAm_7gKlZSFVlhlmb2TyA,5425
83
83
  port_ocean/core/handlers/port_app_config/__init__.py,sha256=8AAT5OthiVM7KCcM34iEgEeXtn2pRMrT4Dze5r1Ixbk,134
84
84
  port_ocean/core/handlers/port_app_config/api.py,sha256=6VbKPwFzsWG0IYsVD81hxSmfqtHUFqrfUuj1DBX5g4w,853
85
85
  port_ocean/core/handlers/port_app_config/base.py,sha256=nnMZ4jH6a-4Of9Cn-apMsU0CgNLD9avd5q0gRmc7nZ8,1495
86
- port_ocean/core/handlers/port_app_config/models.py,sha256=E-1J4ccfKD74S86hierzRAX0gRaq571nYcD2aBR8ir0,1924
86
+ port_ocean/core/handlers/port_app_config/models.py,sha256=WtF2uW4KPUPfDpy6E2tl9qXh5GUcDucVvKt0DCTYv6w,1985
87
87
  port_ocean/core/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  port_ocean/core/integrations/base.py,sha256=3jU0skK_gMLB8a_fN8whsRKva-Dz058TFoI0vXTbryU,3193
89
89
  port_ocean/core/integrations/mixins/__init__.py,sha256=FA1FEKMM6P-L2_m7Q4L20mFa4_RgZnwSRmTCreKcBVM,220
@@ -108,7 +108,7 @@ port_ocean/helpers/async_client.py,sha256=SRlP6o7_FCSY3UHnRlZdezppePVxxOzZ0z861v
108
108
  port_ocean/helpers/retry.py,sha256=qZAiNCdhZ9pg55Ol70uJef2PAxHBriBCBg4kbT4naqo,13155
109
109
  port_ocean/log/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
110
  port_ocean/log/handlers.py,sha256=k9G_Mb4ga2-Jke9irpdlYqj6EYiwv0gEsh4TgyqqOmI,2853
111
- port_ocean/log/logger_setup.py,sha256=t4VZOyRExFNatg2YOEZ1hA8qFfb27CHW5NrZfeDgAio,2069
111
+ port_ocean/log/logger_setup.py,sha256=NGU9EdRTPLloiHdgSw0JYaYGr9mx1hYJUEPFHP6BA14,2175
112
112
  port_ocean/log/sensetive.py,sha256=4aD7tdOwoDGi69ah1E4qLnpjE7G6r_UxJ1MwxYit02g,2335
113
113
  port_ocean/middlewares.py,sha256=6GrhldYAazxSwK2TbS-J28XdZ-9wO3PgCcyIMhnnJvI,2480
114
114
  port_ocean/ocean.py,sha256=6MAg7qEVRqpMrKaFiuOKFYc4IEGnSQQJQSigk5Mge8w,4072
@@ -122,8 +122,8 @@ port_ocean/utils/misc.py,sha256=2XmO8W0SgPjV0rd9HZvrHhoMlHprIwmMFsINxlAmgyw,1723
122
122
  port_ocean/utils/repeat.py,sha256=0EFWM9d8lLXAhZmAyczY20LAnijw6UbIECf5lpGbOas,3231
123
123
  port_ocean/utils/signal.py,sha256=Fab0049Cjs69TPTQgvEvilaVZKACQr6tGkRdySjNCi8,1515
124
124
  port_ocean/version.py,sha256=UsuJdvdQlazzKGD3Hd5-U7N69STh8Dq9ggJzQFnu9fU,177
125
- port_ocean-0.5.6.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
126
- port_ocean-0.5.6.dist-info/METADATA,sha256=mVyVE17g71s_j21aiLJjfVtpiWsh6_NKnNLLHtAemh4,6510
127
- port_ocean-0.5.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
128
- port_ocean-0.5.6.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
129
- port_ocean-0.5.6.dist-info/RECORD,,
125
+ port_ocean-0.5.8.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
126
+ port_ocean-0.5.8.dist-info/METADATA,sha256=6ZVNmc5UXUehgwEuIpXdoGy_i7fpJnUgV3xRuwjmeXI,6515
127
+ port_ocean-0.5.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
128
+ port_ocean-0.5.8.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
129
+ port_ocean-0.5.8.dist-info/RECORD,,