-
Notifications
You must be signed in to change notification settings - Fork 44
Feat: Make CDK runnable in WASM #672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
7937514
8bc5492
5d46da6
68490dc
14f1ce3
20a43d6
07f0b2a
ebc5412
ca46edf
62925ee
bda9765
c5b0767
7468e2e
a648429
bc1fb21
814136b
4db3c8b
ca18c56
b924fb2
b18e7c2
b3807e3
cbe0ba4
833429c
e389081
df11705
70f7f43
94e073f
974d7d4
595581b
1ac75c6
005b079
d62072a
cfeda8c
f33e4a3
e0a1dac
b90f3f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,8 +1,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import sys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typing import Any, Dict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from serpyco_rs import CustomType, Serializer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from .airbyte_protocol import ( # type: ignore[attr-defined] # all classes are imported to airbyte_protocol via * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AirbyteCatalog, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| AirbyteMessage, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -15,6 +14,14 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ConnectorSpecification, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| USE_RUST_BACKEND = sys.platform != "emscripten" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """When run in WASM, use the pure Python backend for serpyco.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if USE_RUST_BACKEND: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from serpyco_rs import CustomType, Serializer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from serpyco import CustomType, Serializer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+29
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent approach with the constant, but fix mypy issue. I love the Could you fix the mypy issue by using type: ignore comments or restructuring the imports, wdyt? if USE_RUST_BACKEND:
- from serpyco_rs import CustomType, Serializer
+ from serpyco_rs import CustomType, Serializer # type: ignore[misc]
else:
- from serpyco import CustomType, Serializer
+ from serpyco import CustomType, Serializer # type: ignore[misc]Alternatively, you could import with aliases and then assign to common names: if USE_RUST_BACKEND:
- from serpyco_rs import CustomType, Serializer
+ from serpyco_rs import CustomType as _CustomType, Serializer as _Serializer
else:
- from serpyco import CustomType, Serializer
+ from serpyco import CustomType as _CustomType, Serializer as _Serializer
+
+CustomType = _CustomType
+Serializer = _Serializer📝 Committable suggestion
Suggested change
Suggested change
🧰 Tools🪛 GitHub Actions: Linters[error] 23-23: mypy: Name "CustomType" already defined (possibly by an import) [no-redef] [error] 23-23: mypy: Name "Serializer" already defined (possibly by an import) [no-redef] 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class AirbyteStateBlobType(CustomType[AirbyteStateBlob, Dict[str, Any]]): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def serialize(self, value: AirbyteStateBlob) -> Dict[str, Any]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |||||||||||||||||
| import json | ||||||||||||||||||
| import logging | ||||||||||||||||||
| import re | ||||||||||||||||||
| import sys | ||||||||||||||||||
| import tempfile | ||||||||||||||||||
| import traceback | ||||||||||||||||||
| from collections import deque | ||||||||||||||||||
|
|
@@ -28,7 +29,11 @@ | |||||||||||||||||
|
|
||||||||||||||||||
| import orjson | ||||||||||||||||||
| from pydantic import ValidationError as V2ValidationError | ||||||||||||||||||
| from serpyco_rs import SchemaValidationError | ||||||||||||||||||
|
|
||||||||||||||||||
| if sys.platform == 'emscripten': | ||||||||||||||||||
| from serpyco import SchemaValidationError | ||||||||||||||||||
| else: | ||||||||||||||||||
| from serpyco_rs import SchemaValidationError | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix quote consistency for pipeline compliance. The conditional import logic is solid for WASM compatibility! However, there's a formatting issue with quote consistency that's causing the pipeline to fail. Could you apply this fix to match the codebase's quote style, wdyt? -if sys.platform == 'emscripten':
+if sys.platform == "emscripten":📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| from airbyte_cdk.entrypoint import AirbyteEntrypoint | ||||||||||||||||||
| from airbyte_cdk.exception_handler import assemble_uncaught_exception | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix quote consistency for pipeline compliance.
The conditional import approach for the Alias class is perfect for WASM support! Just need to fix the quote style to match the pipeline requirements.
Could you update the quote style to be consistent, wdyt?
📝 Committable suggestion
🤖 Prompt for AI Agents