contextbase-plugin-linear 0.2.6__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.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.3
2
+ Name: contextbase-plugin-linear
3
+ Version: 0.2.6
4
+ Summary: Linear plugin for ContextBase (PyAirbyte-backed)
5
+ Author: Alizain Feerasta
6
+ Author-email: Alizain Feerasta <alizain.feerasta@gmail.com>
7
+ Requires-Dist: contextbase-shared-plugins==0.2.6
8
+ Requires-Dist: dagster==1.12.14
9
+ Requires-Python: >=3.14, <3.15
@@ -0,0 +1,9 @@
1
+ plugin_linear/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ plugin_linear/binding_config.py,sha256=ds_GPbVRWki1dwigHqPF30tlc4PdLTSvKO5S8l_JuPY,157
3
+ plugin_linear/component.py,sha256=bdxeTIE0WxTFDp7FAh3yCNZaqMzyzwZo9H3P0_ZfIzs,3372
4
+ plugin_linear/defs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ plugin_linear/defs/defs.yaml,sha256=_T8D7FSGlmO9JKV656mMcbK7FSZ7Pn4bza47qbzkaPU,50
6
+ plugin_linear/plugin.json,sha256=89KRnXGc2a0JAkbdFEAp2xPyWOhDawVRLFAXSQR240A,82
7
+ contextbase_plugin_linear-0.2.6.dist-info/WHEEL,sha256=i9aSRDivn5iP9LaR1BLQX2GNAuriQWPsFwbbWygTX2k,81
8
+ contextbase_plugin_linear-0.2.6.dist-info/METADATA,sha256=i0PMnH9PO6NkZEgN_AOV0JID1PtA7OAR8h-_VrQ-ldw,324
9
+ contextbase_plugin_linear-0.2.6.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: uv 0.11.15
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
File without changes
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ from shared_plugins.bindings import BaseBindingConfigModel
4
+
5
+
6
+ class LinearBindingConfig(BaseBindingConfigModel):
7
+ pass
@@ -0,0 +1,98 @@
1
+ import dagster as dg
2
+ from dagster import AssetExecutionContext
3
+ from shared_plugins.automation import non_overlapping_automation_condition
4
+ from shared_plugins.bindings import (
5
+ parse_binding_config,
6
+ require_api_key,
7
+ )
8
+ from shared_plugins.control_plane import ControlPlaneClient
9
+ from shared_plugins.dlt import resolve_partition_binding
10
+ from shared_plugins.naming import (
11
+ dagster_airbyte_sync_asset_key,
12
+ dagster_asset_group_name,
13
+ dagster_asset_tags,
14
+ dagster_partition_def_name,
15
+ dagster_pool_name,
16
+ plugin_id_from_module,
17
+ )
18
+ from shared_plugins.pyairbyte import (
19
+ build_pyairbyte_source,
20
+ require_pyairbyte_selected_stream_names,
21
+ run_pyairbyte_sync,
22
+ )
23
+ from shared_types.api_key_auth import ApiKeyAuth
24
+
25
+ from .binding_config import LinearBindingConfig
26
+
27
+ PLUGIN_ID = plugin_id_from_module(__file__)
28
+ DOCKER_IMAGE = "airbyte/source-linear:0.0.36"
29
+ SOURCE_UPDATED_AT_FIELDS = {
30
+ "issues": "updatedAt",
31
+ "projects": "updatedAt",
32
+ }
33
+
34
+
35
+ def _build_connector_config(
36
+ cfg: LinearBindingConfig,
37
+ auth: ApiKeyAuth,
38
+ ) -> dict[str, object]:
39
+ return {"api_key": auth.api_key}
40
+
41
+
42
+ class LinearSyncComponent(dg.Component):
43
+ def build_defs(self, context: dg.ComponentLoadContext) -> dg.Definitions:
44
+ partitions_def = dg.DynamicPartitionsDefinition(
45
+ name=dagster_partition_def_name(PLUGIN_ID)
46
+ )
47
+
48
+ @dg.asset(
49
+ key=dagster_airbyte_sync_asset_key(PLUGIN_ID),
50
+ group_name=dagster_asset_group_name(PLUGIN_ID),
51
+ tags=dagster_asset_tags(PLUGIN_ID),
52
+ automation_condition=non_overlapping_automation_condition(
53
+ dg.AutomationCondition.on_missing()
54
+ | dg.AutomationCondition.on_cron("*/15 * * * *")
55
+ ),
56
+ partitions_def=partitions_def,
57
+ pool=dagster_pool_name(PLUGIN_ID),
58
+ )
59
+ def linear_sync_asset(
60
+ context: AssetExecutionContext,
61
+ control_plane: dg.ResourceParam[ControlPlaneClient],
62
+ ):
63
+ binding = resolve_partition_binding(
64
+ context=context,
65
+ control_plane=control_plane,
66
+ plugin_id=PLUGIN_ID,
67
+ )
68
+ binding_id = str(binding.binding_id)
69
+ cfg = parse_binding_config(binding, LinearBindingConfig)
70
+ auth = require_api_key(binding)
71
+ selected_stream_names = require_pyairbyte_selected_stream_names(binding)
72
+
73
+ connector_config = _build_connector_config(cfg, auth)
74
+ source = build_pyairbyte_source(
75
+ docker_image=DOCKER_IMAGE,
76
+ connector_config=connector_config,
77
+ )
78
+
79
+ return run_pyairbyte_sync(
80
+ context=context,
81
+ plugin_id=PLUGIN_ID,
82
+ binding_id=binding_id,
83
+ selected_stream_names=selected_stream_names,
84
+ source_updated_at_fields=SOURCE_UPDATED_AT_FIELDS,
85
+ source=source,
86
+ )
87
+
88
+ automation_sensor = dg.AutomationConditionSensorDefinition(
89
+ name="linear_automation_sensor",
90
+ target=dg.AssetSelection.assets(linear_sync_asset),
91
+ default_status=dg.DefaultSensorStatus.RUNNING,
92
+ minimum_interval_seconds=30,
93
+ )
94
+
95
+ return dg.Definitions(
96
+ assets=[linear_sync_asset],
97
+ sensors=[automation_sensor],
98
+ )
File without changes
@@ -0,0 +1 @@
1
+ type: plugin_linear.component.LinearSyncComponent
@@ -0,0 +1,7 @@
1
+ {
2
+ "auth": {
3
+ "type": "api_key"
4
+ },
5
+ "mode": "dagster",
6
+ "plugin_id": "linear"
7
+ }