contextbase-core 0.2.4__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,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: contextbase-core
3
+ Version: 0.2.4
4
+ Requires-Python: <3.15,>=3.14
5
+ Requires-Dist: contextbase-plugin-asana==0.2.4
6
+ Requires-Dist: contextbase-plugin-chrome-local==0.2.4
7
+ Requires-Dist: contextbase-plugin-claude-local==0.2.4
8
+ Requires-Dist: contextbase-plugin-clickup==0.2.4
9
+ Requires-Dist: contextbase-plugin-codex-local==0.2.4
10
+ Requires-Dist: contextbase-plugin-github==0.2.4
11
+ Requires-Dist: contextbase-plugin-gmail==0.2.4
12
+ Requires-Dist: contextbase-plugin-gong==0.2.4
13
+ Requires-Dist: contextbase-plugin-google-calendar==0.2.4
14
+ Requires-Dist: contextbase-plugin-granola==0.2.4
15
+ Requires-Dist: contextbase-plugin-hubspot==0.2.4
16
+ Requires-Dist: contextbase-plugin-icloud-tabs-local==0.2.4
17
+ Requires-Dist: contextbase-plugin-imessage-local==0.2.4
18
+ Requires-Dist: contextbase-plugin-intercom==0.2.4
19
+ Requires-Dist: contextbase-plugin-jira==0.2.4
20
+ Requires-Dist: contextbase-plugin-linear==0.2.4
21
+ Requires-Dist: contextbase-plugin-microsoft-mail==0.2.4
22
+ Requires-Dist: contextbase-plugin-microsoft-planner-premium==0.2.4
23
+ Requires-Dist: contextbase-plugin-notion==0.2.4
24
+ Requires-Dist: contextbase-plugin-reminders-local==0.2.4
25
+ Requires-Dist: contextbase-plugin-salesforce==0.2.4
26
+ Requires-Dist: contextbase-plugin-slack==0.2.4
27
+ Requires-Dist: contextbase-plugin-whatsapp-local==0.2.4
28
+ Requires-Dist: contextbase-plugin-workflowy==0.2.4
29
+ Requires-Dist: contextbase-shared-plugins==0.2.4
30
+ Requires-Dist: contextbase-shared-types==0.2.4
31
+ Requires-Dist: dagster==1.12.14
32
+ Requires-Dist: httpx>=0.28.1
33
+ Requires-Dist: pydantic-settings>=2.11.0
@@ -0,0 +1,8 @@
1
+ core/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
+ core/definitions.py,sha256=KFeAHKcGo-7DDyeJ4pKKIoQhAIyWwIEShft-IN0cuhw,3123
3
+ core/defs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ core/defs/binding_partitions.py,sha256=geF65nNW-XLk3xkknpi5UbEFhTXYQm40jurKCWhiXJc,2772
5
+ pyproject.toml,sha256=mcZnxF8abnTOUx9Rk-HOk8wCMushFcoglszMhDE1yrc,3765
6
+ contextbase_core-0.2.4.dist-info/METADATA,sha256=RQbYe96RVQiKHrE2PiHqn1kpKlvFlLwlYTPI8U8i8oY,1534
7
+ contextbase_core-0.2.4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
8
+ contextbase_core-0.2.4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.29.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
core/__init__.py ADDED
@@ -0,0 +1 @@
1
+
core/definitions.py ADDED
@@ -0,0 +1,107 @@
1
+ from importlib import import_module
2
+ from pathlib import Path
3
+ from types import ModuleType
4
+
5
+ from dagster import Definitions, ResourceDefinition, definitions, load_from_defs_folder
6
+
7
+ from shared_plugins.control_plane import ControlPlaneClient
8
+ from shared_plugins.env import CTXB_ROOT_DIR_ENV_VAR, load_shared_python_settings
9
+
10
+ PACKAGE_MODULE_NAMES = [
11
+ "core",
12
+ "plugin_asana",
13
+ "plugin_chrome_local",
14
+ "plugin_claude_local",
15
+ "plugin_clickup",
16
+ "plugin_codex_local",
17
+ "plugin_github",
18
+ "plugin_gmail",
19
+ "plugin_gong",
20
+ "plugin_google_calendar",
21
+ "plugin_granola",
22
+ "plugin_hubspot",
23
+ "plugin_icloud_tabs_local",
24
+ "plugin_imessage_local",
25
+ "plugin_intercom",
26
+ "plugin_jira",
27
+ "plugin_linear",
28
+ "plugin_microsoft_mail",
29
+ "plugin_microsoft_planner_premium",
30
+ "plugin_notion",
31
+ "plugin_reminders_local",
32
+ "plugin_salesforce",
33
+ "plugin_slack",
34
+ "plugin_whatsapp_local",
35
+ "plugin_workflowy",
36
+ ]
37
+
38
+
39
+ def _without_component_tree(definitions: Definitions) -> Definitions:
40
+ return Definitions(
41
+ assets=definitions.assets,
42
+ schedules=definitions.schedules,
43
+ sensors=definitions.sensors,
44
+ jobs=definitions.jobs,
45
+ resources=definitions.resources,
46
+ executor=definitions.executor,
47
+ loggers=definitions.loggers,
48
+ asset_checks=definitions.asset_checks,
49
+ metadata=definitions.metadata,
50
+ )
51
+
52
+
53
+ def _resolve_package_root(package_module: ModuleType) -> Path:
54
+ package_file = package_module.__file__
55
+ if package_file is None:
56
+ raise RuntimeError(
57
+ f"Cannot resolve definitions path for module '{package_module.__name__}' because __file__ is missing."
58
+ )
59
+ return Path(package_file).resolve().parent
60
+
61
+
62
+ def _load_defs_for_module(module_name: str) -> Definitions:
63
+ package_module = import_module(module_name)
64
+ return load_from_defs_folder(
65
+ path_within_project=_resolve_package_root(package_module)
66
+ )
67
+
68
+
69
+ def _build_control_plane_client() -> ControlPlaneClient:
70
+ settings = load_shared_python_settings()
71
+ if settings.ctx_root_dir is None:
72
+ raise RuntimeError(
73
+ f"{CTXB_ROOT_DIR_ENV_VAR} is not set; run via ctxb so workspace paths are configured."
74
+ )
75
+
76
+ return ControlPlaneClient(
77
+ control_plane_url=settings.ctx_control_plane_url,
78
+ root_dir=settings.ctx_root_dir,
79
+ )
80
+
81
+
82
+ @definitions
83
+ def defs():
84
+ merged = Definitions.merge(
85
+ *[
86
+ _without_component_tree(_load_defs_for_module(module_name))
87
+ for module_name in PACKAGE_MODULE_NAMES
88
+ ]
89
+ )
90
+
91
+ resources = dict(merged.resources or {})
92
+ control_plane_client = _build_control_plane_client()
93
+ resources["control_plane"] = ResourceDefinition.hardcoded_resource(
94
+ control_plane_client
95
+ )
96
+
97
+ return Definitions(
98
+ assets=merged.assets,
99
+ schedules=merged.schedules,
100
+ sensors=merged.sensors,
101
+ jobs=merged.jobs,
102
+ resources=resources,
103
+ executor=merged.executor,
104
+ loggers=merged.loggers,
105
+ asset_checks=merged.asset_checks,
106
+ metadata=merged.metadata,
107
+ )
core/defs/__init__.py ADDED
File without changes
@@ -0,0 +1,72 @@
1
+ from __future__ import annotations
2
+
3
+ from collections import defaultdict
4
+
5
+ import dagster as dg
6
+ from shared_plugins.control_plane import ControlPlaneClient
7
+ from shared_plugins.naming import dagster_partition_def_name
8
+
9
+ PARTITION_SYNC_SENSOR_MIN_INTERVAL_SECONDS = 30
10
+ BINDING_PARTITIONS_DEF_SUFFIX = "_bindings"
11
+
12
+
13
+ @dg.sensor(
14
+ name="binding_partitions_sync_sensor",
15
+ minimum_interval_seconds=PARTITION_SYNC_SENSOR_MIN_INTERVAL_SECONDS,
16
+ default_status=dg.DefaultSensorStatus.RUNNING,
17
+ )
18
+ def binding_partitions_sync_sensor(
19
+ context: dg.SensorEvaluationContext,
20
+ control_plane: dg.ResourceParam[ControlPlaneClient],
21
+ ) -> dg.SensorResult:
22
+ plan = control_plane.load_binding_plan()
23
+
24
+ active_binding_ids_by_partitions_def: dict[str, set[str]] = defaultdict(set)
25
+ for binding in plan.bindings:
26
+ partitions_def_name = dagster_partition_def_name(binding.plugin_id)
27
+ active_binding_ids_by_partitions_def[partitions_def_name].add(
28
+ str(binding.binding_id)
29
+ )
30
+
31
+ known_partitions_defs = set(active_binding_ids_by_partitions_def)
32
+ repository_def = context.repository_def
33
+ if repository_def is not None:
34
+ for asset_key in repository_def.asset_graph.get_all_asset_keys():
35
+ partitions_def = repository_def.asset_graph.get(asset_key).partitions_def
36
+ if isinstance(partitions_def, dg.DynamicPartitionsDefinition):
37
+ if partitions_def.name.endswith(BINDING_PARTITIONS_DEF_SUFFIX):
38
+ known_partitions_defs.add(partitions_def.name)
39
+
40
+ dynamic_partition_requests = []
41
+
42
+ for partitions_def_name in sorted(known_partitions_defs):
43
+ active_binding_ids = active_binding_ids_by_partitions_def.get(
44
+ partitions_def_name, set()
45
+ )
46
+ partitions_def = dg.DynamicPartitionsDefinition(name=partitions_def_name)
47
+ existing_partition_ids = set(
48
+ context.instance.get_dynamic_partitions(partitions_def_name)
49
+ )
50
+
51
+ partition_additions = sorted(active_binding_ids - existing_partition_ids)
52
+ partition_deletions = sorted(existing_partition_ids - active_binding_ids)
53
+
54
+ if partition_additions:
55
+ dynamic_partition_requests.append(
56
+ partitions_def.build_add_request(partition_additions)
57
+ )
58
+
59
+ if partition_deletions:
60
+ dynamic_partition_requests.append(
61
+ partitions_def.build_delete_request(partition_deletions)
62
+ )
63
+
64
+ if not dynamic_partition_requests:
65
+ return dg.SensorResult(skip_reason="No dynamic partition key changes.")
66
+
67
+ return dg.SensorResult(dynamic_partitions_requests=dynamic_partition_requests)
68
+
69
+
70
+ @dg.definitions
71
+ def defs() -> dg.Definitions:
72
+ return dg.Definitions(sensors=[binding_partitions_sync_sensor])
pyproject.toml ADDED
@@ -0,0 +1,111 @@
1
+ [project]
2
+ name = "contextbase-core"
3
+ requires-python = ">=3.14,<3.15"
4
+ version = "0.2.4"
5
+ dependencies = [
6
+ "contextbase-plugin-asana==0.2.4",
7
+ "contextbase-plugin-chrome-local==0.2.4",
8
+ "contextbase-plugin-claude-local==0.2.4",
9
+ "contextbase-plugin-clickup==0.2.4",
10
+ "contextbase-plugin-codex-local==0.2.4",
11
+ "contextbase-plugin-github==0.2.4",
12
+ "contextbase-plugin-gmail==0.2.4",
13
+ "contextbase-plugin-gong==0.2.4",
14
+ "contextbase-plugin-google-calendar==0.2.4",
15
+ "contextbase-plugin-granola==0.2.4",
16
+ "contextbase-plugin-hubspot==0.2.4",
17
+ "contextbase-plugin-icloud-tabs-local==0.2.4",
18
+ "contextbase-plugin-imessage-local==0.2.4",
19
+ "contextbase-plugin-intercom==0.2.4",
20
+ "contextbase-plugin-jira==0.2.4",
21
+ "contextbase-plugin-linear==0.2.4",
22
+ "contextbase-plugin-microsoft-mail==0.2.4",
23
+ "contextbase-plugin-microsoft-planner-premium==0.2.4",
24
+ "contextbase-plugin-notion==0.2.4",
25
+ "contextbase-plugin-reminders-local==0.2.4",
26
+ "contextbase-plugin-salesforce==0.2.4",
27
+ "contextbase-plugin-slack==0.2.4",
28
+ "contextbase-plugin-whatsapp-local==0.2.4",
29
+ "contextbase-plugin-workflowy==0.2.4",
30
+ "contextbase-shared-plugins==0.2.4",
31
+ "contextbase-shared-types==0.2.4",
32
+ "dagster==1.12.14",
33
+ "httpx>=0.28.1",
34
+ "pydantic-settings>=2.11.0",
35
+ ]
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "dagster-webserver",
40
+ "dagster-dg-cli",
41
+ "pytest>=8.4.2",
42
+ ]
43
+
44
+ [build-system]
45
+ requires = ["hatchling"]
46
+ build-backend = "hatchling.build"
47
+
48
+ [tool.hatch.build.targets.wheel]
49
+ packages = ["src/core"]
50
+ force-include = { "pyproject.toml" = "pyproject.toml" }
51
+
52
+ [tool.dg]
53
+ directory_type = "project"
54
+
55
+ [tool.dg.project]
56
+ root_module = "core"
57
+ registry_modules = [
58
+ "core.components.*",
59
+ "plugin_asana.*",
60
+ "plugin_chrome_local.*",
61
+ "plugin_claude_local.*",
62
+ "plugin_clickup.*",
63
+ "plugin_codex_local.*",
64
+ "plugin_github.*",
65
+ "plugin_gmail.*",
66
+ "plugin_gong.*",
67
+ "plugin_google_calendar.*",
68
+ "plugin_granola.*",
69
+ "plugin_hubspot.*",
70
+ "plugin_icloud_tabs_local.*",
71
+ "plugin_imessage_local.*",
72
+ "plugin_intercom.*",
73
+ "plugin_jira.*",
74
+ "plugin_linear.*",
75
+ "plugin_microsoft_mail.*",
76
+ "plugin_microsoft_planner_premium.*",
77
+ "plugin_notion.*",
78
+ "plugin_reminders_local.*",
79
+ "plugin_salesforce.*",
80
+ "plugin_slack.*",
81
+ "plugin_whatsapp_local.*",
82
+ "plugin_workflowy.*",
83
+ ]
84
+
85
+ [tool.uv.sources]
86
+ contextbase-plugin-asana = { workspace = true }
87
+ contextbase-plugin-chrome-local = { workspace = true }
88
+ contextbase-plugin-claude-local = { workspace = true }
89
+ contextbase-plugin-clickup = { workspace = true }
90
+ contextbase-plugin-codex-local = { workspace = true }
91
+ contextbase-plugin-github = { workspace = true }
92
+ contextbase-plugin-gmail = { workspace = true }
93
+ contextbase-plugin-gong = { workspace = true }
94
+ contextbase-plugin-google-calendar = { workspace = true }
95
+ contextbase-plugin-granola = { workspace = true }
96
+ contextbase-plugin-hubspot = { workspace = true }
97
+ contextbase-plugin-icloud-tabs-local = { workspace = true }
98
+ contextbase-plugin-imessage-local = { workspace = true }
99
+ contextbase-plugin-intercom = { workspace = true }
100
+ contextbase-plugin-jira = { workspace = true }
101
+ contextbase-plugin-linear = { workspace = true }
102
+ contextbase-plugin-microsoft-mail = { workspace = true }
103
+ contextbase-plugin-microsoft-planner-premium = { workspace = true }
104
+ contextbase-plugin-notion = { workspace = true }
105
+ contextbase-plugin-reminders-local = { workspace = true }
106
+ contextbase-plugin-salesforce = { workspace = true }
107
+ contextbase-plugin-slack = { workspace = true }
108
+ contextbase-plugin-whatsapp-local = { workspace = true }
109
+ contextbase-plugin-workflowy = { workspace = true }
110
+ contextbase-shared-plugins = { workspace = true }
111
+ contextbase-shared-types = { workspace = true }