diff --git a/protocol-models/python/LICENSE.txt b/protocol-models/python/airbyte_protocol/LICENSE.txt similarity index 100% rename from protocol-models/python/LICENSE.txt rename to protocol-models/python/airbyte_protocol/LICENSE.txt diff --git a/protocol-models/python/airbyte_protocol/py.typed b/protocol-models/python/airbyte_protocol/airbyte_protocol/py.typed similarity index 100% rename from protocol-models/python/airbyte_protocol/py.typed rename to protocol-models/python/airbyte_protocol/airbyte_protocol/py.typed diff --git a/protocol-models/python/airbyte_protocol/models/__init__.py b/protocol-models/python/airbyte_protocol/models/__init__.py deleted file mode 100644 index 702ba3f..0000000 --- a/protocol-models/python/airbyte_protocol/models/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# generated by generate-python-classes -name = 'models' -from .airbyte_protocol import * -from .well_known_types import * diff --git a/protocol-models/python/airbyte_protocol/models/airbyte_protocol.py b/protocol-models/python/airbyte_protocol/models/airbyte_protocol.py deleted file mode 100644 index 586556a..0000000 --- a/protocol-models/python/airbyte_protocol/models/airbyte_protocol.py +++ /dev/null @@ -1,327 +0,0 @@ -# generated by datamodel-codegen: -# filename: airbyte_protocol.yaml - -from __future__ import annotations - -from dataclasses import dataclass -from enum import Enum -from typing import Any, Dict, List, Optional - - -class Type(Enum): - RECORD = 'RECORD' - STATE = 'STATE' - LOG = 'LOG' - SPEC = 'SPEC' - CONNECTION_STATUS = 'CONNECTION_STATUS' - CATALOG = 'CATALOG' - TRACE = 'TRACE' - CONTROL = 'CONTROL' - - -class Change(Enum): - NULLED = 'NULLED' - TRUNCATED = 'TRUNCATED' - - -class Reason(Enum): - SOURCE_RECORD_SIZE_LIMITATION = 'SOURCE_RECORD_SIZE_LIMITATION' - DESTINATION_RECORD_SIZE_LIMITATION = 'DESTINATION_RECORD_SIZE_LIMITATION' - PLATFORM_RECORD_SIZE_LIMITATION = 'PLATFORM_RECORD_SIZE_LIMITATION' - SOURCE_FIELD_SIZE_LIMITATION = 'SOURCE_FIELD_SIZE_LIMITATION' - DESTINATION_FIELD_SIZE_LIMITATION = 'DESTINATION_FIELD_SIZE_LIMITATION' - PLATFORM_FIELD_SIZE_LIMITATION = 'PLATFORM_FIELD_SIZE_LIMITATION' - SOURCE_SERIALIZATION_ERROR = 'SOURCE_SERIALIZATION_ERROR' - DESTINATION_SERIALIZATION_ERROR = 'DESTINATION_SERIALIZATION_ERROR' - PLATFORM_SERIALIZATION_ERROR = 'PLATFORM_SERIALIZATION_ERROR' - SOURCE_RETRIEVAL_ERROR = 'SOURCE_RETRIEVAL_ERROR' - DESTINATION_TYPECAST_ERROR = 'DESTINATION_TYPECAST_ERROR' - - -@dataclass -class AirbyteRecordMessageMetaChange: - field: str - change: Change - reason: Reason - - -class AirbyteStateType(Enum): - GLOBAL = 'GLOBAL' - STREAM = 'STREAM' - LEGACY = 'LEGACY' - - -@dataclass -class StreamDescriptor: - name: str - namespace: Optional[str] = None - - -@dataclass -class AirbyteStateBlob: - pass - - -@dataclass -class AirbyteStateStats: - recordCount: Optional[float] = None - - -class Level(Enum): - FATAL = 'FATAL' - ERROR = 'ERROR' - WARN = 'WARN' - INFO = 'INFO' - DEBUG = 'DEBUG' - TRACE = 'TRACE' - - -@dataclass -class AirbyteLogMessage: - level: Level - message: str - stack_trace: Optional[str] = None - - -class TraceType(Enum): - ERROR = 'ERROR' - ESTIMATE = 'ESTIMATE' - STREAM_STATUS = 'STREAM_STATUS' - ANALYTICS = 'ANALYTICS' - - -class FailureType(Enum): - system_error = 'system_error' - config_error = 'config_error' - transient_error = 'transient_error' - - -@dataclass -class AirbyteErrorTraceMessage: - message: str - internal_message: Optional[str] = None - stack_trace: Optional[str] = None - failure_type: Optional[FailureType] = None - stream_descriptor: Optional[StreamDescriptor] = None - - -class EstimateType(Enum): - STREAM = 'STREAM' - SYNC = 'SYNC' - - -@dataclass -class AirbyteEstimateTraceMessage: - name: str - type: EstimateType - namespace: Optional[str] = None - row_estimate: Optional[int] = None - byte_estimate: Optional[int] = None - - -class AirbyteStreamStatus(Enum): - STARTED = 'STARTED' - RUNNING = 'RUNNING' - COMPLETE = 'COMPLETE' - INCOMPLETE = 'INCOMPLETE' - - -class AirbyteStreamStatusReasonType(Enum): - RATE_LIMITED = 'RATE_LIMITED' - - -@dataclass -class AirbyteStreamStatusRateLimitedReason: - quota_reset: Optional[int] = None - - -@dataclass -class AirbyteStreamStatusReason: - type: AirbyteStreamStatusReasonType - rate_limited: Optional[AirbyteStreamStatusRateLimitedReason] = None - - -@dataclass -class AirbyteStreamStatusTraceMessage: - stream_descriptor: StreamDescriptor - status: AirbyteStreamStatus - reasons: Optional[List[AirbyteStreamStatusReason]] = None - - -@dataclass -class AirbyteAnalyticsTraceMessage: - type: str - value: Optional[str] = None - - -class OrchestratorType(Enum): - CONNECTOR_CONFIG = 'CONNECTOR_CONFIG' - - -@dataclass -class AirbyteControlConnectorConfigMessage: - config: Dict[str, Any] - - -class Status(Enum): - SUCCEEDED = 'SUCCEEDED' - FAILED = 'FAILED' - - -@dataclass -class AirbyteConnectionStatus: - status: Status - message: Optional[str] = None - - -class SyncMode(Enum): - full_refresh = 'full_refresh' - incremental = 'incremental' - - -class DestinationSyncMode(Enum): - append = 'append' - overwrite = 'overwrite' - append_dedup = 'append_dedup' - - -class AuthFlowType(Enum): - oauth2_0 = 'oauth2.0' - oauth1_0 = 'oauth1.0' - - -@dataclass -class OAuthConfigSpecification: - oauth_user_input_from_connector_config_specification: Optional[Dict[str, Any]] = ( - None - ) - complete_oauth_output_specification: Optional[Dict[str, Any]] = None - complete_oauth_server_input_specification: Optional[Dict[str, Any]] = None - complete_oauth_server_output_specification: Optional[Dict[str, Any]] = None - - -@dataclass -class AirbyteRecordMessageMeta: - changes: Optional[List[AirbyteRecordMessageMetaChange]] = None - - -@dataclass -class AirbyteStreamState: - stream_descriptor: StreamDescriptor - stream_state: Optional[AirbyteStateBlob] = None - - -@dataclass -class AirbyteGlobalState: - stream_states: List[AirbyteStreamState] - shared_state: Optional[AirbyteStateBlob] = None - - -@dataclass -class AirbyteTraceMessage: - type: TraceType - emitted_at: float - error: Optional[AirbyteErrorTraceMessage] = None - estimate: Optional[AirbyteEstimateTraceMessage] = None - stream_status: Optional[AirbyteStreamStatusTraceMessage] = None - analytics: Optional[AirbyteAnalyticsTraceMessage] = None - - -@dataclass -class AirbyteControlMessage: - type: OrchestratorType - emitted_at: float - connectorConfig: Optional[AirbyteControlConnectorConfigMessage] = None - - -@dataclass -class AirbyteStream: - name: str - json_schema: Dict[str, Any] - supported_sync_modes: List[SyncMode] - source_defined_cursor: Optional[bool] = None - default_cursor_field: Optional[List[str]] = None - source_defined_primary_key: Optional[List[List[str]]] = None - namespace: Optional[str] = None - is_resumable: Optional[bool] = None - - -@dataclass -class ConfiguredAirbyteStream: - stream: AirbyteStream - sync_mode: SyncMode - destination_sync_mode: DestinationSyncMode - cursor_field: Optional[List[str]] = None - primary_key: Optional[List[List[str]]] = None - generation_id: Optional[int] = None - minimum_generation_id: Optional[int] = None - sync_id: Optional[int] = None - - -@dataclass -class AdvancedAuth: - auth_flow_type: Optional[AuthFlowType] = None - predicate_key: Optional[List[str]] = None - predicate_value: Optional[str] = None - oauth_config_specification: Optional[OAuthConfigSpecification] = None - - -@dataclass -class ConnectorSpecification: - connectionSpecification: Dict[str, Any] - documentationUrl: Optional[str] = None - changelogUrl: Optional[str] = None - supportsIncremental: Optional[bool] = None - supportsNormalization: Optional[bool] = False - supportsDBT: Optional[bool] = False - supported_destination_sync_modes: Optional[List[DestinationSyncMode]] = None - advanced_auth: Optional[AdvancedAuth] = None - protocol_version: Optional[str] = None - - -@dataclass -class AirbyteRecordMessage: - stream: str - data: Dict[str, Any] - emitted_at: int - namespace: Optional[str] = None - meta: Optional[AirbyteRecordMessageMeta] = None - - -@dataclass -class AirbyteStateMessage: - type: Optional[AirbyteStateType] = None - stream: Optional[AirbyteStreamState] = None - global_: Optional[AirbyteGlobalState] = None - data: Optional[Dict[str, Any]] = None - sourceStats: Optional[AirbyteStateStats] = None - destinationStats: Optional[AirbyteStateStats] = None - - -@dataclass -class AirbyteCatalog: - streams: List[AirbyteStream] - - -@dataclass -class ConfiguredAirbyteCatalog: - streams: List[ConfiguredAirbyteStream] - - -@dataclass -class AirbyteMessage: - type: Type - log: Optional[AirbyteLogMessage] = None - spec: Optional[ConnectorSpecification] = None - connectionStatus: Optional[AirbyteConnectionStatus] = None - catalog: Optional[AirbyteCatalog] = None - record: Optional[AirbyteRecordMessage] = None - state: Optional[AirbyteStateMessage] = None - trace: Optional[AirbyteTraceMessage] = None - control: Optional[AirbyteControlMessage] = None - - -@dataclass -class AirbyteProtocol: - airbyte_message: Optional[AirbyteMessage] = None - configured_airbyte_catalog: Optional[ConfiguredAirbyteCatalog] = None diff --git a/protocol-models/python/airbyte_protocol/models/well_known_types.py b/protocol-models/python/airbyte_protocol/models/well_known_types.py deleted file mode 100644 index de2a89d..0000000 --- a/protocol-models/python/airbyte_protocol/models/well_known_types.py +++ /dev/null @@ -1,99 +0,0 @@ -# generated by datamodel-codegen: -# filename: well_known_types.yaml - -from __future__ import annotations - -from dataclasses import dataclass -from typing import List, Optional - - -@dataclass -class String: - type: str - description: str - - -@dataclass -class BinaryData: - type: str - description: str - pattern: str - - -@dataclass -class Date: - type: str - pattern: str - description: str - - -@dataclass -class TimestampWithTimezone: - type: str - pattern: str - description: str - - -@dataclass -class TimestampWithoutTimezone: - type: str - pattern: str - description: str - - -@dataclass -class TimeWithTimezone: - type: str - pattern: str - description: str - - -@dataclass -class TimeWithoutTimezone: - type: str - pattern: str - description: str - - -@dataclass -class OneOfItem: - pattern: Optional[str] = None - enum: Optional[List[str]] = None - - -@dataclass -class Number: - type: str - oneOf: List[OneOfItem] - description: str - - -@dataclass -class Integer: - type: str - oneOf: List[OneOfItem] - - -@dataclass -class Boolean: - type: str - description: str - - -@dataclass -class Definitions: - String: String - BinaryData: BinaryData - Date: Date - TimestampWithTimezone: TimestampWithTimezone - TimestampWithoutTimezone: TimestampWithoutTimezone - TimeWithTimezone: TimeWithTimezone - TimeWithoutTimezone: TimeWithoutTimezone - Number: Number - Integer: Integer - Boolean: Boolean - - -@dataclass -class Model: - definitions: Definitions diff --git a/protocol-models/python/pyproject.toml b/protocol-models/python/airbyte_protocol/pyproject.toml similarity index 100% rename from protocol-models/python/pyproject.toml rename to protocol-models/python/airbyte_protocol/pyproject.toml diff --git a/protocol-models/python/airbyte_protocol/setup.py b/protocol-models/python/airbyte_protocol/setup.py new file mode 100644 index 0000000..a4586f5 --- /dev/null +++ b/protocol-models/python/airbyte_protocol/setup.py @@ -0,0 +1,65 @@ +# +# Copyright (c) 2023 Airbyte, Inc., all rights reserved. +# +import pip +pip.main(['install', 'python-dotenv']) + +import os +import pathlib + +from setuptools import setup +from dotenv import load_dotenv + + + +# The directory containing this file +HERE = pathlib.Path(__file__).parent.parent.parent + + + +print(sorted(HERE.iterdir())) + +# The text of the README file +README = (HERE / "readme.md").read_text() + +load_dotenv(HERE / ".env") + +VERSION = os.getenv("VERSION") # use version declared in top level .env file + +setup( + name='airbyte_protocol_models', + version=VERSION, + description="Declares the Airbyte Protocol.", + long_description=README, + long_description_content_type="text/markdown", + author="Airbyte", + author_email="contact@airbyte.io", + license="MIT", + url="https://github.com/airbytehq/airbyte-protocol", + classifiers=[ + # This information is used when browsing on PyPi. + # Dev Status + "Development Status :: 3 - Alpha", + # Project Audience + "Intended Audience :: Developers", + "Topic :: Scientific/Engineering", + "Topic :: Software Development :: Libraries :: Python Modules", + "License :: OSI Approved :: MIT License", + # Python Version Support + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.8", + ], + keywords="airbyte airbyte-protocol", + project_urls={ + "Documentation": "https://docs.airbyte.io/", + "Source": "https://github.com/airbytehq/airbyte-protocol", + "Tracker": "https://github.com/airbytehq/airbyte-protocol/issues", + }, + packages=['airbyte_protocol.models'], + package_data={"airbyte_protocol": ["py.typed"]}, + setup_requires=['python-dotenv'], + install_requires=[ + "pydantic>=1.9.2,<2.0.0", + ], + python_requires=">=3.8", +) diff --git a/protocol-models/python/airbyte_protocol_dataclasses/LICENSE.txt b/protocol-models/python/airbyte_protocol_dataclasses/LICENSE.txt new file mode 100644 index 0000000..06a0065 --- /dev/null +++ b/protocol-models/python/airbyte_protocol_dataclasses/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2020 Airbyte + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/protocol-models/python/airbyte_protocol_dataclasses/airbyte_protocol_dataclasses/py.typed b/protocol-models/python/airbyte_protocol_dataclasses/airbyte_protocol_dataclasses/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/protocol-models/python/airbyte_protocol_dataclasses/pyproject.toml b/protocol-models/python/airbyte_protocol_dataclasses/pyproject.toml new file mode 100644 index 0000000..39ef484 --- /dev/null +++ b/protocol-models/python/airbyte_protocol_dataclasses/pyproject.toml @@ -0,0 +1,9 @@ +# Defines Python build system settings. +[build-system] +requires = [ + "python-dotenv", + "setuptools>=42", + "wheel" +] + +build-backend = "setuptools.build_meta" diff --git a/protocol-models/python/setup.py b/protocol-models/python/airbyte_protocol_dataclasses/setup.py similarity index 100% rename from protocol-models/python/setup.py rename to protocol-models/python/airbyte_protocol_dataclasses/setup.py